Exemplo n.º 1
0
 public virtual void EnterIntercept(BaseActor source)
 {
     if (OnEnterIntercept != null)
     {
         OnEnterIntercept(source);
     }
 }
Exemplo n.º 2
0
 public virtual void LeaveIntercept(BaseActor source)
 {
     if (OnLeaveIntercept != null)
     {
         OnLeaveIntercept(source);
     }
 }
Exemplo n.º 3
0
 protected virtual void OnHurt(BaseActor source)
 {
     if (OnHurtHandler != null)
     {
         OnHurtHandler(source);
     }
 }
Exemplo n.º 4
0
 protected virtual void OnDeath(BaseActor source)
 {
     if (OnDeathHandler != null)
     {
         OnDeathHandler(source);
     }
 }
Exemplo n.º 5
0
 public void DestroyActor(BaseActor actor)
 {
     if (m_Actors.Remove(actor.ID))
     {
         _DestoryActor(actor);
     }
 }
Exemplo n.º 6
0
        public BaseActor AddActor(string actorType, params object[] param)
        {
            BaseActor actor = ClassUtils.CreateInstance <BaseActor>(actorType, param);

            _AddActor(actor);
            return(actor);
        }
Exemplo n.º 7
0
 public void RemoveComponent(BaseActor actor, IComponent component)
 {
     foreach (var pair in m_Systems)
     {
         pair.Value.OnComponentRemoved(component);
     }
 }
Exemplo n.º 8
0
 private void _DestoryActor(BaseActor actor)
 {
     foreach (var pair in m_Systems)
     {
         pair.Value.OnActorRemoved(actor);
     }
     actor.OnDestroy();
 }
Exemplo n.º 9
0
        public void DestroyActor(System.Guid guid)
        {
            BaseActor actor = null;

            if (m_Actors.TryGetValue(guid, out actor))
            {
                m_Actors.Remove(guid);
                _DestoryActor(actor);
            }
        }
Exemplo n.º 10
0
        private void _AddActor(BaseActor actor)
        {
            //actor.ID = System.Guid.NewGuid();
            actor.ActorService = this;
            actor.OnCreated();
            m_Actors.Add(actor.ID, actor);

            foreach (var pair in m_Systems)
            {
                pair.Value.OnActorAdded(actor);
            }
        }
Exemplo n.º 11
0
        public virtual BaseActor SpawnTrigger(SpawnParams spawnParam)
        {
            BaseActor actor = m_ActorService.AddActor(spawnParam.ActorType);

            //TransformComponent transform = actor.AddComponent<TransformComponent>(spawnParam.InitPos.HasValue ? spawnParam.InitPos.Value : Vector3.Zero,
            //                                                                      spawnParam.InitRot.HasValue ? spawnParam.InitRot.Value : Quaternion.Identity, spawnParam.InitScale.HasValue ? spawnParam.InitScale.Value : Vector3.One);
            actor.AddComponent(spawnParam.AttributeComponent, spawnParam.AttributeKey);
            TriggerComponent trigger = actor.AddComponent <TriggerComponent>();

            trigger.Owner = spawnParam.Owner;

            MovementSystem movementSysten = m_ActorService.GetComponentSystem <MovementSystem>();

            movementSysten.Transform(actor, spawnParam.InitPos, spawnParam.InitRot, spawnParam.InitScale);



            return(actor);
        }