//Al tocar el trigger se almacena en la varible munición private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player")) { throwAttack ta = collision.GetComponent <throwAttack>(); ta.SetMunition(munitionCapacity); Destroy(gameObject); } }
// Start is called before the first frame update void Start() { melee = GetComponent <meleeAttack>(); //Asignamos a la variable los scripts antes mencionados fireball = GetComponent <throwAttack>(); shoot = GetComponent <Shoot>(); hero = GetComponent <PlayerController>(); rb = GetComponent <Rigidbody2D>(); CurrentHealthPoints = MaxHealthPoints; //Pone la vida al máximo al empezar isFullHealth = true; if (healthUI) { healthUI.SetMaxHealthUI(MaxHealthPoints); } }