示例#1
0
 public override void TakeAction()
 {
     if (!ParentBrain.isMobile())
     {
         Pop();
     }
     else
     {
         GameObject gameObject = CellHasFriendly(ParentBrain.pPhysics.CurrentCell.GetCellFromDirection(Dir, true));
         if (gameObject != null && gameObject.HasPart("Brain"))
         {
             Brain part = gameObject.GetPart("Brain") as Brain;
             if (gameObject.IsPlayer() || part.Target != null && part.Target == ParentBrain.Target)
             {
                 return;
             }
         }
         if (CellHasHostile(ParentBrain.pPhysics.CurrentCell.GetCellFromDirection(Dir, true)))
         {
             Think("There's something in my way!");
             FailToParent();
         }
         else
         {
             MoveDirection(Dir);
             Pop();
         }
     }
 }
示例#2
0
        public override void TakeAction()
        {
            if (!ParentBrain.isMobile())
            {
                Pop();
                return;
            }
            if (Toward != null && !Toward.IsValid())
            {
                Toward = null;
                Think("I was trying to go toward someone, but they're gone!");
                FailToParent();
                return;
            }
            Cell cellFromDirection = ParentBrain.pPhysics.CurrentCell.GetCellFromDirection(Dir);

            if (cellFromDirection == null)
            {
                Think("I can't move there!");
                FailToParent();
                return;
            }
            if (wandering && cellFromDirection.HasObjectWithTagOrProperty("WanderStopper"))
            {
                Think("I shouldn't wander there!");
                FailToParent();
                return;
            }
            if (careful && cellFromDirection.NavigationWeight(base.ParentObject, bSmart: true) > 0)
            {
                Think("That's too dangerous!");
                FailToParent();
                return;
            }
            GameObject gameObject = CellHasFriendly(cellFromDirection);

            if (gameObject != null && gameObject.HasPart("Brain"))
            {
                Brain brain = gameObject.GetPart("Brain") as Brain;
                if (gameObject.IsPlayer() || (brain.Target != null && brain.Target == ParentBrain.Target))
                {
                    return;
                }
            }
            if (CellHasHostile(cellFromDirection))
            {
                Think("There's something in my way!");
                FailToParent();
            }
            else
            {
                MoveDirection(Dir);
                Pop();
            }
        }
示例#3
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();
         }
     }
 }
示例#4
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();
            }
        }
示例#5
0
        public override bool Finished()
        {
            if (!ParentBrain.isMobile())
            {
                return(true);
            }
            Cell currentCell = base.ParentObject.CurrentCell;

            if (currentCell != null)
            {
                if (currentCell.X == dCx && currentCell.Y == dCy)
                {
                    return(true);
                }
                if (oneShort && currentCell.DistanceTo(dCx, dCy) <= 1)
                {
                    return(true);
                }
            }
            return(false);
        }
示例#6
0
        public override bool Finished()
        {
            Cell myCell = ParentBrain.pPhysics.CurrentCell;

            return(!ParentBrain.isMobile() || myCell.X == dCx && myCell.Y == dCy);
        }