示例#1
0
 bool tryTargetedAnim(TableManager table, THHPlayer.UseEventArg eventArg)
 {
     if (eventArg.targets != null && eventArg.targets.Length > 0 && eventArg.targets[0] is var targetCard)
     {
         SimpleAnim simpleAnim = null;
         Animator   animator   = null;
         if (_targetedAnim == null)
         {
             if (table.tryGetMaster(targetCard, out var targetMaster))
             {
                 simpleAnim = targetMaster.onTargeted;
                 animator   = targetMaster.animator;
             }
             else if (table.tryGetServant(targetCard, out var targetServant))
             {
                 simpleAnim = targetServant.onTargeted;
                 animator   = targetServant.animator;
             }
             else
             {
                 throw new ActorNotFoundException(targetCard);
             }
         }
         if (!SimpleAnimHelper.update(table, ref _targetedAnim, simpleAnim, animator, next => false))
         {
             return(true);
         }
     }
     return(false);
 }
示例#2
0
        public override bool update(TableManager table, Card.RemoveModiEventArg eventArg)
        {
            SimpleAnim simpleAnim = null;
            Animator   animator   = null;

            if (table.tryGetServant(eventArg.card, out var servant))
            {
                //animator = servant.animator;
                //if (eventArg.modifier is AttackModifier atkMod)
                //{
                //    if (atkMod.value > 0)
                //        simpleAnim = servant.onAttackUp;
                //    else
                //        simpleAnim = servant.onAttackDown;
                //    servant.AttackTextPropNumber.asText.text = eventArg.card.getAttack(table.game).ToString();
                //}
                //else if (eventArg.modifier is LifeModifier lifMod)
                //{
                //    if (lifMod.value > 0)
                //        simpleAnim = servant.onLifeUp;
                //    else
                //        simpleAnim = servant.onLifeDown;
                //    servant.HpTextPropNumber.asText.text = eventArg.card.getCurrentLife(table.game).ToString();
                //}
            }
            else if (table.tryGetHand(eventArg.card, out var hand))
            {
                animator = hand.animator;
                //if (eventArg.modifier is AttackModifier atkMod)
                //{
                //    if (atkMod.value > 0)
                //        simpleAnim = hand.onAttackUp;
                //    else
                //        simpleAnim = hand.onAttackDown;
                //    hand.Card.AttackPropNumber.asText.text = eventArg.card.getAttack(table.game).ToString();
                //}
                //else if (eventArg.modifier is LifeModifier lifMod)
                //{
                //    if (lifMod.value > 0)
                //        simpleAnim = hand.onLifeUp;
                //    else
                //        simpleAnim = hand.onLifeDown;
                //    hand.Card.LifePropNumber.asText.text = eventArg.card.getLife(table.game).ToString();
                //}
                /*else */
                if (eventArg.modifier is CostModifier)
                {
                    if (eventArg.card.getCost(table.game) == eventArg.card.define.getCost())
                    {
                        simpleAnim = hand.onCostResume;
                    }
                    hand.Card.CostPropNumber.asText.text = eventArg.card.getCost(table.game).ToString();
                }
            }
            if (!SimpleAnimHelper.update(table, ref _anim, simpleAnim, animator))
            {
                return(false);
            }
            return(true);
        }
示例#3
0
 public static bool update(TableManager table, ref AnimAnim anim, SimpleAnim simpleAnim, Animator animator, Func <UIAnimation, bool> onBlockAnim = null)
 {
     if (simpleAnim == null)
     {
         return(true);
     }
     if (anim == null)
     {
         simpleAnim.invokeBeforeAnim();
         anim = new AnimAnim(animator, simpleAnim.animName, onBlockAnim);
     }
     if (!anim.update(table))
     {
         return(false);
     }
     simpleAnim.afterAnim.Invoke();
     anim = null;
     return(true);
 }
 public static bool update(TableManager table, ref AnimAnim anim, SimpleAnim simpleAnim, Animator animator, Func <UIAnimation, bool> onBlockAnim = null)
 {
     if (simpleAnim == null)
     {
         return(true);
     }
     ;
     simpleAnim.beforeAnim.Invoke();
     if (!string.IsNullOrEmpty(simpleAnim.animName) && animator != null)
     {
         if (anim == null)
         {
             anim = new AnimAnim(animator, simpleAnim.animName, onBlockAnim);
         }
         if (!anim.update(table))
         {
             return(false);
         }
     }
     simpleAnim.afterAnim.Invoke();
     anim = null;
     return(true);
 }
示例#5
0
 void Awake()
 {
     anim           = GetComponent <SimpleAnim>();
     spriteRenderer = GetComponent <SpriteRenderer>();
 }
示例#6
0
        public override bool update(TableManager table, TouhouCardEngine.Card.AddModiEventArg eventArg)
        {
            SimpleAnim simpleAnim = null;
            Animator   animator   = null;

            if (table.tryGetServant(eventArg.card, out var servant))
            {
                animator = servant.animator;
                if (eventArg.modifier is AttackModifier atkMod)
                {
                    if (atkMod.value > 0)
                    {
                        simpleAnim = servant.onAttackUp;
                    }
                    else
                    {
                        simpleAnim = servant.onAttackDown;
                    }
                    servant.AttackTextPropNumber.asText.text = eventArg.card.getAttack(table.game).ToString();
                }
                else if (eventArg.modifier is LifeModifier lifMod)
                {
                    if (lifMod.value > 0)
                    {
                        simpleAnim = servant.onLifeUp;
                    }
                    else
                    {
                        simpleAnim = servant.onLifeDown;
                    }
                    servant.HpTextPropNumber.asText.text = eventArg.card.getCurrentLife(table.game).ToString();
                }
            }
            else if (table.tryGetHand(eventArg.card, out var hand))
            {
                animator = hand.animator;
                if (eventArg.modifier is AttackModifier atkMod)
                {
                    if (atkMod.value > 0)
                    {
                        simpleAnim = hand.onAttackUp;
                    }
                    else
                    {
                        simpleAnim = hand.onAttackDown;
                    }
                    hand.Card.AttackPropNumber.asText.text = eventArg.card.getAttack(table.game).ToString();
                }
                else if (eventArg.modifier is LifeModifier lifMod)
                {
                    if (lifMod.value > 0)
                    {
                        simpleAnim = hand.onLifeUp;
                    }
                    else
                    {
                        simpleAnim = hand.onLifeDown;
                    }
                    hand.Card.LifePropNumber.asText.text = eventArg.card.getLife(table.game).ToString();
                }
                else if (eventArg.modifier is CostModifier costMod)
                {
                    if (costMod.value > 0)
                    {
                        simpleAnim = hand.onCostUp;
                    }
                    else
                    {
                        simpleAnim = hand.onCostDown;
                    }
                    hand.Card.CostPropNumber.asText.text = eventArg.card.getCost(table.game).ToString();
                }
            }
            if (!SimpleAnimHelper.update(table, ref _anim, simpleAnim, animator))
            {
                return(false);
            }
            return(true);
        }
 void UpdateAnim(SimpleAnim NextState)
 {
     Anim.Play(NextState.ToString());
 }