protected override void Act(float deltaTime)
        {
            updateGapListTimer -= deltaTime;

            if (updateGapListTimer <= 0.0f)
            {
                UpdateGapList();

                updateGapListTimer = UpdateGapListInterval;
            }

            if (objectiveList.Any())
            {
                objectiveList[objectiveList.Count - 1].TryComplete(deltaTime);

                if (!objectiveList[objectiveList.Count - 1].CanBeCompleted ||
                    objectiveList[objectiveList.Count - 1].IsCompleted())
                {
                    objectiveList.RemoveAt(objectiveList.Count - 1);
                }
            }
            else
            {
                if (idleObjective == null)
                {
                    idleObjective = new AIObjectiveIdle(character);
                }
                idleObjective.TryComplete(deltaTime);
            }
        }
Exemple #2
0
        protected override void Act(float deltaTime)
        {
            if (Timing.TotalTime > lastGapUpdate + UpdateGapListInterval || objectiveList == null)
            {
                UpdateGapList();
                lastGapUpdate = Timing.TotalTime;
            }

            if (objectiveList.Any())
            {
                if (!objectiveList[objectiveList.Count - 1].Leak.IsRoomToRoom)
                {
                    if (findDivingGear == null)
                    {
                        findDivingGear = new AIObjectiveFindDivingGear(character, true);
                    }

                    if (!findDivingGear.IsCompleted() && findDivingGear.CanBeCompleted)
                    {
                        findDivingGear.TryComplete(deltaTime);
                        return;
                    }
                }

                objectiveList[objectiveList.Count - 1].TryComplete(deltaTime);

                if (!objectiveList[objectiveList.Count - 1].CanBeCompleted ||
                    objectiveList[objectiveList.Count - 1].IsCompleted())
                {
                    objectiveList.RemoveAt(objectiveList.Count - 1);
                }
            }
            else
            {
                if (idleObjective == null)
                {
                    idleObjective = new AIObjectiveIdle(character);
                }
                idleObjective.TryComplete(deltaTime);
            }
        }