예제 #1
0
파일: States.cs 프로젝트: vadian/Novus
        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);
            }
        }
예제 #2
0
파일: States.cs 프로젝트: vadian/Novus
 public static Combat GetState()
 {
     return(_combat ?? (_combat = new Combat()));
 }
예제 #3
0
파일: States.cs 프로젝트: vadian/Novus
 public static Combat GetState()
 {
     return _combat ?? (_combat = new Combat());
 }