public override bool update(Table table)
 {
     if (table.getServant(eventArg.card) is Servant attackServant)
     {
         if (table.getMaster(eventArg.target) is Master targetMaster)
         {
             if (!_timer1.isStarted)
             {
                 _timer1.start();
             }
             attackServant.getChild("Root").position =
                 Vector3.Lerp(attackServant.rectTransform.position, targetMaster.rectTransform.position,
                              attackServant.attackAnimationCurve.Evaluate(_timer1.progress));
             if (!_timer1.isExpired())
             {
                 return(false);
             }
             if (!_timer2.isStarted)
             {
                 _timer2.start();
             }
             attackServant.getChild("Root").position =
                 Vector3.Lerp(targetMaster.rectTransform.position, attackServant.rectTransform.position,
                              attackServant.attackAnimationCurve.Evaluate(_timer2.progress));
             if (!_timer2.isExpired())
             {
                 return(false);
             }
         }
         else if (table.getServant(eventArg.target) is Servant targetServant)
         {
             if (!_timer1.isStarted)
             {
                 _timer1.start();
             }
             attackServant.getChild("Root").position =
                 Vector3.Lerp(attackServant.rectTransform.position, targetServant.rectTransform.position,
                              attackServant.attackAnimationCurve.Evaluate(_timer1.progress));
             if (!_timer1.isExpired())
             {
                 return(false);
             }
             if (!_timer2.isStarted)
             {
                 _timer2.start();
             }
             attackServant.getChild("Root").position =
                 Vector3.Lerp(targetServant.rectTransform.position, attackServant.rectTransform.position,
                              attackServant.attackAnimationCurve.Evaluate(_timer2.progress));
             if (!_timer2.isExpired())
             {
                 return(false);
             }
         }
         attackServant.update(attackServant.card.owner as THHPlayer, attackServant.card, table.getSkin(attackServant.card));
     }
     return(true);
 }
 public override bool update(Table table)
 {
     if (eventArg.player == table.player)
     {
         if (!table.ServantPlaceHolder.Servant.isDisplaying)
         {
             Card card = table.usingHand.Card;
             if (!_timer.isStarted)
             {
                 _startPosition = card.rectTransform.position;
                 _timer.start();
             }
             card.rectTransform.position = Vector3.Lerp(_startPosition, table.ServantPlaceHolder.rectTransform.position, card.useCurve.Evaluate(_timer.progress));
             if (!_timer.isExpired())
             {
                 return(false);
             }
         }
         table.SelfHandList.removeItem(table.usingHand.Card.GetComponentInParent <HandListItem>());
         table.addChild(table.ServantPlaceHolder.rectTransform);
         table.ServantPlaceHolder.hide();
     }
     else
     {
         var hand = table.EnemyHandList.FirstOrDefault(i => i.Card.card == eventArg.card);
         if (hand == null)
         {
             throw new ActorNotFoundException(eventArg.card);
         }
         if (!table.ServantPlaceHolder.Servant.isDisplaying)
         {
             //敌方使用随从
             if (!_timer.isStarted)
             {
                 table.EnemyFieldList.addChild(table.ServantPlaceHolder.rectTransform);
                 table.EnemyFieldList.defaultItem.rectTransform.SetAsFirstSibling();
                 table.ServantPlaceHolder.rectTransform.SetSiblingIndex(eventArg.position + 1);
                 table.ServantPlaceHolder.display();
                 _startPosition = hand.Card.rectTransform.position;
                 _timer.start();
             }
             hand.Card.rectTransform.position = Vector3.Lerp(_startPosition, table.ServantPlaceHolder.rectTransform.position, hand.Card.useCurve.Evaluate(_timer.progress));
             if (!_timer.isExpired())
             {
                 return(false);
             }
         }
         table.EnemyHandList.removeItem(hand);
         table.addChild(table.ServantPlaceHolder.rectTransform);
         table.ServantPlaceHolder.hide();
     }
     return(true);
 }
