Esempio n. 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.name.Contains("Player") || collision.name.Contains("Fever"))
        {
            GetComponent <Rigidbody2D>().velocity = Vector2.zero;

            switch (powerSelector)
            {
            case 0:
                shieldParticles.SetActive(true);
                shieldParticles.GetComponent <ParticleSystem>().Play();
                break;

            case 1:
                lifeParticles.SetActive(true);
                lifeParticles.GetComponent <ParticleSystem>().Play();
                break;

            case 2:
                coinParticles.SetActive(true);
                coinParticles.GetComponent <ParticleSystem>().Play();
                break;
            }

            thePowerupManager.ActivatePowerup(kunai, smokeBomb, onigiri, shield, life, coin, magnet, powerupLength, collision.gameObject);
            gameObject.GetComponent <SpriteRenderer>().enabled = false;
            gameObject.GetComponent <CoinMagnet>().magnetted   = false;
            FalseAll();
        }
    }
Esempio n. 2
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name == "Player")
     {
         thePowerupManager.ActivatePowerup(doublePoints, safeMode, powerupLength);
     }
     gameObject.SetActive(false);
 }
Esempio n. 3
0
 void OnTriggerEnter2D(Collider2D other)                                                  //whenever something activates my trigger
 {
     if (other.tag == "Player")                                                           //check if it's the player (rather than coin / spike..)
     {
         thePowerupManager.ActivatePowerup(slowDownBoost, pointsBoost, amount, duration); //send the information about the powerup to the powerup manager using the ActivatePowerup function
         gameObject.SetActive(false);                                                     //once you've gained the effect of the powerup, disable the object from the game world.
     }
 }
Esempio n. 4
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name == "Player")
     {
         powerupManager.ActivatePowerup(power, powerupLength);
     }
     gameObject.SetActive(false);
 }
Esempio n. 5
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name == "Player")
     {
         pm.ActivatePowerup(doubleXP, shield, boost, gunUpgrade, powerupDuration);
     }
     gameObject.SetActive(false);
 }
Esempio n. 6
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.name.Equals("Player"))
        {
            powerupManager.ActivatePowerup(DoublePoints, SafeMode, PowerUpLength);
        }

        gameObject.SetActive(false);
    }
Esempio n. 7
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.name == "Player")
        {
            thePowerupManager.ActivatePowerup(safeMode, flyingMode, extraEnergy, doublePoints, powerupLength);
        }

        gameObject.SetActive(false);
    }
Esempio n. 8
0
    void OnCollisionEnter2D(Collision2D others)

    {
        if (others.gameObject.tag == "Player")
        {
            thePowerupManager.ActivatePowerup(doublePoints, heartPlus, powerupLength);
        }
        gameObject.SetActive(false);
    }
Esempio n. 9
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name == "Player")
     {
         psystem.Play();
         thePowerupManager.ActivatePowerup(doublePoints, safeMode, coinMagnet, powerupLength);
         gameObject.SetActive(false);
     }
 }
Esempio n. 10
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "Player")
        {
            manager.ActivatePowerup(doublePoints, safeMode, magnet, powerupLength);

            Destroy(gameObject);
        }
    }
Esempio n. 11
0
 public void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name == "Player")
     {
         thePowerupManager.ActivatePowerup(doublePoints, obstacleRemover, powerupDuration);
         Instantiate(powerupParticles, transform.position, Quaternion.Euler(90, 0, 0));
     }
     gameObject.SetActive(false);
 }
Esempio n. 12
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        var player = collision.GetComponent <PlayerMovement>();

        if (player)
        {
            powerManager.ActivatePowerup(missile, speedBoost, doubleHealth, shield, powerupLength);
        }

        gameObject.SetActive(false);
    }
Esempio n. 13
0
    public void Buy()
    {
        if (CashManager.TakeCash(cost))
        {
            buyButton.SetActive(false);
            PowerupManager.ActivatePowerup(powerup);

            if (powerup == Powerups.Investment)
            {
                PowerupManager.PowerupSystem.investmentBuffer = cost;
            }

            SendMessageUpwards("OnBuy");
        }
    }
Esempio n. 14
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (!feverMood && collision.IsTouching(selfCollider2D))
        {
            if (collision.gameObject.tag == "killbox")
            {
                if (!invulnerable)
                {
#if UNITY_WEBGL
#else
                    Handheld.Vibrate();
#endif

                    pc.obstacleSound.Play();
                    StartCoroutine(Flashing());
                    pc.theLifeController.ReduceLife(collision.gameObject);
                }
            }
            else if (collision.gameObject.tag == "ice")
            {
                powerupManager.ActivatePowerup(false, false, true, false, false, false, false, 3.5f, gameObject);                //3.5f
            }
            else if (collision.gameObject.tag == "Cloud")
            {
                collision.GetComponent <Animator>().SetTrigger("CloudAppear");
                collision.transform.GetChild(0).gameObject.SetActive(true);
                collision.transform.GetChild(0).GetComponent <ParticleSystem>().Play(true);
            }
            else if (collision.gameObject.name.Equals("FadeBox"))
            {
                collision.GetComponentInParent <Animator>().SetTrigger("Fade");
            }
            else if (GameSceneManager.instance.isPlayable && collision.gameObject.name.Contains("Fever"))
            {
                ateFever = true;
                pc.EnableFeverMode();
            }
        }
    }