本文整理汇总了C#中CardEffect类的典型用法代码示例。如果您正苦于以下问题:C#CardEffect类的具体用法?C#CardEffect怎么用?C#CardEffect使用的例子?这里精选的类代码示例或许可以为您提供帮助。
示例1:UseCardEffect
///
///FirstEffect:Draw2cards
///SecondEffect:Restore5Health
///
///
Thecardeffecttouse
///Thetargetoftheheal
publicvoidUseCardEffect(CardEffectcardEffect,IDamageableEntitytarget=null)
{
if(cardEffect==CardEffect.FIRST)
{
//Drawcards
this.Owner.DrawCards(DRAW_COUNT);
}
elseif(cardEffect==CardEffect.SECOND)
{
//Heal
if(target==null)
{
thrownewInvalidOperationException("Needstohaveatarget!");
}
boolshouldAbort;
GameEventManager.Healing(this.Owner,target,HEAL_AMOUNT,outshouldAbort);
if(!shouldAbort)
{
target.TakeHealing(HEAL_AMOUNT);
}
}
else
{
thrownewInvalidOperationException("Youmustchooseacardeffecttoplayit!");
}
}
原文链接:http://www.jxszl.com/biancheng/C/556677.html