Пример #1
0
        public bool ShouldTakeControl()
        {
            //Return true if we're intersecting a radio tower
            for (int i = 0; i < unit.GetVisibleObjects().GetCount(); i++)
            {
                RadioTower t = unit.GetVisibleObjects()[i] as RadioTower;
                if (t != null && !t.IsActive() && unit.HasResources())
                {
                    if (GameMath.TestCircleCircle(t.GetBounds(), unit.GetBounds()))
                    {
                        tower = t;
                        return true;
                    }
                }
            }

            return false;
        }
Пример #2
0
        public bool ShouldTakeControl()
        {
            //Return true if we have a radio tower in mind that isn't active
            if (unit.GetMostRecentTower() != null && !unit.GetMostRecentTower().IsActive() && unit.HasResources())
            {
                tower = unit.GetMostRecentTower();
                return true;
            }

            //or return true if we can see a radio tower
            for (int i = 0; i < unit.GetVisibleObjects().GetCount(); i++)
            {
                RadioTower t = unit.GetVisibleObjects()[i] as RadioTower;
                //If there's a tower I can see, and it's inactive, and I have resources...
                if (t != null && !t.IsActive() && unit.HasResources())
                {
                    tower = t;
                    return true;
                }
            }

            return false;
        }
Пример #3
0
 private void UpdateMostRecentTower()
 {
     for (int i = 0; i < visibleObjects.GetCount(); i++)
     {
         RadioTower t = visibleObjects[i] as RadioTower;
         if (t != null && !t.IsActive())
         {
             if (GameMath.TestCircleCircle(t.GetBounds(), this.GetViewCircle()))
             {
                 mostRecentTower = t;
             }
         }
     }
 }
Пример #4
0
 public void SetMostRecentTower(RadioTower t)
 {
     mostRecentTower = t;
 }