Exemplo n.º 1
0
 //When a Collider with the "Is Trigger" attribute is entered it will call the function below. The Script will just check for Collider's on the GameObject it's attached to not global.
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         coinCounter.AddCoins(1);
         Destroy(gameObject);
     }
 }
Exemplo n.º 2
0
    public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        TimerController.AddTime(time);
        CoinCounter.AddCoins(coins);
        PlayerController.SetHealth(health);
        LevelGenerator.SetLevelNumber(nextLevel);

        SceneManager.sceneLoaded -= OnSceneLoaded;
        Destroy(this);
    }
Exemplo n.º 3
0
 private void CC_OnHurt(object sender, System.EventArgs e)
 {
     if (!CanHit)
     {
         return;          //Make sure we can hit this obj
     }
     CanHit = false;
     //timer = coinCoolDown;
     CoinCount.AddCoins(CoinsToGive);
     CC.ParticlesOnHit = CombatCharacter.HitParticles.SPARKS;
 }
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "Player")
        {
            if (coinValue != 0)
            {
                CoinCounter.AddCoins(coinValue);
            }

            if (healthValue != 0)
            {
                PlayerController.AddHealth(healthValue);
            }

            if (isKey)
            {
                GameEvents.self.OnCollectingKey(keyId);
            }

            PlayerController.PlayCollectSound();
            Destroy(gameObject);
        }
    }