예제 #1
0
        //------------------------------------------------------------------------/
        // Methods
        //------------------------------------------------------------------------/
        /// <summary>
        /// Dispatches the event onto the given target
        /// </summary>
        /// <returns></returns>
        public bool Dispatch()
        {
            if (!hasType)
            {
                return(false);
            }

            if (eventInstance == null)
            {
                eventInstance = StratusEvent.Instantiate(type, eventData);
            }

            switch (scope)
            {
            case StratusEvent.Scope.GameObject:
                foreach (var target in targets)
                {
                    if (target)
                    {
                        target.Dispatch(eventInstance, type.Type);
                    }
                }
                break;

            case StratusEvent.Scope.Scene:
                StratusScene.Dispatch(eventInstance, type.Type);
                break;
            }
            return(true);
        }
예제 #2
0
        /// <summary>
        /// Closes all scenes in the editor
        /// </summary>
        public void CloseAll(StratusScene.SceneCallback onClosed = null)
        {
            StratusScene.Unload(scenes, onClosed);

            //foreach (var scene in this.scenes)
            //  scene.Close();
        }
예제 #3
0
        /// <summary>
        /// Opens all scenes in the editor
        /// </summary>
        public void OpenAll(StratusScene.SceneCallback onOpened = null)
        {
            StratusScene.Load(scenes, onOpened);

            //foreach (var scene in this.scenes)
            //  scene.Add();
        }
        protected override void SetPauseMechanism()
        {
            StratusScene.Connect <PauseEvent>(this.OnPauseEvent);
            gameObject.Connect <PauseEvent>(this.OnPauseEvent);

            StratusScene.Connect <ResumeEvent>(this.OnResumeEvent);
            gameObject.Connect <ResumeEvent>(this.OnResumeEvent);
        }
예제 #5
0
 private void RemoveAllNotes()
 {
     ObjectNote[] notes = StratusScene.GetComponentsInAllActiveScenes <ObjectNote>();
     foreach (var note in notes)
     {
         Undo.DestroyObjectImmediate(note);
     }
     StratusDebug.Log($"Removed {notes.Length} notes!");
 }
        //------------------------------------------------------------------------/
        // Messages
        //------------------------------------------------------------------------/
        private void Awake()
        {
            // Optionally, subscribe to scene-wide events
            if (scope == StratusEvent.Scope.Scene)
            {
                StratusScene.Connect <StateEvent>(this.OnStateEvent);
            }

            // Always subscribe to specific requests
            gameObject.Connect <StateEvent>(this.OnStateEvent);

            AddCommonRecorders();
        }
예제 #7
0
        private void Subscribe()
        {
            switch (scope)
            {
            case StratusEvent.Scope.GameObject:
                this.gameObject.Connect(this.OnEvent, this.type);
                break;

            case StratusEvent.Scope.Scene:
                StratusScene.Connect(this.OnEvent, this.type);
                break;
            }

            connected = true;
        }
예제 #8
0
 protected override void OnInitializeState()
 {
     behaviours = StratusScene.GetComponentsInAllActiveScenes <T>();
 }
 private static void AddCurrentBehaviours()
 {
     StratusManagedBehaviour[] behaviours = StratusScene.GetComponentsInAllActiveScenes <StratusManagedBehaviour>();
     StratusDebug.Log($"Adding {behaviours.Length} behaviours");
     StratusManagedBehaviourSystem.behaviours.AddRange(behaviours);
 }
예제 #10
0
 /// <summary>
 /// Closes/unloads the scene in the editor
 /// </summary>
 /// <returns>True if the operation succeeded</returns>
 public void Close()
 {
     StratusScene.Unload(this);
 }
예제 #11
0
 /// <summary>
 /// Opens/loads the scene in the editor, adding it to the current list of scenes
 /// </summary>
 /// <param name="mode"></param>
 public void Add()
 {
     StratusScene.Load(this);
 }
예제 #12
0
 /// <summary>
 /// Unloads this scene (asynchronously)
 /// </summary>
 public void Unload(StratusScene.SceneCallback onFinished = null)
 {
     StratusScene.Unload(this, onFinished);
 }
예제 #13
0
 /// <summary>
 /// Loads this scene
 /// </summary>
 /// <param name="mode"></param>
 public void Load(LoadSceneMode mode, StratusScene.SceneCallback onFinished = null)
 {
     StratusScene.Load(this, mode, onFinished);
 }
예제 #14
0
 public void DispatchToScene() => StratusScene.Dispatch(this, GetType());
예제 #15
0
 //------------------------------------------------------------------------/
 // Messages
 //------------------------------------------------------------------------/
 protected override void OnAwake()
 {
     StratusScene.Connect <StratusPauseEvent>(this.OnPauseEvent);
     StratusScene.Connect <StratusResumeEvent>(this.OnResumeEvent);
 }