public static void Play(Player player, string animName) { GameObject obj = null; if (objects.TryGetValue(animName, out obj)) { if (obj.activeInHierarchy) { return; } else { obj.SetActive(true); } } else { Object prefab = ResourceLoadManager.Instance.LoadPrefab("Prefab/Camera/" + animName); obj = Object.Instantiate(prefab) as GameObject; UCamCtrl_SkillAction camCtrl = obj.GetComponent <UCamCtrl_SkillAction>(); camCtrl.animName = animName; camCtrl.player = player; /* * Skybox oriSkybox = GameSystem.Instance.mClient.mCurMatch.m_cam.GetComponent<Skybox>(); * Camera newCam = obj.GetComponentInChildren<Camera>(); * Skybox newSkybox = newCam.gameObject.AddMissingComponent<Skybox>(); * newSkybox.material = oriSkybox.material; */ objects.Add(animName, obj); } GameSystem.Instance.mClient.mCurMatch.m_cam.enabled = false; }
override public void OnEnter(PlayerState lastState) { base.OnEnter(lastState); if (m_curExecSkill == null) { Debug.LogError("SkillState: no reference skill, check config."); return; } m_curAction = _ParseAction(m_curExecSkill.curAction.action_id, m_curExecSkill.matchedKeyIdx); //Debug.Log("current execute skill: " + m_curExecSkill.skill.id + " action id: " + m_curExecSkill.curAction.action_id + " type: " + m_curExecSkill.skill.action_type); //double animLength = (double)m_stateMachine.m_Animation[m_curAction].length; //m_fSpeedComp = (float)(animLength / (animLength - m_curExecSkill.networkTimeComp)); //m_fSpeedComp = Mathf.Clamp(m_fSpeedComp, 0.0f, 2.0f); //m_stateMachine.m_Animation[m_curAction].speed = m_fSpeedComp; //Debug.Log("Complement time is: " + m_curExecSkill.networkTimeComp + " anim speed: " + m_fSpeedComp); m_player.m_skillSystem.ResetSkillEffects(m_curExecSkill, m_curAction); if (!string.IsNullOrEmpty(m_curExecSkill.curAction.camera_animation) && m_player.m_team == m_match.mainRole.m_team && !MainPlayer.Instance.inPvpJoining) { UCamCtrl_SkillAction.Play(m_player, m_curExecSkill.curAction.camera_animation); } if (m_eState != State.ePrepareToShoot) { m_player.mStatistics.AddSkillUsage(m_curExecSkill.skill.id); } }