Exemple #3
0
 public override bool update(Table table)
 {
     if (eventArg.player == table.player)
     {
         table.SelfHandList.removeItem(table.usingHand.Card.GetComponentInParent <HandListItem>());
     }
     else
     {
         var hand = table.EnemyHandList.FirstOrDefault(i => i.Card.card == eventArg.card);
         if (hand == null)
         {
             throw new ActorNotFoundException(eventArg.card);
         }
         if (!_timer.isStarted)
         {
             _startPosition = hand.Card.rectTransform.position;
             _timer.start();
         }
         if (_timer.progress <= .4f)
         {
             hand.Card.rectTransform.position = Vector3.Lerp(_startPosition, table.getChild("SpellDisplay").position, hand.Card.useCurve.Evaluate(_timer.progress / .4f));
         }
         else
         {
             hand.Card.rectTransform.position = table.getChild("SpellDisplay").position;
         }
         if (!_timer.isExpired())
         {
             return(false);
         }
         table.EnemyHandList.removeItem(hand);
     }
     return(true);
 }
 public override bool update(Table table)
 {
     if (!_timer.isStarted)
     {
         if (eventArg.player == table.player)
         {
             _item = table.SelfHandList.addItem();
             _item.Card.update(eventArg.card, table.getSkin(eventArg.card));
             _item.Card.rectTransform.position = table.SelfDeck.rectTransform.position;
             _startPosition = table.SelfDeck.rectTransform.position;
         }
         else
         {
             _item = table.EnemyHandList.addItem();
             _item.Card.update(eventArg.card, null);
             _item.Card.rectTransform.position = table.EnemyDeck.rectTransform.position;
             _startPosition = table.EnemyDeck.rectTransform.position;
         }
         _timer.start();
     }
     _item.Card.rectTransform.position = Vector3.Lerp(_startPosition, _item.rectTransform.position, _item.Card.drawCurve.Evaluate(_timer.progress));
     if (!_timer.isExpired())
     {
         return(false);
     }
     return(true);
 }
 public override bool update(Table table)
 {
     if (!_timer.isStarted)
     {
         if (eventArg.player == table.player)
         {
             _card = UnityEngine.Object.Instantiate(table.SelfDeck.Card_5, table.SelfDeck.rectTransform.position, Quaternion.identity, table.rectTransform);
         }
         else
         {
             _card = UnityEngine.Object.Instantiate(table.EnemyDeck.Card_5, table.EnemyDeck.rectTransform.position, Quaternion.identity, table.rectTransform);
         }
         _card.update(eventArg.card, table.getSkin(eventArg.card));
         _timer.start();
     }
     if (eventArg.player == table.player)
     {
         _card.rectTransform.position = Vector3.Lerp(table.SelfDeck.rectTransform.position, table.SelfGraveDeck.rectTransform.position, _timer.progress);
     }
     else
     {
         _card.rectTransform.position = Vector3.Lerp(table.EnemyDeck.rectTransform.position, table.EnemyGraveDeck.rectTransform.position, _timer.progress);
     }
     if (!_timer.isExpired())
     {
         return(false);
     }
     UnityEngine.Object.Destroy(_card.gameObject);
     return(true);
 }
Exemple #6
0
 public override bool update(Table table)
 {
     if (!_timer.isStarted)
     {
         table.Fatigue.display();
         table.Fatigue.Text.text = "没有牌了,你受到了" + eventArg.player.fatigue + "点伤害!";
         _timer.start();
     }
     table.Fatigue.rectTransform.localScale = Vector3.Lerp(Vector3.one * .5f, Vector3.one, table.Fatigue.moveCurve.Evaluate(_timer.getProgress(0, .5f)));
     if (eventArg.player == table.player)
     {
         table.Fatigue.rectTransform.localPosition = Vector3.Lerp(table.SelfDeck.rectTransform.localPosition, Vector3.zero, table.Fatigue.moveCurve.Evaluate(_timer.getProgress(0, .5f)));
     }
     else
     {
         table.Fatigue.rectTransform.localPosition = Vector3.Lerp(table.EnemyDeck.rectTransform.localPosition, Vector3.zero, table.Fatigue.moveCurve.Evaluate(_timer.getProgress(0, .5f)));
     }
     table.Fatigue.alpha = 1 - table.Fatigue.fadeCurve.Evaluate(_timer.getProgress(1, 1.5f));
     if (!_timer.isExpired())
     {
         return(false);
     }
     table.Fatigue.hide();
     return(true);
 }
 public override bool update(Table table)
 {
     if (!_timer.isStarted)
     {
         table.TurnTipImage.display();
         if (eventArg.player == table.player)
         {
             table.TurnTipText.text = "你的回合";
             table.canControl       = true;
         }
         else
         {
             table.TurnTipText.text = "对手的回合";
             table.canControl       = false;
         }
         table.TurnTipImage.GetComponent <Animator>().Play("Display");
         foreach (var servant in table.SelfFieldList)
         {
             servant.update(table.player, servant.card, table.getSkin(servant.card));
         }
         foreach (var servant in table.EnemyFieldList)
         {
             servant.update(table.game.getOpponent(table.player), servant.card, table.getSkin(servant.card));
         }
         _timer.start();
     }
     if (!_timer.isExpired())
     {
         return(false);
     }
     table.TurnTipImage.hide();
     return(true);
 }
