예제 #1
0
        /// <summary>
        /// The object has been enabled.
        /// </summary>
        private void OnEnable()
        {
            // The object may have been enabled outside of the scene unloading.
            if (s_Instance == null)
            {
                s_Instance    = this;
                s_Initialized = true;
                SceneManager.sceneUnloaded -= SceneUnloaded;

                // Characters and cameras may be marked DontDestroyOnLoad. Reregister any active objects.
                var characterLocomotions = FindObjectsOfType <UltimateCharacterLocomotion>();
                for (int i = 0; i < characterLocomotions.Length; ++i)
                {
                    if (characterLocomotions[i].KinematicObjectIndex == -1)
                    {
                        continue;
                    }
                    // The character is active.
                    characterLocomotions[i].KinematicObjectIndex = RegisterCharacter(characterLocomotions[i]);
                }
                var cameras = FindObjectsOfType <CameraController>();
                for (int i = 0; i < cameras.Length; ++i)
                {
                    if (cameras[i].KinematicObjectIndex == -1)
                    {
                        continue;
                    }
                    // The camera is active.
                    cameras[i].KinematicObjectIndex = RegisterCamera(cameras[i]);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Reset the initialized variable when the scene is no longer loaded.
        /// </summary>
        /// <param name="scene">The scene that was unloaded.</param>
        private void SceneUnloaded(Scene scene)
        {
            s_Initialized = false;
            s_Instance    = null;
            SceneManager.sceneUnloaded -= SceneUnloaded;

            UnityEngineUtility.ClearCache();
        }
예제 #3
0
 /// <summary>
 /// The object has been enabled.
 /// </summary>
 private void OnEnable()
 {
     // The object may have been enabled outside of the scene unloading.
     if (s_Instance == null)
     {
         s_Instance    = this;
         s_Initialized = true;
         SceneManager.sceneUnloaded -= SceneUnloaded;
     }
 }
예제 #4
0
 /// <summary>
 /// Unregisters the object with the Kinematic Object Manager.
 /// </summary>
 public void OnDisable()
 {
     KinematicObjectManager.UnregisterKinematicObject(m_KinematicObjectIndex);
 }
예제 #5
0
 /// <summary>
 /// Registers the object with the Kinematic Object Manager.
 /// </summary>
 public void OnEnable()
 {
     m_KinematicObjectIndex = KinematicObjectManager.RegisterKinematicObject(this);
     m_LastPosition         = m_Transform.position;
     m_LastRotation         = m_Transform.rotation;
 }
예제 #6
0
 private static void DomainReset()
 {
     s_Initialized = false;
     s_Instance    = null;
 }