예제 #1
0
 public override void TakeAction()
 {
     // 1: Don't do anything if the object isn't mobile. (Can't move)
     // 2: Pop? if the ZoneID is NULL?
     // 3: Pop? if the destination Zone is NULL?
     if (!ParentBrain.isMobile())
     {
         FailToParent();
     }
     else if (ParentBrain.pPhysics.CurrentCell.ParentZone.ZoneID == null)
     {
         Pop();
     }
     else if (dZone == null)
     {
         Pop();
     }
     else
     {
         FindPath findPath = new FindPath(
             ParentBrain.pPhysics.CurrentCell.ParentZone.ZoneID,
             ParentBrain.pPhysics.CurrentCell.X,
             ParentBrain.pPhysics.CurrentCell.Y,
             dZone,
             dCx,
             dCy,
             ParentBrain.limitToAquatic(),
             false,
             ParentBrain.ParentObject);
         ParentBrain.ParentObject.UseEnergy(1000);
         if (findPath.bFound)
         {
             findPath.Directions.Reverse();
             int num = 0;
             if (MaxTurns > -1)
             {
                 Pop();
             }
             foreach (string direction in findPath.Directions)
             {
                 PushGoal((GoalHandler) new rr_PublicStep(direction));
                 ++num;
                 if (MaxTurns > -1 && num >= MaxTurns)
                 {
                     break;
                 }
             }
         }
         else
         {
             FailToParent();
         }
     }
 }
예제 #2
0
        public override void TakeAction()
        {
            if (!ParentBrain.isMobile())
            {
                FailToParent();
                return;
            }
            if (ParentBrain.pPhysics.CurrentCell.ParentZone.ZoneID == null)
            {
                Pop();
                return;
            }
            if (dZone == null)
            {
                Pop();
                return;
            }
            Cell     currentCell = base.ParentObject.CurrentCell;
            FindPath findPath    = new FindPath(currentCell.ParentZone.ZoneID, currentCell.X, currentCell.Y, dZone, dCx, dCy, ParentBrain.limitToAquatic(), false, ParentBrain.ParentObject, careful);

            ParentBrain.ParentObject.UseEnergy(1000);
            if (findPath.bFound)
            {
                findPath.Directions.Reverse();
                int num = findPath.Directions.Count;
                if (oneShort)
                {
                    num--;
                }
                if (MaxTurns > -1)
                {
                    Pop();
                    if (num > MaxTurns)
                    {
                        num = MaxTurns;
                    }
                }
                for (int i = 0; i < num; i++)
                {
                    PushGoal(new acegiak_Step(findPath.Directions[i], careful, overridesCombat, wandering));
                }
            }
            else
            {
                FailToParent();
            }
        }