public void dejarDeApuntar() { anim.SetLayerWeight(1, 0); Hijo.SetActive(false); if (numBolas <= 0) { devolverControl(); Destroy(this.gameObject); } }
public override void Usar() { if (Cooldown < 0) { if (numBolas > 0) { sonido.Play(); Hijo.SetActive(true); GameObject go = Instantiate(bolaNieve, emiter.transform.position + Player.forward, Quaternion.identity); Rigidbody rb = go.GetComponent <Rigidbody>(); anim = Player.gameObject.GetComponent <Animator>(); anim.SetLayerWeight(1, 1); rb.velocity = Player.forward * snowBallSpeed; numBolas--; Invoke("dejarDeApuntar", 2f); Cooldown = Cadencia; } } }
// Update is called once per frame void Update() { if (Player != null) { transform.eulerAngles = Player.transform.eulerAngles; transform.position = Player.transform.position + Player.forward * 0.5f + Vector3.up; transform.eulerAngles = new Vector3(0, Player.transform.localEulerAngles.y + 90, transform.eulerAngles.z); } if (activado) { Hijo.SetActive(true); windAnim.SetBool("activado", true); cooldowmn += Time.deltaTime; ParticleSystem.SetActive(true); if (cooldowmn >= duracion) { devolverControl(); Destroy(this.gameObject); } } }