/// <summary>
 /// Initializes a new instance of the <see cref="Adic.EventCallerContainerExtension"/> class.
 /// </summary>
 public EventCallerContainerExtension()
 {
     //Creates a new game object for UpdateableBehaviour.
     var gameObject = new GameObject();
     gameObject.name = "EventCaller";
     eventCaller = gameObject.AddComponent<EventCallerBehaviour>();
 }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Adic.EventCallerContainerExtension"/> class.
        /// </summary>
        public EventCallerContainerExtension()
        {
            //Creates a new game object for UpdateableBehaviour.
            var gameObject = new GameObject();

            gameObject.name = "EventCaller";
            eventCaller     = gameObject.AddComponent <EventCallerBehaviour>();
        }
예제 #3
0
        /// <summary>
        /// Create the EventCalledBehaviour. At any time there should be a single behaviour on the scene.
        /// </summary>
        /// <param name="containerID">Container ID.</param>
        private void CreateBehaviour(object containerID)
        {
            if (behaviour == null)
            {
                // Create a new game object for UpdateableBehaviour.
                var gameObject = new GameObject();
                gameObject.name = String.Format("EventCaller ({0})", containerID);

                // The behaviour should only be removed during unregister.
                MonoBehaviour.DontDestroyOnLoad(gameObject);

                behaviour           = gameObject.AddComponent <EventCallerBehaviour>();
                behaviour.extension = this;
            }
        }
예제 #4
0
        public void OnUnregister(IInjectionContainer container)
        {
            container.afterAddBinding   -= this.OnAfterAddBinding;
            container.bindingResolution -= this.OnBindingResolution;

            if (behaviour != null && behaviour.gameObject != null)
            {
                MonoBehaviour.DestroyImmediate(behaviour.gameObject);
            }
            behaviour = null;

            disposable.Clear();
            updateable.Clear();
            lateUpdateable.Clear();
            fixedUpdateable.Clear();
            focusable.Clear();
            pausable.Clear();
            quitable.Clear();
        }