public override void OnAttackStateEnter(AnimatorStateInfo stateInfo) { base.OnAttackStateEnter(stateInfo); if (stateInfo.IsName("LightAttack1")) { GameObject main = Attack1.GetComponent <ParticleSystem>().gameObject; if (IsLookingRight) { Attack1.transform.position = transform.position + new Vector3(2.5f, 0, 0); main.transform.rotation = new Quaternion(0, 0, -0.7071068f, 0.7071068f); } else if (!IsLookingRight) { Attack1.transform.position = transform.position + new Vector3(-2.5f, 0, 0); main.transform.rotation = new Quaternion(-0.7071068f, 0.7071068f, 0, 0); } Attack1.Play(true); } else if (stateInfo.IsName("LightAttack2")) { GameObject main = Attack2.GetComponent <ParticleSystem>().gameObject; if (IsLookingRight) { Attack2.transform.position = transform.position + new Vector3(2.5f, 0, 0); main.transform.rotation = new Quaternion(0, 0, -0.7071068f, 0.7071068f); } else if (!IsLookingRight) { Attack2.transform.position = transform.position + new Vector3(-2.5f, 0, 0); main.transform.rotation = new Quaternion(-0.7071068f, 0.7071068f, 0, 0); } Attack2.Play(true); } else if (stateInfo.IsName("LightAttack3")) { GameObject main = Attack3.GetComponent <ParticleSystem>().gameObject; if (IsLookingRight) { Attack3.transform.position = transform.position + new Vector3(2.5f, 0, 0);; main.transform.rotation = new Quaternion(0, 0, -0.7071068f, 0.7071068f); } else if (!IsLookingRight) { Attack3.transform.position = transform.position + new Vector3(-2.5f, 0, 0);; main.transform.rotation = new Quaternion(-0.7071068f, 0.7071068f, 0, 0); } Attack3.Play(true); } if (stateInfo.IsName("Final1")) { GameObject main = FXFinal1.GetComponent <ParticleSystem>().gameObject; if (IsLookingRight) { FXFinal1.transform.position = transform.position + new Vector3(2.5f, 0, 0);; main.transform.rotation = new Quaternion(0, 0, -0.7071068f, 0.7071068f); } else if (!IsLookingRight) { FXFinal1.transform.position = transform.position + new Vector3(-2.5f, 0, 0);; main.transform.rotation = new Quaternion(-0.7071068f, 0.7071068f, 0, 0); } FXFinal1.Play(true); } else if (stateInfo.IsName("Final2")) { GameObject main = FXFinal2.GetComponent <ParticleSystem>().gameObject; if (IsLookingRight) { FXFinal2.transform.position = transform.position + new Vector3(2.5f, 0, 0);; main.transform.rotation = new Quaternion(-0.4984911f, 0.5015043f, -0.5015043f, 0.4984911f); } else if (!IsLookingRight) { FXFinal2.transform.position = transform.position + new Vector3(-2.5f, 0, 0);; main.transform.rotation = new Quaternion(-0.4984911f, -0.5015043f, 0.5015043f, 0.4984911f); } FXFinal2.Play(true); } else if (stateInfo.IsName("Final3")) { GameObject main = FXFinal3.GetComponent <ParticleSystem>().gameObject; if (IsLookingRight) { FXFinal3.transform.position = transform.position + new Vector3(2.5f, 0, 0);; main.transform.rotation = new Quaternion(0, 0, -0.7071068f, 0.7071068f); } else if (!IsLookingRight) { FXFinal3.transform.position = transform.position + new Vector3(-2.5f, 0, 0);; main.transform.rotation = new Quaternion(-0.7071068f, 0.7071068f, 0, 0); } FXFinal3.Play(true); } if (stateInfo.IsName("AirAttack")) { GameObject main = FXAirAttack.GetComponent <ParticleSystem>().gameObject; if (IsLookingRight) { FXAirAttack.transform.position = transform.position + new Vector3(0.0f, 0, 0);; main.transform.rotation = new Quaternion(0, 0, -0.7071068f, 0.7071068f); } else if (!IsLookingRight) { FXAirAttack.transform.position = transform.position + new Vector3(0.0f, 0, 0);; main.transform.rotation = new Quaternion(-0.7071068f, 0.7071068f, 0, 0); } FXAirAttack.Play(true); } }
public override void OnAttackStateEnter(AnimatorStateInfo stateInfo) { base.OnAttackStateEnter(stateInfo); if (stateInfo.IsName("LightAttack1")) { GameObject main = Attack1.GetComponent <ParticleSystem>().gameObject; if (IsLookingRight) { Attack1.transform.position = transform.position; main.transform.rotation = new Quaternion(0, 1, 0, 0); } else if (!IsLookingRight) { Attack1.transform.position = transform.position; main.transform.rotation = new Quaternion(0, 0, 0, 1); } Attack1.Play(true); } else if (stateInfo.IsName("LightAttack2")) { GameObject main = Attack2.GetComponent <ParticleSystem>().gameObject; if (IsLookingRight) { Attack2.transform.position = transform.position + new Vector3(3.0f, 0, 0); main.transform.rotation = new Quaternion(0, 0, -0.7071068f, 0.7071068f); } else if (!IsLookingRight) { Attack2.transform.position = transform.position + new Vector3(-3.0f, 0, 0); main.transform.rotation = new Quaternion(-0.7071068f, 0.7071068f, 0, 0); } Attack2.Play(true); } else if (stateInfo.IsName("LightAttack3")) { GameObject main = Attack3.GetComponent <ParticleSystem>().gameObject; if (IsLookingRight) { Attack3.transform.position = transform.position; main.transform.rotation = new Quaternion(0, 0, -0.7071068f, 0.7071068f); } else if (!IsLookingRight) { Attack3.transform.position = transform.position; main.transform.rotation = new Quaternion(-0.7071068f, 0.7071068f, 0, 0); } Attack3.Play(true); } if ((stateInfo.IsName("AirAttack1")) || (stateInfo.IsName("AirAttack2")) || (stateInfo.IsName("AirAttack3")) || (stateInfo.IsName("AirAttack4")) || (stateInfo.IsName("AirAttack5"))) { GameObject main = FXAirAttack.GetComponent <ParticleSystem>().gameObject; if (IsLookingRight) { FXAirAttack.transform.position = transform.position; main.transform.rotation = new Quaternion(0, 1, 0, 0); } else if (!IsLookingRight) { FXAirAttack.transform.position = transform.position; main.transform.rotation = new Quaternion(0, 0, 0, 1); } FXAirAttack.Play(true); } else if (stateInfo.IsName("AirAttack6")) { GameObject mainHeavy = heavyAttackFX.GetComponent <ParticleSystem>().gameObject; if (IsLookingRight) { heavyAttackFX.transform.position = transform.position + new Vector3(3.0f, 0, 0); mainHeavy.transform.rotation = new Quaternion(0.7071068f, 0, 0, 0.7071068f); } else if (!IsLookingRight) { heavyAttackFX.transform.position = transform.position + new Vector3(-3.0f, 0, 0); mainHeavy.transform.rotation = new Quaternion(0.7071068f, 0, 0, 0.7071068f); } heavyAttackFX.Play(true); } }