示例#1
0
        protected virtual void Awake()
        {
            CurrentInstance = this;
            _uiDispatcher   = new UnityMessageEventDispatcher();
            DestructionFunctions.DontDestroyOnLoadGameObject(gameObject);

            InitializeInput();
        }
示例#2
0
        protected void OnDestroy()
        {
            foreach (var waitingToSpawnObject in _waitingToSpawnObjects)
            {
                DestructionFunctions.DestroyGameObject(waitingToSpawnObject);
            }

            _waitingToSpawnObjects.Clear();
        }
示例#3
0
 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);
 }
示例#7
0
 public void DestroyPawn()
 {
     transform.parent = null;
     DestructionFunctions.DestroyGameObject(PawnInstance);
 }
示例#8
0
 protected void OnDestroy()
 {
     DestructionFunctions.DestroyGameObject(HUDInstance);
     UnregisterForMessages();
     Cursor.visible = true;
 }