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