private void Set(Avatar myAva, Avatar otherAva) { this.poActAttack = new ActAttack(myAva, otherAva); this.poActSuperAttack = new ActAttack(myAva, otherAva); this.poActCharge = new ActCharge(myAva, otherAva); this.poActDefend = new ActDefend(myAva, otherAva); }
public override void AgainstAttack(ActAttack attack) { if (this.power > attack.power) { Debug.LogError("Attack succeed!"); // Consume SP this.pMyAvatar.ConsumeSP(3); this.pMyPlayerAnim.GetComponent <Animator>().SetTrigger("SuperAttack"); this.pOtherAnim.GetComponent <Animator>().SetTrigger("Hurt"); pOtherAvatar.TakeDamage(1); } else if (this.power < attack.power) { Debug.LogError("Attack failed!"); // Consume SP this.pMyAvatar.ConsumeSP(1); this.pMyPlayerAnim.GetComponent <Animator>().SetTrigger("Hurt"); this.pOtherAnim.GetComponent <Animator>().SetTrigger("SuperAttack"); pMyAvatar.TakeDamage(1); } else { Debug.LogError("Equal-No harm!"); // Consume SP this.pMyAvatar.ConsumeSP(this.power > 1 ? 3 : 1); this.pMyPlayerAnim.GetComponent <Animator>().SetTrigger(this.power > 1?"SuperAttack":"Attack"); this.pOtherAnim.GetComponent <Animator>().SetTrigger("Attack"); } }
public override void AgainstAttack(ActAttack attack) { Debug.LogError("Hurt!"); this.pMyPlayerAnim.GetComponent <Animator>().SetTrigger("Hurt"); this.pOtherAnim.GetComponent <Animator>().SetTrigger(attack.power > 1?"SuperAttack":"Attack"); // Take Damage this.pMyAvatar.TakeDamage(attack.power); //this.pOtherAvatar.ConsumeSP(1); }
public override void AgainstAttack(ActAttack attack) { if (attack.power == 1) { Debug.LogError("Defend succeed!"); this.pMyPlayerAnim.GetComponent <Animator>().SetTrigger("Defend"); this.pOtherAnim.GetComponent <Animator>().SetTrigger("Attack"); } else { Debug.LogError("Defend failed!"); this.pMyPlayerAnim.GetComponent <Animator>().SetTrigger("DefendFail"); this.pOtherAnim.GetComponent <Animator>().SetTrigger("SuperAttack"); this.pMyAvatar.TakeDamage(1); } // Nothing for now }
public virtual void AgainstAttack(ActAttack attack) { Debug.Assert(false); Debug.LogError("Action: AgainstAttack() not implemented"); }