コード例 #1
0
 void Start()
 {
     /**
      * Declare this block to the World object
      */
     if (GameObject.FindGameObjectsWithTag("WORLD").Length > 0)
     {
         WorldScript world = GameObject.FindGameObjectsWithTag("WORLD")[0].GetComponent <WorldScript>();
         world.AddBlock(name, new Vector3(0, 0, 0), gameObject.transform.position, this);
     }
 }
コード例 #2
0
 void Start()
 {
     /**
      * Declare this block to the World object
      */
     if (GameObject.FindGameObjectsWithTag("WORLD").Length > 0)
     {
         WorldScript world = GameObject.FindGameObjectsWithTag("WORLD")[0].GetComponent <WorldScript>();
         if (gameObject.tag == "NPC") // Rename NPCs' gameObjects
         {
             name = "NPC_" + gameObject.transform.position;
         }
         else if (gameObject.tag == "Wall")
         {
             name = "WALL_" + gameObject.transform.position;
         }
         else if (gameObject.tag == "Gate")
         {
             name = "GATE_" + gameObject.transform.position;
         }
         world.AddBlock(name, new Vector3(0, 0, 0), gameObject.transform.position, this);
     }
 }