示例#1
0
        // 对象移动
        public void OnReceiveGameObjectRunState(GSToGC.RunningState msg)
        {
            if (msg.dir == null || msg.pos == null)
            {
                return;
            }
            UInt64  guid    = msg.objguid;
            Vector3 mvPos   = VectorUtil.ConvertPosToVector3(msg.pos);
            Vector3 mvDir   = VectorUtil.ConvertDirToVector3(msg.dir);
            float   mvSpeed = msg.movespeed / 100.0f;
            Entity  entity  = null;

            //todo
            entity = PlayerManager.Instance.LocalPlayer;

            // if(EntityManager.Instance.GetAllEntities().TryGetValue(guid, out entity)) {

            mvPos.y = entity.RealObject.transform.position.y;
            entity.GOSyncInfo.BeginPos       = mvPos;
            entity.GOSyncInfo.SyncPos        = mvPos;
            entity.GOSyncInfo.Dir            = mvDir;
            entity.GOSyncInfo.Speed          = mvSpeed;
            entity.GOSyncInfo.BeginTime      = Time.realtimeSinceStartup;
            entity.GOSyncInfo.LastSyncSecond = Time.realtimeSinceStartup;
            entity.EntityFSMChangedata(mvPos, mvDir, mvSpeed);
            entity.OnFSMStateChange(EntityRunFSM.Instance);
            // }
        }
示例#2
0
 public void OnReceiveSkillModelRange(GSToGC.RangeEffect msg)
 {
     if (msg != null)
     {
         UInt64  owner = msg.guid;
         Vector3 pos   = VectorUtil.ConvertPosToVector3(msg.pos);
         Vector3 dir   = VectorUtil.ConvertDirToVector3(msg.dir);
         EffectManager.Instance.CreateAreaEffect(owner, msg.effectid, msg.uniqueid, dir, pos);
     }
 }
示例#3
0
        public void OnReceiveGameObjectAppear(GSToGC.GOAppear msg)
        {
            foreach (GSToGC.GOAppear.AppearInfo info in msg.info)
            {
                UInt64 masterGuid = info.masterguid;
                UInt64 objGuid    = info.objguid;
                if (objGuid < 1)
                {
                    DebugEx.LogError("objguid : " + objGuid);
                }
                Int32   camp  = info.camp;
                Vector3 mvPos = VectorUtil.ConvertPosToVector3(info.pos);
                Vector3 mvDir = VectorUtil.ConvertDirToVector3(info.dir);
                mvDir.y = 0.0f;
                EEntityCampType type    = GetEntityCampType(camp);
                GSToGC.ObjType  objType = info.obj_type;

                if (EntityManager.Instance.GetAllEntities().ContainsKey(objGuid))
                {
                    if (objType == GSToGC.ObjType.ObjType_Hero)
                    {
                        // PlayerManager
                    }
                    continue;
                }

                Entity entity = null;
                if (IfTypeHero((EObjectType)info.obj_type_id))
                {
                    Player player = null;
                    if (!PlayerManager.Instance.GetAllPlayers().TryGetValue(masterGuid, out player))
                    {
                        player = (Player)PlayerManager.Instance.HandleCreateEntity(masterGuid, type);
                        PlayerManager.Instance.AddPlayer(masterGuid, player);
                    }
                    player.EntityCamp = type;
                    player.ObjTypeID  = info.obj_type_id;
                    entity            = player;
                    PlayerManager.Instance.CreateEntityModel(entity, objGuid, mvDir, mvPos);
                    CreateCharacterController(entity);
                }
                if (entity != null)
                {
                    entity.GameObjGuid = objGuid;
                    EntityManager.Instance.AddEntity(objGuid, entity);
                    entity.GOSyncInfo.BeginPos = mvPos;
                    entity.GOSyncInfo.SyncPos  = mvPos;
                    entity.EntityFSMChangedata(mvPos, mvDir);
                    entity.OnFSMStateChange(EntityFreeFSM.Instance);
                }
            }
        }
示例#4
0
        public void OnReceiveGameObjectReleaseSkill(GSToGC.ReleasingSkillState msg)
        {
            Vector3 pos = VectorUtil.ConvertPosToVector3(msg.pos);
            Vector3 dir = VectorUtil.ConvertDirToVector3(msg.dir);

            dir.y = 0.0f;
            UInt64 targetId = msg.targuid;
            UInt64 guid     = msg.objguid;
            Entity target;

            EntityManager.Instance.GetAllEntities().TryGetValue(targetId, out target);
            Entity entity;

            // todo
            entity = PlayerManager.Instance.LocalPlayer;
            // if(EntityManager.Instance.GetAllEntities().TryGetValue(guid, out entity)) {
            pos.y = entity.RealObject.transform.position.y;
            entity.EntityFSMChangeDataOnPrepareSkill(pos, dir, msg.skillid, target);
            entity.OnFSMStateChange(EntityReleaseSkillFSM.Instance);
            // }
        }
示例#5
0
        public void OnReceiveGameObjectFreeState(GSToGC.FreeState msg)
        {
            if (msg.dir == null || msg.pos == null)
            {
                return;
            }
            UInt64  guid   = msg.objguid;
            Vector3 mvPos  = VectorUtil.ConvertPosToVector3(msg.pos);
            Vector3 mvDir  = VectorUtil.ConvertDirToVector3(msg.dir);
            Entity  entity = null;

            if (EntityManager.Instance.GetAllEntities().TryGetValue(guid, out entity))
            {
                Vector3 lastSyncPos = entity.GOSyncInfo.SyncPos;
                mvPos.y = entity.RealObject.transform.position.y;
                entity.GOSyncInfo.BeginPos       = mvPos;
                entity.GOSyncInfo.SyncPos        = mvPos;
                entity.GOSyncInfo.Dir            = mvDir;
                entity.GOSyncInfo.BeginTime      = Time.realtimeSinceStartup;
                entity.GOSyncInfo.LastSyncSecond = Time.realtimeSinceStartup;
                entity.EntityFSMChangedata(mvPos, mvDir);
                entity.OnFSMStateChange(EntityFreeFSM.Instance);
            }
        }