Esempio n. 1
0
 public IEnumerator StandardAttack(IBattler user, IBattler target)
 {
     Vector3 StartingPos = Parent.Parent.transform.position;
     Vector3 offset = new Vector3(-2f, 0f, 0f);
     anim = Parent.Parent.GetComponent<Animator>();
     AudioSource hit = Parent.Parent.GetComponent<SoundManager>().Hit;
     if (anim != null)
         anim.SetInteger("index", 1);
     yield return Move.MoveToPosition(Parent.Parent, target.Parent.transform.position + offset, 80f);
     if (anim != null)
         anim.SetInteger("index", 2);
     //Set animation
     yield return new WaitForSeconds(0.2f);
     int baseDamage = (user.Stats.attack * 4) - (target.Stats.defense * 2);
     baseDamage = new System.Random().Next((int)(baseDamage * 0.9), (int)(baseDamage * 1.1));
     target.TakeDamage(user, baseDamage);
     hit.Play();
     yield return new WaitForSeconds(0.5f);
     if (anim != null)
         anim.SetInteger("index", 1);
     yield return Move.MoveToPosition(Parent.Parent, StartingPos, 80f);
     if (anim != null)
         anim.SetInteger("index", 0);
 }
Esempio n. 2
0
 public IEnumerator Run(IBattler user, IBattler target)
 {
     //SP is checked beforehand
     Parent.stats.currentSP -= RequiredSP;
     Parent.OnStatChange();
     Vector3 StartingPos = Parent.Parent.transform.position;
     Vector3 offset = new Vector3(-2f, 0f, 0f);
     anim = Parent.Parent.GetComponent<Animator>();
     AudioSource hit = Parent.Parent.GetComponent<SoundManager>().Hit2;
     if (anim != null)
         anim.SetInteger("index", 1);
     yield return Move.MoveToPosition(Parent.Parent, target.Parent.transform.position + offset, 80f);
     if (anim != null)
         anim.SetInteger("index", 2);
     //Set animation
     yield return new WaitForSeconds(0.2f);
     float baseDamage = (user.Stats.spAttack * Power * 4) - (target.Stats.spDefense * 2);
     int baseDamage2 = new System.Random().Next((int)(baseDamage * 0.9), (int)(baseDamage * 1.1));
     target.TakeDamage(user, baseDamage2);
     hit.Play();
     yield return new WaitForSeconds(0.5f);
     if (anim != null)
         anim.SetInteger("index", 1);
     yield return Move.MoveToPosition(Parent.Parent, StartingPos, 80f);
     if (anim != null)
         anim.SetInteger("index", 0);
 }
 public static void EdStandardAttack(IBattler user, IBattler enemy)
 {
     int baseDamage = (user.Stats.attack * 4) - (enemy.Stats.defense * 2);
     baseDamage = new System.Random().Next((int)(baseDamage * 0.9), (int)(baseDamage * 1.1));
     enemy.TakeDamage(user, baseDamage);
 }