本文整理汇总了C#中ICharacter.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ICharacter.GetType方法的具体用法?C# ICharacter.GetType怎么用?C# ICharacter.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICharacter
的用法示例。
在下文中一共展示了ICharacter.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnterAttackPhase
private void EnterAttackPhase(ICharacter enemy)
{
if (enemy.HitPoints == 0)
{
return;
}
this.renderer.WriteLine(
"Enemy encountered: {0} (damage: {1}, hit points: {2})",
enemy.GetType().Name,
enemy.Damage,
enemy.HitPoints);
while (enemy.HitPoints > 0)
{
this.renderer.WriteLine("Do you want to attack? (y/n)");
string choice = this.inputHandler.ReadLine();
while (choice != "n" & choice != "y")
{
this.renderer.WriteLine("Invalid choice, please enter 'y' or 'n'.");
choice = this.inputHandler.ReadLine();
}
switch (choice)
{
case "n":
this.renderer.WriteLine("Chicken!!! Y U no fight?!?");
return;
case "y":
this.PerformAttack(enemy);
break;
}
}
}
示例2: WriteCharacter
private void WriteCharacter(ICharacter ch, ListSet<Timeline> unboundClasses)
{
int cid;
if (ch == null)
{
return;
}
if (this.characterMarshal.HasMarshalled(ch))
{
return;
}
int fontID = -1;
if (ch is IFontUserProcessor)
{
IFontUserProcessor fup = (IFontUserProcessor)ch;
fup.FontUserProc(delegate(IFontUser fu)
{
if (fu.HasFont && !characterMarshal.HasMarshalled(fu.Font))
{
fontID = characterMarshal.GetIDFor(fu.Font);
this.WriteFont(fu.Font, fontID);
}
else
{
fontID = characterMarshal.GetExistingIDFor(fu.Font);
}
});
}
if (ch is IShape)
{
IImage[] images = ((IShape)ch).GetImages();
if (images != null)
{
foreach (IImage image in images)
{
this.WriteImage(image);
}
}
Tag format;
byte[] shapeBytes = ShapeWriter.ShapeToBytes((IShape)ch, out format);
WriteBuffer shapeTag = this.OpenTag(format);
cid = this.characterMarshal.GetIDFor(ch);
shapeTag.WriteUI16((uint)cid);
shapeTag.WriteBytes(shapeBytes);
#if DEBUG
this.LogMessage("char id=" + cid);
#endif
this.CloseTag();
}
else if (ch is Sprite)
{
this.WriteSprite((Sprite)ch, unboundClasses);
}
else if (ch is EditText)
{
this.WriteEditText((EditText)ch, fontID);
}
else if (ch is StaticText)
{
this.WriteStaticText((StaticText)ch);
}
else
{
/* ISSUE 73 */
throw new SWFModellerException(
SWFModellerError.UnimplementedFeature,
"Character of type " + ch.GetType().ToString() + " not currently supported in writer");
}
if (ch is Timeline)
{
Timeline tl = (Timeline)ch;
if (tl.HasClass && !(tl.Class is AdobeClass) && !unboundClasses.Contains(tl))
{
unboundClasses.Add(tl);
}
}
}