]> git.lizzy.rs Git - SuperMouseAdventure.git/blob - 2DGame/Assets/Scripts/Level_Elemente/Hearts.cs
Text-Box v0.1
[SuperMouseAdventure.git] / 2DGame / Assets / Scripts / Level_Elemente / Hearts.cs
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4
5 public class Hearts : MonoBehaviour
6 {
7     public bool isGolden;
8
9     Health health;
10
11     public GameObject mouse;
12
13     // Start is called before the first frame update
14     void Start()
15     {
16         health = mouse.GetComponent<Health>();
17     }
18
19     private void OnCollisionEnter2D(Collision2D collision)
20     {
21         if(collision.gameObject.CompareTag("Player"))
22         {
23             if(isGolden == true)
24             {
25                 health.mouseHealth = 5;
26                 gameObject.SetActive(false);
27             }
28             else
29             {
30                 health.mouseHealth++;
31                 gameObject.SetActive(false);
32             }
33         }
34     }
35 }