예제 #1
0
    //Activates the right skiers, sets materials, places skiers, and passes tether references to the plane
    private void SetupScene()
    {
        Tether[] tethers = new Tether[4];                //Array of tethers to pass onto the plane

        int place = 0;                                   //Which place the skier will be spawned to, such as 0, 1, or 2, based on how many players

        for (int i = 0; i < m_playerCount; ++i)          //For all current players,
        {
            if (i == (int)m_eCurrentPlaneState)          //If this player is in the plane,
            {
                m_skiers[i].gameObject.SetActive(false); //Set their skier to inactive
                m_skiers[i].SetAlive(false);             //Make sure they aren't considered alive
                //Set the material of the plane
                planeBody.GetComponent <Renderer>().material.SetTexture("Texture2D_C6055840", m_planeTextures[i]);
            }
            else                                                        //If this player isn't in the plane,
            {
                m_skiers[i].gameObject.SetActive(true);                 //Activate their skier
                m_skiers[i].SetAlive(true);                             //Set them to alive
                tethers[i] = m_skiers[i].tether;                        //Adds the tether to the references array
                //Put the skier in the right position
                m_skiers[i].transform.position = m_skierSpawnPos[m_playerCount - 2, place];
                ++place;                        //Increment the place
            }
        }

        plane.SetTetherReferences(tethers);             //Pass the tethers to the plane
    }