Esempio n. 1
0
        public void Execute(Character.NPC actor, ITrigger trigger = null)
        {
            if (!actor.IsDead() && !actor.InCombat)
            {
                Rooms.Room room = Rooms.Room.GetRoom(actor.Location);
                room.GetRoomExits();
                List <Rooms.Exits> availableExits = room.RoomExits;
                if (DateTime.Now.ToUniversalTime() > actor.NextAiAction)  //so it's time for this AI state to execute
                {
                    Commands.CommandParser.ExecuteCommand(actor, availableExits[Extensions.RandomNumber.GetRandomNumber().NextNumber(0, availableExits.Count)].Direction);
                    actor.NextAiAction = DateTime.Now.AddSeconds(Extensions.RandomNumber.GetRandomNumber().NextNumber(60, 121)).ToUniversalTime(); //set when we want this action to execute next
                    if (!FSM.ContinueWithThisState())
                    {
                        actor.Fsm.ChangeState(Speak.GetState(), actor);
                    }
                }
            }

            if (actor.InCombat)
            {
                actor.Fsm.ChangeState(Combat.GetState(), actor);
            }
        }
Esempio n. 2
0
File: AI.cs Progetto: vadian/Novus
 public static FSM GetInstance()
 {
     return _fsm ?? (_fsm = new FSM());
 }
Esempio n. 3
0
 public State(FSM fsm)
 {
     m_fsm = fsm;
 }
Esempio n. 4
0
File: AI.cs Progetto: vadian/Novus
 public static FSM GetInstance()
 {
     return(_fsm ?? (_fsm = new FSM()));
 }