Exemple #1
0
 public void SpawnPlayerPlanet(_Levels playerNumber, Vector3 spawnPosition, Quaternion spawnRotation)
 {
     int playerIndex = (playerNumber == _Levels.PlayerOne) ? 0 : 1;
     players[playerIndex] = (GameObject)Instantiate(playerPrefabPlanet, spawnPosition, spawnRotation);
     players[playerIndex].name = playerNumber.ToString();
     players[playerIndex].GetComponentInChildren<MeshRenderer>().material.color = playerColorDictionaries[playerIndex][_ColorType.PlayerShipPlanet.ToString()];
     players[playerIndex].tag = _Tags.player;
 }
 //PUBLIC METHODS
 //------------------------------------------------
 public static void ActivateTerrain(_Levels level)
 {
     switch (level)
     {
         case _Levels.Neutral:
             playerTerrains[0].SetActive(false);
             playerTerrains[1].SetActive(false);
             break;
         case _Levels.PlayerOne:
             playerTerrains[0].SetActive(true);
             playerTerrains[1].SetActive(false);
             break;
         case _Levels.PlayerTwo:
             playerTerrains[0].SetActive(false);
             playerTerrains[1].SetActive(true);
             break;
     }
 }
    // [ServerCallback]
    void Awake()
    {
        //Singleton
        if (instance != null && instance != this)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
            DontDestroyOnLoad(gameObject);

            //Instantiate new color dictionary
            colorDictionary = new ColorDictionary(colorListTextAsset);
            //playerData = GetComponent<PlayerData>();

            activeTerrain = _Levels.Neutral;

            //parse face and vertex data from input files
            parsedTerrainFaces = ParseFaces(textInputFaces);
            parsedTerrainVertices = ParseVertices(textInputVertices);
        }
    }