Ejemplo n.º 1
0
        public FearObject GetClosesLeavingTarget(IEnumerable <FearObject> enemies)
        {
            float      minD    = 10000000;
            FearObject closest = null;

            foreach (var en in enemies.Where(en => !en.IsDead))
            {
                if (Math.Abs(this.P.X - en.P.X) > minD)
                {
                    continue;
                }
                if (Math.Abs(this.P.Y - en.P.Y) > minD)
                {
                    continue;
                }
                float d = Distance(this.P, en.P);
                if (minD > d)
                {
                    minD    = d;
                    closest = en;
                }
            }

            return(closest);
        }
Ejemplo n.º 2
0
        public void SwapBetterAmunition(FearObject target)
        {
            if (Shield < target.Shield)
            {
                float my = Shield;
                Shield        = target.Shield;
                target.Shield = my;
            }

            if (Sword < target.Sword)
            {
                float my = Sword;
                Sword        = target.Sword;
                target.Sword = my;
            }
        }