Exemplo n.º 1
0
        public override void Create(CharData charData, EntityViewManager viewMap, Vector3 Pos, Quaternion rotation)
        {
            _viewMap = viewMap;
            gameObj  = new CreatureEntity();
            gameObj.Init(charData, GlobalClient.GameManager.LogicManager);
            GameObject obj = GlobalClient.prefabData["PlayerActor1"];

            gameGo = GameObject.Instantiate(obj, Pos, rotation) as GameObject;

            actor         = gameGo.GetComponent <Actor>();
            actor.viewObj = this;
            if (Game.GameManager.instance.IsHostPlayer())
            {
                actor.SetMaterial(false, false);
                gameObj.campType = ECampType.Red;
            }
            else
            {
                actor.SetMaterial(true, false);
                gameObj.campType = ECampType.Blue;
            }
            gameGo.name       = charData.entityName;
            gameTrans         = gameGo.transform;
            gameObj.Position  = gameTrans.position;
            gameObj.Direction = gameTrans.forward;
            gameObj.Speed     = 0.5f;
        }
Exemplo n.º 2
0
        // Use this for initialization
        public ShotActorState(CreatureEntity playerObj, float angle) : base(playerObj)

        {
            m_stateName = "PassActorState";
            m_state     = ActorState.SHOT;
            m_angle     = angle;
        }
Exemplo n.º 3
0
 public StandActorState(CreatureEntity playerObj) : base(playerObj)
 {
     m_stateName = "StandActorState";
     m_state     = ActorState.STAND;
     m_duration  = 2;
     m_timeAxis  = new TimeAxis(m_duration * GlobalClient.KeyFrameManager.renderFrameCount * GlobalClient.TimeManager.FrameTime);
 }
Exemplo n.º 4
0
        // Use this for initialization
        public PassActorState(CreatureEntity playerObj, Vector3 dir) : base(playerObj)

        {
            m_stateName = "PassActorState";
            m_state     = ActorState.PASS;
            m_passDir   = dir;
        }
Exemplo n.º 5
0
 public BaseActorState(CreatureEntity playerObj)
 {
     //默认持续一个逻辑帧
     m_duration  = 1;
     m_stateName = "BaseActorState";
     m_state     = ActorState.OTHER;
     m_playerObj = playerObj;
     // m_timeAxis = new TimeAxis(m_duration * GlobalClient.KeyFrameManager.renderFrameCount * GlobalClient.TimeManager.FrameTime);
 }
Exemplo n.º 6
0
        public RunActorState(CreatureEntity playerObj) : base(playerObj)
        {
            m_stateName = "RunActorState";
            m_state     = ActorState.RUN1;
            m_oldPos    = playerObj.Position;
            m_duration  = 4;
            m_timeAxis  = new TimeAxis(m_duration * GlobalClient.KeyFrameManager.renderFrameCount * GlobalClient.TimeManager.FrameTime);
            Vector3 dir = m_playerObj.Rotation * m_playerObj.Direction;

            m_target = dir.normalized * m_duration * m_playerObj.Speed;
        }
Exemplo n.º 7
0
        public override void Create(CharData charData, EntityViewManager viewMap, Vector3 Pos, Quaternion rotation)
        {
            _viewMap = viewMap;
            gameObj  = new CreatureEntity();
            gameObj.Init(charData, GlobalClient.GameManager.LogicManager);
            GameObject obj = GlobalClient.prefabData["Soccer"];
            GameObject sp  = GameObject.Find("SpawnPoint2");

            gameGo = GameObject.Instantiate(obj, sp.transform.position, sp.transform.rotation) as GameObject;

            gameGo.name = charData.entityName;
            gameTrans   = gameGo.transform;
        }
Exemplo n.º 8
0
        public MoveCommand(int playerID, float angle)
            : base(playerID)
        {
            m_commandName = "MoveCommand";
            m_commandType = ECommandType.Move;
            CreatureEntity playerObj = GlobalClient.GameManager.LogicManager.GetEntityByID(m_clientID) as CreatureEntity;

            if (playerObj != null)
            {
                Quaternion rot = Quaternion.Euler(Vector3.up * angle);
                m_direction = rot;
            }
        }
Exemplo n.º 9
0
        // Use this for initialization
        public override void run()
        {
            base.run();
            CreatureEntity playerObj = GlobalClient.GameManager.LogicManager.GetEntityByID(m_clientID) as CreatureEntity;

            if (playerObj != null)
            {
                playerObj.Rotation = m_direction;
                //到达终点命令结束,自动切换站立状态
                //if(Vector3.Distance(playerObj.Position, m_target) < 0.01f)
                //{
                //    m_bFinished = true;
                //    //站立状态在RunActorState更新
                //    //playerObj.SetState(new StandActorState(playerObj));
                //}
            }
            m_bFinished = true;
        }
Exemplo n.º 10
0
        public override void Update()
        {
            base.Update();
            CreatureEntity player = gameObj as CreatureEntity;

            if (player.State.GetState() == ActorState.RUN1)
            {
                gameGo.transform.position      = gameObj.Position;
                gameGo.transform.localRotation = gameObj.Rotation;
                actor.SetAnimationStateInteger("shotPower", 0);
                actor.SetAnimationStateInteger("InputCmd", 0);
                actor.SetAnimationStateInteger("speed", 5);
            }
            else if (player.State.GetState() == ActorState.STAND)
            {
                actor.SetAnimationStateInteger("shotPower", 0);
                actor.SetAnimationStateInteger("InputCmd", 0);
                actor.SetAnimationStateInteger("speed", 0);
            }
        }
Exemplo n.º 11
0
 public override void update()
 {
     if (m_bFinished)
     {
         return;
     }
     if (!m_bRunning)
     {
         CreatureEntity playerObj = GlobalClient.GameManager.LogicManager.GetEntityByID(m_clientID) as CreatureEntity;
         if (playerObj != null)
         {
             //设置为站立状态
             playerObj.SetState(new StandActorState(playerObj));
         }
         else
         {
             m_bFinished = true;
             return;
         }
     }
     run();
 }
Exemplo n.º 12
0
 // Use this for initialization
 public StolenActorState(CreatureEntity playerObj) : base(playerObj)
 {
     m_stateName = "StolenActorState";
     m_state     = ActorState.STOLEN;
 }