public void SetRenderObj(GameObject gameObject) { base.renderObj = gameObject; gameObject.AddComponent <FirstEntityUnity>(); BaseSynchronizer synchronizer = gameObject.AddComponent <BaseSynchronizer>(); //unity组件的初始化 synchronizer.SetTarget(this); }
public void SetRenderObj(GameObject gameObject) { base.renderObj = gameObject; gameObject.AddComponent <AccountUnity>(); BaseSynchronizer synchronizer = null; if (isPlayer()) { synchronizer = gameObject.AddComponent <BaseSynchronizer>(); //unity组件的初始化 synchronizer.SetTarget(this); } }
private void EngineEvents_OnUpdatePosition(Entity entity) { if (entity.renderObj == null) { return; } BaseSynchronizer s = null; if (!_entitySynchronizerDict.TryGetValue(entity.id, out s)) { return; } s.SetDestPosition(entity.position); s.SpaceID = KBEngineApp.app.spaceID; //GameEntity gameEntity = ((UnityEngine.GameObject)entity.renderObj).GetComponent<GameEntity>(); // gameEntity.destPosition = entity.position; // gameEntity.isOnGround = entity.isOnGround; // gameEntity.spaceID = KBEngineApp.app.spaceID; }
private void EngineEvents_OnSetDirection(Entity entity) { if (entity.renderObj == null) { return; } BaseSynchronizer s = null; if (!_entitySynchronizerDict.TryGetValue(entity.id, out s)) { return; } //服务器上是roll, pitch, yaw,所以是y,z,x对应unity的x,y,z s.SetDestDirection(EngineUtils.EngineDirectionToUnity(entity.direction)); s.SpaceID = KBEngineApp.app.spaceID; //GameEntity gameEntity = ((UnityEngine.GameObject)entity.renderObj).GetComponent<GameEntity>(); //gameEntity.destDirection = new Vector3(entity.direction.y, entity.direction.z, entity.direction.x); //gameEntity.spaceID = KBEngineApp.app.spaceID; }