コード例 #1
0
    void attemptToSpawnLand()
    {
        land = LandControllerScript.FindObjectOfType <LandControllerScript> ();
        if (land == null)
        {
            return;
        }
        Debug.Log("Initializing land.");

        EnvironmentControllerScript[] envs = EnvironmentControllerScript.FindObjectsOfType <EnvironmentControllerScript>();
        if (envs.GetLength(0) == 0)
        {
            Debug.Log("Found no environment controller scripts.");
        }
        foreach (EnvironmentControllerScript env in envs)
        {
            env.changeParentTo(land.transform);
        }
        Debug.Log("Land initialized.");
    }
コード例 #2
0
 /**
  * SpawnInitialLand- If this player created the room, spawn the initial environment square units
  */
 void SpawnInitialLand()
 {
     if (instantiateEverything)
     {
         Debug.Log("Initial land spawn.");
         GameObject landObject = (GameObject)PhotonNetwork.Instantiate("Land",
                                                                       Vector3.zero,
                                                                       Quaternion.identity, 0);
         land = landObject.GetComponent <LandControllerScript>();
         land.myInitialize();
         //Set squares as children of Land
         EnvironmentControllerScript[] envs = EnvironmentControllerScript.FindObjectsOfType <EnvironmentControllerScript>();
         if (envs.GetLength(0) == 0)
         {
             Debug.Log("Found no environment controller scripts.");
         }
         foreach (EnvironmentControllerScript env in envs)
         {
             env.changeParentTo(land.transform);
         }
     }
 }