void Start()
    {
        larguraTela = GameObject.Find("Game").GetComponent <AjustaTela>();
        player1     = GameObject.Find("Robot_A").transform.localScale.x;
        player2     = GameObject.Find("Robot_B").transform.localScale.x;

        if (this.name == "BulletEnemy1(Clone)")
        {
            bulletSpeed = -7;
        }
        else if (this.name == "BulletEnemy2(Clone)")
        {
            bulletSpeed = 7;
        }
        else if (this.name == "Bullet1(Clone)" && player1 < 0)
        {
            bulletSpeed = -bulletSpeed;
            gameObject.GetComponent <SpriteRenderer>().flipX = true;
        }
        else if (this.name == "Bullet2(Clone)" && player2 < 0)
        {
            bulletSpeed = -bulletSpeed;
            gameObject.GetComponent <SpriteRenderer>().flipX = true;
        }
    }
Example #2
0
    void Start()
    {
        larguraTela = GameObject.Find("Game").GetComponent <AjustaTela>();
        player      = FindObjectOfType <RobotController>();

        if (player.transform.localScale.x < 0)
        {
            bulletSpeed = -bulletSpeed;
            gameObject.GetComponent <SpriteRenderer>().flipX = true;
        }
    }
Example #3
0
 void Start()
 {
     GameObject.FindGameObjectWithTag("music").GetComponent <MusicClass>().StopMusic();
     anim = GetComponent <Animator> ();
     anim.SetBool("death", false);
     initial_position = transform.position;                                  //quando jogador colide com obstaculo ele volta para a posição inicial
     larguraTela      = GameObject.Find("Game").GetComponent <AjustaTela>(); //Retorna a largura da tela
     som_hit          = Resources.Load("hit") as AudioClip;
     som_jump         = Resources.Load("jump") as AudioClip;
     som_gravidade    = Resources.Load("gravidade") as AudioClip;
     som_passou       = Resources.Load("passou") as AudioClip;
     som_shoot        = Resources.Load("shoot") as AudioClip;
     som_game_over    = Resources.Load("game_over") as AudioClip;
     bullet1          = Resources.Load("Bullet1") as GameObject;
     bullet2          = Resources.Load("Bullet2") as GameObject;
     bullet_portal_1  = Resources.Load("Bullet_Portal_1") as GameObject;
     bullet_portal_2  = Resources.Load("Bullet_Portal_2") as GameObject;
 }
Example #4
0
    float _gravidade = 1;   //gravidade da caixa

    void Start()
    {
        larguraTela = GameObject.Find("Game").GetComponent <AjustaTela>();
    }