Exemplo n.º 1
0
    public static void FadeToScene(int buildIndex, Color color)
    {
        SetUpInstance();

        instance.SetColor(color);
        instance.StartCoroutine(instance.SwitchScenes(buildIndex));
    }
Exemplo n.º 2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Player"))
     {
         Invoke("loadNextScene", 1f);
         sceneFader.StartCoroutine("FadeOut");
     }
 }
Exemplo n.º 3
0
    //-- once the bullet collider has been hit
    void OnTriggerEnter2D(Collider2D other)
    {
        //-- if the object hit is an enemy destorys the enemy and moves the bullet off screen
        if (other.gameObject.tag == "Enemy")
        {
            // RRR
            enemyManager.KilledEnemy();

            collider2D.enabled = false;
            StartCoroutine("BulletHitEnemy", other.transform);
            StartCoroutine("MoveBulletToHome");
        }

        //-- if the object hit is the boundary then moves the bullet off screen
        else if (other.gameObject.tag == "Boundary")
        {
            if (PlayerStats.isAlive)
            {
                AudioSource.PlayClipAtPoint(playerHitAudio, Vector3.zero);
                playerControls.ShakeCam();

                if (PlayerStats.LoseHealth() <= 0)
                {
                    sceneFader.StartCoroutine("FadeToGameMenu");
                }
                else
                {
                    sceneFader.DoFadeDamage();
                }
            }

            // RRR
            collider2D.enabled = false;
            StartCoroutine("MoveBulletToHome");
        }

        //-- if the object hit is a healthy cell, destroy the healthy cell and send this bullet home
        if (other.gameObject.tag == "Healthy")
        {
            collider2D.enabled       = false;
            other.collider2D.enabled = false;
            StartCoroutine("BulletHitHealthyCell", other.transform);
            StartCoroutine("MoveBulletToHome");
        }
    }
Exemplo n.º 4
0
    //-- once the enemy collider has been hit
    void OnTriggerEnter2D(Collider2D other)
    {
        //-- if the object hit is the Player puts the enemy back to off screen
        if (other.gameObject.tag == "Player")
        {
            this.gameObject.transform.position = EnemyManager.enemyHome;
            speed = 0;

            if (PlayerStats.isAlive)
            {
                AudioSource.PlayClipAtPoint(playerHitAudio, Vector3.zero);
                playerControls.ShakeCam();

                if (PlayerStats.LoseHealth() <= 0)
                {
                    sceneFader.StartCoroutine("FadeToGameMenu");
                }
                else
                {
                    sceneFader.DoFadeDamage();
                }
            }
        }
    }