Ejemplo n.º 1
0
    void OnCollisionEnter(Collision other)
    {
        if (other.gameObject.tag.Equals("Lethal"))
        {
            loseHP();
            other.gameObject.SetActive(false);
            Debug.Log("Get Hit");
            if (health == 0)
            {
                GM.Instance.GameOver();
                GameControl.instance.MainDie();
            }
        }

        if (other.gameObject.tag.Equals("Die"))
        {
            while (health > 0)
            {
                loseHP();
            }
            GM.Instance.GameOver();
            GameControl.instance.MainDie();
        }

        if (other.gameObject.tag.Equals("PowerUp"))
        {
            other.gameObject.SetActive(false);

            if (health <= 2)
            {
                HealthPanel.addHearth(health);
                health += 1;
            }
            else
            {
                GM.Instance.point += 3;
            }
        }

        if (other.gameObject.tag.Equals("Coin"))
        {
            Debug.Log("Coin collected");
            GM.Instance.coinCollected += 1;
            audio.Play();
            other.gameObject.transform.parent.gameObject.SetActive(false);
        }

        if (other.gameObject.tag.Equals("Fight"))
        {
            hitSmoke = true;
            audio.Play();
            Debug.Log("Giai quyet van de");
            GM.Instance.point += 1;
            whereX             = other.transform.position.x;
            whereY             = other.transform.position.y - 0.5f;
            whereZ             = other.transform.position.z;
            other.gameObject.SetActive(false);
        }
    }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     zipMoveObject.SetActive(false);
     _rigidbody      = GetComponent <Rigidbody2D>();
     _animator       = GetComponent <Animator>();
     lightningScript = lightningObject.GetComponent <LightningBoltScript>();
     GameManager.instance.trialRunning = true;
     healthPanel = healthPanelObject.GetComponent <HealthPanel>();
     UpdateHealth();
 }
Ejemplo n.º 3
0
 public void LevelChoice(string Choice)
 {
     GLD.Visible          = true;
     HealthPanel.Visible  = true;
     LevelChooser.Visible = false;
     mainMenu1.Visible    = false;
     GLD.BringToFront();
     HealthPanel.BringToFront();
     LevelStart.Invoke(Choice);
 }
Ejemplo n.º 4
0
 void Awake()
 {
     if (instance != null)
     {
         Destroy(this);
     }
     else
     {
         instance = this;
     }
 }
 public void PlusHP()
 {
     if (PlayerController.health < 3)
     {
         HealthPanel.addHearth(PlayerController.health);
         PlayerController.health += 1;
     }
     else
     {
         GM.Instance.point += 10;
     }
 }
Ejemplo n.º 6
0
 private void loseHP()
 {
     health -= 1;
     HealthPanel.deleteHearth(health);
 }
Ejemplo n.º 7
0
 public void Setup(int index)
 {
     HealthPanel = ScoreManager.Instance.EnablePanel(index);
     HealthPanel.SetHealth(Mathf.CeilToInt(MaxHealth));
 }