Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach (var pointer in Game.BufferShoots)
- {
- ref var source = ref Game.BufferShoots[pointer];
- ref var position = ref source.position;
- ref var timer = ref source.timer;
- var nTarget = Phys.GetRay2D(position, source.direction, source.direction.x * delta, source.mask);
- if (nTarget.entity.Exist)
- {
- source.bullet.gameObject.Release(Pool.Entities);
- Game.BufferShoots.Remove(pointer);
- // Add Attack
- ref var sAttack = ref Game.bufferAttacks.Add();
- sAttack.attackDirection = source.direction.normalized;
- sAttack.damage = (int) source.damage;
- sAttack.target = nTarget.entity;
- sAttack.attackPosition = position;
- continue;
- }
- position.x += source.direction.x * delta;
- position.y += source.direction.y * delta;
- source.bullet.position = position;
- if ((timer -= delta) <= delta)
- {
- source.bullet.gameObject.Release(Pool.Entities);
- Game.BufferShoots.Remove(pointer);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement