示例#1
0
文件: States.cs 项目: vadian/Novus
 public void Enter(Character.NPC actor)
 {
     //ok when we enter this state we will first set the description to the NPC is sitting here rotting,
     //then decomposing and finally get rid of him on exit
     actor.Description  = "The recently dead carcass of " + actor.FirstName + " is rotting as maggots feast on its entrails.";
     actor.NextAiAction = DateTime.Now.AddMinutes(10).ToUniversalTime();
     actor.Save();
 }
示例#2
0
文件: AI.cs 项目: vadian/Novus
 public void ChangeState(IState newState, Character.NPC Actor)
 {
     if (state != null && newState != null)
     {
         state.Exit(Actor);
         previousState = state;
         state         = newState;
         state.Enter(Actor);
         Actor.Save();
     }
 }
示例#3
0
文件: States.cs 项目: vadian/Novus
 public void Execute(Character.NPC actor, ITrigger trigger = null)
 {
     if (actor.StanceState != CharacterEnums.CharacterStanceState.Laying_unconcious &&
         actor.StanceState != CharacterEnums.CharacterStanceState.Laying_dead &&
         actor.StanceState != CharacterEnums.CharacterStanceState.Decomposing)
     {
         if (DateTime.Now.ToUniversalTime() > actor.NextAiAction)  //so it's time for this AI state to execute
         {
             string message = "Hey pal, you looking for trouble?";
             if (trigger.MessageOverrideAsString.Count > 0)
             {
                 message = trigger.MessageOverrideAsString[RandomNumber.GetRandomNumber().NextNumber(0, trigger.MessageOverrideAsString.Count)];
             }
             Commands.CommandParser.ExecuteCommand(actor, "say", message);
         }
     }
     //either way we are not staying in this state, it's just a blip state
     actor.NextAiAction = DateTime.Now.AddSeconds(Extensions.RandomNumber.GetRandomNumber().NextNumber(60, 121)).ToUniversalTime(); //set when we want this action to execute next
     actor.Fsm.RevertState();
     actor.Save();
 }