Пример #1
0
        public Actor getPlayerTarget(float maxDistSq)
        {
            Player result = null;
            float  num    = maxDistSq;

            using (List <Entity> .Enumerator enumerator = base.Level [GameTags.Player].GetEnumerator()) {
                while (enumerator.MoveNext())
                {
                    Player player = (Player)enumerator.Current;
                    if (this.CanAttack(player))
                    {
                        float num2 = WrapMath.WrapDistanceSquared(this.Position, player.Position);
                        if (num2 < num)
                        {
                            num    = num2;
                            result = player;
                        }
                    }
                }
            }
            if (result != null)
            {
                targetIsGhost = false;
                playerTarget  = result;
            }
            return(result);
        }
Пример #2
0
        public Actor getGhostTarget(float maxDistSq)
        {
            PlayerGhost result = null;
            float       num    = maxDistSq;

            using (List <Entity> .Enumerator enumerator = base.Level [GameTags.PlayerGhost].GetEnumerator()) {
                while (enumerator.MoveNext())
                {
                    PlayerGhost ghost = (PlayerGhost)enumerator.Current;
                    if (this.CanAttackGhost(ghost))
                    {
                        float num2 = WrapMath.WrapDistanceSquared(this.Position, ghost.Position);
                        if (num2 < num)
                        {
                            num    = num2;
                            result = ghost;
                        }
                    }
                }
            }
            if (result != null)
            {
                targetIsGhost = true;
                ghostTarget   = result;
            }
            return(result);
        }
Пример #3
0
 public Vector2 GetTargetSpeed()
 {
     return(WrapMath.Shortest(this.Position, this.target.Position).SafeNormalize(MathHelper.Lerp(1.2f, 2.4f, this.lerp)));
 }