public GameObject ActivateSuspendedObject(Vector3 _position, Quaternion _rotation) { GameObject _object = null; if (SuspendedObjects.Count > 0) { _object = SuspendedObjects[0]; if (_object != null) { SuspendedObjects.Remove(_object); _object.transform.position = _position; _object.transform.rotation = _rotation; ICEWorldEntity _entity = _object.GetComponent <ICEWorldEntity>(); if (_entity != null) { _entity.Reset(); } _object.SetActive(true); Register(_object); } } return(_object); }
private GameObject SpawnLocalPlayer() { if (!SpawningLocalPlayerIsAvailable) { return(null); } Vector3 _position = GetSpawnPosition(); Quaternion _rotation = Random.rotation; _rotation.z = 0; _rotation.x = 0; if (WorldManager.LocalPlayer != null && WorldManager.LocalPlayer.activeInHierarchy == false) { SuspendedObjects.Remove(WorldManager.LocalPlayer); WorldManager.LocalPlayer.transform.position = _position; WorldManager.LocalPlayer.transform.rotation = _rotation; } if (WorldManager.LocalPlayer == null) { WorldManager.LocalPlayer = WorldManager.Instantiate(ReferenceGameObject, _position, _rotation); } if (WorldManager.LocalPlayer != null) { //WorldManager.LocalPlayer.name = ReferenceGameObject.name; ICEWorldEntity _entity = WorldManager.LocalPlayer.GetComponent <ICEWorldEntity>(); // if the player is an ICE entity we have to adapt the parent according to it's hierarchy settings if (_entity != null && _entity.UseHierarchyManagement) { WorldManager.LocalPlayer.transform.SetParent(UpdateGroupParent(), true); } if (_entity != null) { _entity.Reset(); _entity.IsLocal = true; } WorldManager.LocalPlayer.SetActive(true); Register(WorldManager.LocalPlayer); m_SpawnCycles++; } return(WorldManager.LocalPlayer); }
public GameObject InstantiateNewObject(Vector3 _position, Quaternion _rotation) { if (ReferenceGameObject == null) { return(null); } GameObject _object = WorldManager.Instantiate(ReferenceGameObject, _position, _rotation); if (_object == null) { return(null); } if (UseRandomization) { _object.transform.localScale = _object.transform.localScale + (_object.transform.localScale * (float)Random.Range(RandomSizeMin, RandomSizeMax)); } //_object.name = ReferenceGameObject.name; ICEWorldEntity _entity = _object.GetComponent <ICEWorldEntity>(); // if the object is an ICE entity we have to adapt the parent according to it's hierarchy settings if (_entity != null && _entity.UseHierarchyManagement) { _object.transform.SetParent(UpdateGroupParent(), true); } if (_entity != null) { _entity.Reset(); _entity.IsLocal = true; } _object.SetActive(true); Register(_object); return(_object); }