Exemple #8
0
 public override bool update(Table table)
 {
     if (!_timer.isStarted)
     {
         foreach (var card in eventArg.cards)
         {
             var target = table.getCharacter(card);
             if (target is Servant servant)
             {
                 servant.DamageImage.display();
                 servant.DamageText.text = "-" + eventArg.value;
                 servant.HpText.text     = eventArg.infoDic[card].currentLife.ToString();
             }
             else if (target is Master master)
             {
                 master.DamageImage.display();
                 master.DamageText.text = "-" + eventArg.value;
                 master.HpText.text     = eventArg.infoDic[card].currentLife.ToString();
             }
         }
         _timer.start();
     }
     foreach (var card in eventArg.cards)
     {
         var target = table.getCharacter(card);
         if (target is Servant servant)
         {
             servant.DamageImage.setAlpha(_timer.progress);
             servant.DamageText.setAlpha(_timer.progress);
         }
         else if (target is Master master)
         {
             master.DamageImage.setAlpha(_timer.progress);
             master.DamageText.setAlpha(_timer.progress);
         }
     }
     if (!_timer.isExpired())
     {
         return(false);
     }
     foreach (var card in eventArg.cards)
     {
         var target = table.getCharacter(card);
         if (target is Servant servant)
         {
             servant.DamageImage.hide();
         }
         else if (target is Master master)
         {
             master.DamageImage.hide();
         }
     }
     return(true);
 }
Exemple #9
0
        public override bool update(Table table)
        {
            var target = table.getCharacter(eventArg.targets[0] as TouhouCardEngine.Card);

            if (!_timer.isStarted)
            {
                target.animator.Play("Targeted");
                _timer.start();
            }
            if (!_timer.isExpired())
            {
                return(false);
            }
            return(true);
        }
Exemple #10
0
 private void Update()
 {
     if (target == null)
     {
         return;
     }
     if (transform.position != target.position)
     {
         transform.up       = target.position - transform.position;
         transform.position = Vector3.MoveTowards(transform.position, target.position, speed * Time.deltaTime);
         if (transform.position == target.position)
         {
             _decayTimer.start();
         }
     }
     if (_decayTimer.isExpired())
     {
         Destroy(gameObject);
     }
 }
Exemple #11
0
 public override bool update(Table table)
 {
     if (!_timer.isStarted)
     {
         foreach (var card in eventArg.cards)
         {
             var target = table.getCharacter(card);
             if (target is Servant servant)
             {
                 servant.DamageImage.display();
                 servant.DamageText.text = eventArg.value.ToString();
                 servant.update(card.owner as THHPlayer, card, table.getSkin(card));
             }
         }
         _timer.start();
     }
     foreach (var card in eventArg.cards)
     {
         var target = table.getCharacter(card);
         if (target is Servant servant)
         {
             servant.DamageImage.setAlpha(_timer.progress);
             servant.DamageText.setAlpha(_timer.progress);
         }
     }
     if (!_timer.isExpired())
     {
         return(false);
     }
     foreach (var card in eventArg.cards)
     {
         var target = table.getCharacter(card);
         if (target is Servant servant)
         {
             servant.DamageImage.hide();
         }
     }
     return(true);
 }
Exemple #12
0
 public override bool update(Table table)
 {
     if (!_timer.isStarted)
     {
         table.TurnTipImage.display();
         if (eventArg.player == table.player)
         {
             table.TurnTipText.text = "你的回合";
         }
         else
         {
             table.TurnTipText.text = "对手的回合";
         }
         table.TurnTipImage.GetComponent <Animator>().Play("Display");
         _timer.start();
     }
     if (!_timer.isExpired())
     {
         return(false);
     }
     table.TurnTipImage.hide();
     return(true);
 }