예제 #1
0
 public void AddLargeRock(Vector2 p, NPC.AffliationTypes aT)
 {
     if (inactiveLargeRocks.Count > 0)
     {
         LargeRock temp = inactiveLargeRocks.Pop();
         temp.Set(p, aT, managers);
         activeLargeRocks.Add(temp);
     }
     else
     {
         LargeRock temp = activeLargeRocks[0];
         temp.Set(p, aT, managers);
         activeLargeRocks.RemoveAt(0);
         activeLargeRocks.Add(temp);
     }
 }
예제 #2
0
        private Vector2 FindClosestRock(ManagerHelper mH)
        {
            float     closestDistance = float.PositiveInfinity;
            float     distance;
            LargeRock closestRock = null;

            foreach (LargeRock rock in mH.GetAbilityManager().GetLargeRocks())
            {
                distance = PathHelper.DistanceSquared(rock.GetOriginPosition(), this.GetOriginPosition());
                if (distance < closestDistance && rock.IsFullyUp())
                {
                    closestDistance = distance;
                    closestRock     = rock;
                }
            }

            return(closestRock != null ? closestRock.GetOriginPosition() : new Vector2(-1, -1));
        }