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); } }
public static FSM GetInstance() { return _fsm ?? (_fsm = new FSM()); }
public State(FSM fsm) { m_fsm = fsm; }
public static FSM GetInstance() { return(_fsm ?? (_fsm = new FSM())); }