本文整理匯總了C#中Character.Save方法的典型用法代碼示例。如果您正苦於以下問題:C# Character.Save方法的具體用法?C# Character.Save怎麽用?C# Character.Save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Character
的用法示例。
在下文中一共展示了Character.Save方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CommitChanges
public DataObjectOperationResult CommitChanges(CharacterFormModel postedData)
{
Mapper.CreateMap<CharacterFormModel, Character>();
var character = new Character(Db);
Mapper.Map<CharacterFormModel, Character>(postedData, character);
var results = character.Save();
postedData.Id = character.Id;
return results;
}
示例2: ChangeState
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: Enter
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();
}
示例4: Execute
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();
}