本文整理汇总了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();
}