Example #1
0
    void Start()
    {
        pgm = GameObject.FindGameObjectWithTag("PGM").GetComponent <PlatformGM>();

        sgm = GameObject.FindGameObjectWithTag("SGM").GetComponent <ShieldGM>();

        player = GetComponent <PlayerContr>();
    }
Example #2
0
 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);
         }
     }
 }