void Start() { pgm = GameObject.FindGameObjectWithTag("PGM").GetComponent <PlatformGM>(); sgm = GameObject.FindGameObjectWithTag("SGM").GetComponent <ShieldGM>(); player = GetComponent <PlayerContr>(); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag.Equals("Player")) { GameObject.Destroy(gameObject); PlayerContr controller = collision.GetComponent <PlayerContr>(); if (controller != null) { GameSound.instance.PlaySound(collectedClip); controller.ChangeHealth(1); } } }