Пример #1
0
    void checkDeath(GameObject play)
    {
        if (morreu)
        {
            tempoMorte += Time.deltaTime;
        }

        if (tempoMorte >= 3)
        {
            textoWin.SetActive(false);
            textoGameOver.SetActive(true);
            painelGameOver.SetActive(true);
            currentState = GameState.GameOver;
        }
        if (play != null)
        {
            if (Blitzkrieg.GetGameObjectPosition(play).y < 0 || Blitzkrieg.GetGameObjectPosition(play).y > 1)
            {
                morreu = true;
                if (mCC.moveCamera)
                {
                    play.transform.GetChild(0).gameObject.SetActive(true);

                    audioSource.clip = deathSound;
                    audioSource.Play();
                }
                mCC.moveCamera = false;
                player [0].GetComponent <Rigidbody2D> ().constraints          = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezeRotation;
                player [1].GetComponent <Rigidbody2D> ().constraints          = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezeRotation;
                player [0].GetComponent <PlayerController> ().movementEnabled = false;
                player [1].GetComponent <PlayerController> ().movementEnabled = false;
                foreach (GameObject plataformas in plataformas)
                {
                    if (plataformas.GetComponent <SpriteRenderer> ().enabled == false)
                    {
                        plataformas.GetComponent <SpriteRenderer> ().enabled = true;
                        plataformas.GetComponent <ColorChange> ().enabled    = true;
                    }
                }
            }
        }
    }
Пример #2
0
 public void setMovel()
 {
     if (Blitzkrieg.GetGameObjectXFromCenter(this.gameObject) > 0)
     {
         this.transform.position =
             new Vector3(
                 Camera.main.ViewportToWorldPoint(new Vector3(0.75f, 0, 0)).x,
                 this.transform.position.y,
                 this.transform.position.z
                 );
     }
     else
     {
         this.transform.position =
             new Vector3(
                 Camera.main.ViewportToWorldPoint(new Vector3(0.25f, 0, 0)).x,
                 this.transform.position.y,
                 this.transform.position.z
                 );
     }
     this.movel = true;
 }