public void Initialize() { m_GameWorld = new GameWorld("ClientWorld"); TimelineManager.GetInstance().Init(); SceneMgr.Instance.Init(m_GameWorld); SynchFromNet.Instance.Init(); InitializeSystems(); }
public static TimelineManager GetInstance() { if (instance != null) { return(instance); } instance = new TimelineManager(); return(instance); }
public void CastSkill(int skillID) { // var skillID = GetSkillIDByIndex(skillIndex); var isInCD = IsSkillInCD(skillID); if (isInCD) { XLuaFramework.CSLuaBridge.GetInstance().CallLuaFuncStr(GlobalEvents.MessageShow, "技能冷却中..."); return; } var roleGameOE = RoleMgr.GetInstance().GetMainRole(); var roleInfo = roleGameOE.GetComponent <RoleInfo>(); string assetPath = ResPath.GetRoleSkillResPath(skillID); bool isNormalAttack = IsNormalAttack(skillID);//普通攻击 // Debug.Log("isNormalAttack : "+isNormalAttack); if (!isNormalAttack) { ResetCombo();//使用非普攻技能时就重置连击索引 } var uid = SceneMgr.Instance.EntityManager.GetComponentData <UID>(roleGameOE.Entity); Action <TimelineInfo.Event> afterAdd = null; if (isNormalAttack) { //普攻的话增加连击索引 afterAdd = (TimelineInfo.Event e) => { if (e == TimelineInfo.Event.AfterAdd) { IncreaseCombo(); } }; } var timelineInfo = new TimelineInfo { ResPath = assetPath, Owner = roleGameOE.Entity, StateChange = afterAdd }; TimelineManager.GetInstance().AddTimeline(uid.Value, timelineInfo, SceneMgr.Instance.EntityManager); }
private void HandleCastSkill(SprotoType.scene_fight_event_info fight_event) { long uid = fight_event.attacker_uid; Entity scene_entity = SceneMgr.Instance.GetSceneObject(uid); var isMainRole = RoleMgr.GetInstance().IsMainRoleEntity(scene_entity); // isMainRole = false;//test if (scene_entity == Entity.Null || isMainRole) { return; } //TODO:预先判断是否能使用技能 bool is_can_cast = true; if (!is_can_cast) { return; } //更新朝向 Transform trans = SceneMgr.Instance.EntityManager.GetComponentObject <Transform>(scene_entity); // trans.rotation = Quaternion.Euler(trans.eulerAngles.x, fight_event.direction/100, trans.eulerAngles.z); trans.LookAt(new Vector3(fight_event.target_pos_x / GameConst.RealToLogic, fight_event.target_pos_y / GameConst.RealToLogic, fight_event.target_pos_z / GameConst.RealToLogic)); //播放攻击动作 string assetPath = SkillManager.GetInstance().GetSkillResPath((int)fight_event.skill_id); Debug.Log("OnAckFightEvents assetPath : " + assetPath); var param = new Dictionary <string, object>(); param["FlyHurtWord"] = fight_event.defenders; var timelineInfo = new TimelineInfo { ResPath = assetPath, Owner = scene_entity, Param = param }; TimelineManager.GetInstance().AddTimeline(uid, timelineInfo, SceneMgr.Instance.EntityManager); }