Beispiel #1
0
 private void Init(GameObject gameObject)
 {
     actorBehaviour = AddActorBehaviour(gameObject);
     actorBehaviour.BindActor(this);
     RegisterActorBehaviourEvents();
     RegisterActor();
 }
Beispiel #2
0
        protected virtual void DestroyGameObject(ActorMonoBehaviour actorBehaviour)
        {
#if UNITY_EDITOR
            Object.DestroyImmediate(actorBehaviour.GameObject);
#else
            Object.Destroy(actorBehaviour.GameObject);
#endif
        }
Beispiel #3
0
 public void Eject()
 {
     if (actorBehaviour != null)
     {
         UnRegisterActorBehaviourEvents();
         actorBehaviour.UnBindActor();
         actorBehaviour = null;
     }
 }
Beispiel #4
0
        private void InternalOnDestroy()
        {
            OnDestroy();

            StopAllCoroutines();
            UnRegisterActorBehaviourEvents();
            UnRegisterActor();
            actorBehaviour.UnBindActor();
            actorBehaviour = null;
        }
Beispiel #5
0
        public bool Possess(ActorMonoBehaviour target)
        {
            if (target.Actor != null)
            {
                return(false);
            }

            Eject();

            actorBehaviour = target;
            actorBehaviour.BindActor(this);
            RegisterActorBehaviourEvents();

            return(true);
        }
Beispiel #6
0
 protected override void DestroyGameObject(ActorMonoBehaviour actorBehaviour)
 {
     Pool.Destroy(actorBehaviour);
 }
Beispiel #7
0
 public Actor(ActorMonoBehaviour actorBehaviour)
 {
     Possess(actorBehaviour);
     RegisterActor();
 }
Beispiel #8
0
 protected virtual void OnActorUnBind(ActorMonoBehaviour behaviour, Actor actor)
 {
 }