protected virtual void Awake() { CurrentInstance = this; _uiDispatcher = new UnityMessageEventDispatcher(); DestructionFunctions.DontDestroyOnLoadGameObject(gameObject); InitializeInput(); }
protected void OnDestroy() { foreach (var waitingToSpawnObject in _waitingToSpawnObjects) { DestructionFunctions.DestroyGameObject(waitingToSpawnObject); } _waitingToSpawnObjects.Clear(); }
private void OnEnterDeadActionState(EnterDeadActionStateMessage inMessage) { if (SpawnerInterface != null) { Despawn(); } else { DestructionFunctions.DestroyGameObject(gameObject); } }
public void ReadData(Stream stream, bool previouslyDestroyed) { var bf = new BinaryFormatter(); if (previouslyDestroyed) { DestructionFunctions.DestroyGameObject(gameObject); } else { gameObject.SetActive((bool)bf.Deserialize(stream)); gameObject.transform.position = ((Vector3Serializer)bf.Deserialize(stream)).AsVector; gameObject.transform.eulerAngles = ((Vector3Serializer)bf.Deserialize(stream)).AsVector; var persistentBehaviours = gameObject.GetComponents <IPersistentBehaviourInterface>(); if (persistentBehaviours != null && persistentBehaviours.Length > 0) { foreach (var behaviour in persistentBehaviours) { behaviour.ReadData(stream); } } } }
protected void OnDestroy() { UnregisterMessages(); DestructionFunctions.DestroyGameObject(InstantiatedLocalUI); }
protected override void OnInteractImpl(GameObject inGameObject) { inGameObject.GetComponent <ICompanionSetInterface>().SetCompanion(Instantiate(CompanionPrefab).GetComponent <ICompanionInterface>(), ECompanionSlot.Primary); gameObject.SetActive(false); DestructionFunctions.DestroyGameObject(gameObject); }
public void DestroyPawn() { transform.parent = null; DestructionFunctions.DestroyGameObject(PawnInstance); }
protected void OnDestroy() { DestructionFunctions.DestroyGameObject(HUDInstance); UnregisterForMessages(); Cursor.visible = true; }