// Use this for initialization
 void Start()
 {
     race = GameObject.Find ("Player").GetComponent<StartRace>();
     collider2D.isTrigger = true;
     score = race.gameObject.GetComponent<TeamsScore> ();
     // Nothing !
 }
 // Use this for initialization
 void Start()
 {
     player = GameObject.Find("Player");
     race = player.GetComponent<StartRace>();
     playerPhysics = player.GetComponent<PhysicsPlayerTester>();
     playerDeath = player.GetComponent<CharacterDeath>();
     score = player.GetComponent<TeamsScore>();
     fairy= GameObject.Find ("curseur");
     screenCursor = fairy.GetComponent<JoystickCursor> ();
     victory = GameObject.Find ("Victory").GetComponent<VictoryBlock>();
 }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        m_Rigidbody    = this.GetComponent <Rigidbody>(); // captura o rigidBody do veiculo
        carro          = this.GetComponent <Car>();       //obtem as caracteristicas do carro
        WPindexPointer = 1;                               //primeiro ponto a ser seguido (apos a linha de largada)
        chegou         = false;
        //pegando o script de largada da pista
        largada      = GameObject.FindGameObjectWithTag("Track").GetComponent <StartRace>();           //gerenciamento da corrida
        efeitos      = GetComponentInChildren <AudioSource>();
        efeitos.clip = GameObject.Find("SoundManager").GetComponent <SoundManager>().musicas.getFx(1); //seleciona o efeito
        //efeitos.volume = Settings.valSfxVolume;
        efeitos.volume = GameObject.Find("SoundManager").GetComponent <SoundManager>().musicas.volSFX;
        efeitos.Play();

        if (Settings.valDificuldade == 0)  //nivel facil
        {
            dificuldade = 0.85f;
        }
        else if (Settings.valDificuldade == 1)  //nivel medio
        {
            dificuldade = 1f;
        }
        else  //nivel dificil
        {
            dificuldade = 1.15f;
        }

        newMaxSpeed = carro.spec.GetMaxSpeed() * dificuldade;//apenas para debug

        //obtem a lista dos waypoints da pista
        Transform pontos = GameObject.FindGameObjectWithTag("Track").transform.Find("Waypoints"); //obtem o gameObject que contem os waypoints

        waypoints = new Transform[pontos.childCount];                                             //cria um array com todos os waypoints, na ordem que aparecem na hierarquia
        Debug.Log(string.Format("Waypoints encontrados: {0}", pontos.childCount));
        int i = 0;

        //percorre toda a hierarquia e popula o array com os waypoints
        foreach (Transform t in pontos.transform)
        {
            waypoints[i++] = t;
            if (i - 2 == -1)
            {
                t.gameObject.GetComponent <WaypointManager>().alvo.setPrev(waypoints.Length - 1); //especificacoes do waypoint anterior
            }
            else
            {
                t.gameObject.GetComponent <WaypointManager>().alvo.setPrev(i - 2); //especificacoes do waypoint anterior
            }
        }
    } //fim de Start()
Exemple #4
0
    // Inicializacoes
    void Start()
    {
        //troca amusica de fundo
        music      = GameObject.Find("SoundManager").GetComponent <AudioSource>();
        music.clip = GameObject.Find("SoundManager").GetComponent <SoundManager>().musicas.getMusic("Menu", Random.Range(0, GameObject.Find("SoundManager").GetComponent <SoundManager>().musicas.getTotalMusic("Menu")));
        music.Play();                                                                                    //toca a musica selecionada

        m_Rigidbody = GetComponent <Rigidbody>();                                                        // obtem o rigidBody do veiculo
        carro       = GetComponent <Car>();                                                              // obtem as caracteristicas do carro
        //pegando o script de largada da pista
        largada        = GameObject.FindGameObjectWithTag("Track").GetComponent <StartRace>();           //gerenciamento da corrida
        efeitos        = GetComponentInChildren <AudioSource>();                                         //obtem a fonte do audio
        efeitos.clip   = GameObject.Find("SoundManager").GetComponent <SoundManager>().musicas.getFx(0); //seleciona o efeito
        efeitos.volume = GameObject.Find("SoundManager").GetComponent <SoundManager>().musicas.volSFX;
        efeitos.Play();
    }
    // Use this for initialization
    void Start()
    {
        Screen.lockCursor = true;

        player = GameObject.Find("Player");
        race = player.GetComponent<StartRace>();
        anim = gameObject.GetComponent<Animator> ();
    }