public override bool update(TableManager table, THHGame.InitEventArg eventArg) { table.setMaster(table.ui.SelfMaster, table.player.master); table.setSkill(table.ui.SelfSkill, table.player.skill); THHPlayer opponent = table.game.getOpponent(table.player); table.setMaster(table.ui.EnemyMaster, opponent.master); table.setSkill(table.ui.EnemySkill, opponent.skill); return(true); }
public override bool update(TableManager table, THHCard.AttackEventArg eventArg) { if (table.tryGetMaster(eventArg.card, out var attackMaster)) { if (table.tryGetMaster(eventArg.target, out var targetMaster)) { attackMaster.GetComponentInChildren <PositionLerp>().setTarget(targetMaster.rectTransform, targetMaster.rectTransform.sizeDelta.x / 2); if (!SimpleAnimHelper.update(table, ref _attackAnim, attackMaster.onAttack, attackMaster.animator)) { return(false); } if (!SimpleAnimHelper.update(table, ref _attackedAnim, targetMaster.onAttacked, targetMaster.animator)) { return(false); } } else if (table.tryGetServant(eventArg.target, out var targetServant)) { attackMaster.GetComponentInChildren <PositionLerp>().setTarget(targetServant.rectTransform, targetServant.rectTransform.sizeDelta.x / 2); if (!SimpleAnimHelper.update(table, ref _attackAnim, attackMaster.onAttack, attackMaster.animator)) { return(false); } if (!SimpleAnimHelper.update(table, ref _attackedAnim, targetServant.onAttacked, targetServant.animator)) { return(false); } } table.setMaster(attackMaster, eventArg.card); } else if (table.getServant(eventArg.card) is Servant attackServant) { if (table.tryGetMaster(eventArg.target, out var targetMaster)) { attackServant.GetComponentInChildren <PositionLerp>().setTarget(targetMaster.rectTransform, targetMaster.rectTransform.sizeDelta.x / 2); if (!SimpleAnimHelper.update(table, ref _attackAnim, attackServant.onAttack, attackServant.animator)) { return(false); } if (!SimpleAnimHelper.update(table, ref _attackedAnim, targetMaster.onAttacked, targetMaster.animator)) { return(false); } } else if (table.tryGetServant(eventArg.target, out var targetServant)) { attackServant.GetComponentInChildren <PositionLerp>().setTarget(targetServant.rectTransform, targetServant.rectTransform.sizeDelta.x / 2); if (!SimpleAnimHelper.update(table, ref _attackAnim, attackServant.onAttack, attackServant.animator)) { return(false); } if (!SimpleAnimHelper.update(table, ref _attackedAnim, targetServant.onAttacked, targetServant.animator)) { return(false); } } //if (table.tryGetMaster(eventArg.target, out var 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; //} table.setServant(attackServant, eventArg.card); } return(true); }