public String spawnOverNetwork(String prefabName, Vector3 pos) { GameObject.Find("CrateGUI").GetComponent <CrateGUI>().IncrementCrateCount(); GameObject temp = (GameObject)Network.Instantiate(Resources.Load(prefabName) as GameObject, pos, Quaternion.identity, 0); ObjectManager.Register(temp, "" + temp.GetHashCode()); return("" + temp.GetHashCode()); }
void convert(GameObject first, GameObject second) { string firstID = ObjectManager.GetID(first); ObjectManager.Unregister(firstID); GameObject crate = (Instantiate(second, first.transform.position, first.transform.rotation) as GameObject); ObjectManager.Register(crate, firstID); crate.transform.position = new Vector3(crate.transform.position.x, Terrain.activeTerrain.SampleHeight(crate.transform.position), crate.transform.position.z); Destroy(first); }
public void Init() { if (id.Equals("")) { ObjectManager.Register(gameObject); //id = gameObject.GetInstanceID().ToString(); } else { ObjectManager.Register(gameObject, id); } junes = new Stack(); enchantmentsRunning = new Stack(); callbacks = new Stack(); if (audio_clip == null) { audio_clip = Resources.Load("SpellEffect") as AudioClip; } if (particles == null) { particles = Resources.Load("LightSparkles") as GameObject; } gameObject.AddComponent <Text3D>(); if (do_restrictions) { gameObject.AddComponent <NoUnderground>(); //gameObject.AddComponent<ScaleLimit>(); } //gameObject.GetComponent<ScaleLimit>().upper_limit = 100; //gameObject.GetComponent<ScaleLimit>().lower_limit = 0; }
/// <summary> /// Registers an object to the ObjectManager. /// </summary> protected void RegisterObject() { ObjectManager.Register(handle, this); }