SceneObjcet GetSceneObject(ulong objId) { SceneObjcet so = null; m_sceneObjects.TryGetValue(objId, out so); return(so); }
void OnSceneUnitSkillAction(int id, SceneUnitSkillAction msg) { SceneObjcet so = this.GetSceneObject(msg.SuId); if (null == so) { return; } so.skillId = msg.SkillId; so.skillStage = msg.Stage; if (ESkillState.EssPreparing == msg.Stage) { Animation animation = so.modelGo.GetComponent <Animation>(); animation.Play("skill1"); } if (ESkillState.EssReleasing == msg.Stage) { Animation animation = so.modelGo.GetComponent <Animation>(); animation.Play("skill2"); } if (ESkillState.EssLasting == msg.Stage) { Animation animation = so.modelGo.GetComponent <Animation>(); animation.Play("skill3"); } }
void OnRecvSceneUnitTransform(int id, SceneUnitTransform msg) { SceneObjcet so = this.GetSceneObject(msg.SuId); if (null == so) { return; } so.SetPos(msg.Pos); so.faceDir = msg.FaceDir; }
void OnRecvSceneUnitState(int id, SceneUnitState msg) { SceneObjcet so = this.GetSceneObject(msg.SuId); if (null == so) { so = new SceneObjcet(msg.SuId, msg.UnitType, msg.ModelId); m_sceneObjects[so.id] = so; } so.SetPos(msg.Pos); so.faceDir = msg.FaceDir; }
void OnRecvSceneObjectState(int id, SceneObjectState msg) { SceneObjcet so = this.GetSceneObject(msg.Objid); if (null == so) { so = new SceneObjcet(msg.Objid, msg.ObjType, msg.ModelId); m_sceneObjects[so.id] = so; } so.SetPos(msg.Pos); so.faceDir = msg.Rotation; }
void OnSceneObjectDisappear(int id, SceneObjectDisappear msg) { foreach (ulong objid in msg.Objids) { SceneObjcet obj = this.GetSceneObject(objid); if (null == obj) { continue; } m_sceneObjects.Remove(objid); GameObject.Destroy(obj.modelGo); } }
void OnRecvceneUnitMove(int id, SceneUnitMove msg) { SceneObjcet so = this.GetSceneObject(msg.SuId); if (null == so) { return; } if (so.IsPlayingSkill()) { return; } if (msg.MoveAgentState == EMoveAgentState.MoveToPos || msg.MoveAgentState == EMoveAgentState.MoveToDir) { Animation animation = so.modelGo.GetComponent <Animation>(); if (!animation.IsPlaying("run")) { animation.Play("run"); } } else if (msg.MoveAgentState == EMoveAgentState.ForceLine || msg.MoveAgentState == EMoveAgentState.ForcePos) { Animation animation = so.modelGo.GetComponent <Animation>(); if (!animation.IsPlaying("knockUpStill")) { animation.Play("knockUpStill"); } } else { Animation animation = so.modelGo.GetComponent <Animation>(); if (!animation.IsPlaying("idle")) { animation.Play("idle"); } } }
void OnRecvMoveObjectMutableState(int id, MoveObjectMutableState msg) { SceneObjcet so = this.GetSceneObject(msg.Objid); if (null == so) { return; } so.SetPos(msg.Pos); so.faceDir = msg.Rotation; if (msg.MoveAgentState == EMoveAgentState.MoveToPos || msg.MoveAgentState == EMoveAgentState.MoveToDir) { Animation animation = so.modelGo.GetComponent <Animation>(); if (!animation.IsPlaying("run")) { animation.Play("run"); } } else if (msg.MoveAgentState == EMoveAgentState.ForceLine || msg.MoveAgentState == EMoveAgentState.ForcePos) { Animation animation = so.modelGo.GetComponent <Animation>(); if (!animation.IsPlaying("knockUpStill")) { animation.Play("knockUpStill"); } } else { Animation animation = so.modelGo.GetComponent <Animation>(); if (!animation.IsPlaying("idle")) { animation.Play("idle"); } } }