Beispiel #1
0
        private void RunProjectile(float deltaTime, Turn turn, Projectile projectile)
        {
            MoveProjectile(deltaTime, projectile);

            if (projectile.Target.DistanceFrom(projectile.Position) < 0.75f)
            {
                var actor = projectile.Owner;
                var ability = projectile.Ability;
                var abilityTarget = projectile.Target;

                ApplyAbilityOutcome(turn, actor, ability, abilityTarget);

                projectile.IsAlive = false;
            }
        }
Beispiel #2
0
 private void MoveProjectile(float deltaTime, Projectile projectile)
 {
     var d = new Vector3(projectile.Target.Position, projectile.Target.Radius) - projectile.Position;
     if (d.Length() > 1)
         d.Normalize();
     projectile.Position += d * projectile.Speed * deltaTime;
 }