private void ReqReborn(SceneEntityPosAgent agent)
 {
     if (agent.IsIdle)
     {
         if (agent.entity == null || agent.entity.IsDead())
         {
             agent.entity  = null;
             agent.canRide = false;
             SceneMan.RemoveSceneObj(agent);
             SceneMan.AddSceneObj(agent);
         }
         else if (agent.entity != null && agent.entity.monstermountCtrl != null &&
                  agent.entity.monstermountCtrl.ctrlType == ECtrlType.Mount) //Lw2017.2.14:怪物已经被驯服,重新生成
         {
             agent.entity  = null;
             agent.canRide = false;
             //SceneMan.RemoveSceneObj(agent);
             SceneMan.AddSceneObj(agent);
         }
         else
         {
             agent.canRide = false;
             MonsterCmpt mc = agent.Go.GetComponent <MonsterCmpt>();
             if (mc != null)
             {
                 mc.Req_MoveToPosition(agent.Pos, 1, true, SpeedState.Run);
             }
         }
     }
 }
Beispiel #2
0
 public void ActivateGravity(bool value)
 {
     foreach (PeEntity entity in m_Entities)
     {
         if (entity != null && !entity.IsDeath())
         {
             MonsterCmpt cmpt = entity.GetComponent <MonsterCmpt>();
             if (cmpt != null)
             {
                 cmpt.ActivateGravity(value);
             }
         }
     }
 }
Beispiel #3
0
        bool IsFlyEquals(BehaveGroup group)
        {
            foreach (PeEntity skEntity in group.Entities)
            {
                if (skEntity != null && !skEntity.IsDeath())
                {
                    MonsterCmpt cmpt = skEntity.GetComponent <MonsterCmpt>();
                    if (cmpt != null && cmpt.IsFly != m_Data.fly)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Beispiel #4
0
        BehaveResult Tick(Tree sender)
        {
            if (!GetData <Data>(sender, ref m_Data))
            {
                return(BehaveResult.Failure);
            }

            BehaveGroup group = sender.ActiveAgent as BehaveGroup;

            if (group == null || group.Leader == null)
            {
                return(BehaveResult.Failure);
            }

            if (m_Data.fly)
            {
                if (Time.time - m_StartTime < 0.5f)
                {
                    return(BehaveResult.Running);
                }

                group.ActivateGravity(false);
                group.Fly(true);

                return(BehaveResult.Success);
            }
            else
            {
                group.ActivateGravity(true);

                bool running = false;

                for (int i = 0; i < group.Entities.Count; i++)
                {
                    PeEntity e = group.Entities[i];
                    if (e != null)
                    {
                        MonsterCmpt monster = e.GetComponent <MonsterCmpt>();
                        Motion_Move mover   = e.GetComponent <Motion_Move>();
                        BehaveCmpt  behave  = e.GetComponent <BehaveCmpt>();

                        if (monster != null && mover != null && behave != null)
                        {
                            if (mover.grounded)
                            {
                                monster.Fly(false);
                                behave.Pause(false);

                                running = true;
                            }
                        }
                    }
                }

                if (running)
                {
                    return(BehaveResult.Running);
                }
                else
                {
                    return(BehaveResult.Success);
                }
            }
        }