// Update is called once per frame void Update() { if (m_Inited) { BaseSkillState curSkillState = m_Actor.skillList.curSkillState; if (m_CurSkillState != curSkillState) { m_CurSkillState = curSkillState; if (m_CurSkillState == null || m_CurSkillState.skillInfo.type == SkillType.NotReleaseSkill) { txt.text = ""; slider.gameObject.active = false; } else { txt.text = m_CurSkillState.skillInfo.outPutName; slider.gameObject.active = true; } } if (m_CurSkillState == null) { return; } float skillTime = (float)m_Actor.skillList.countTime; float totalTime = (float)m_Actor.skillList.totalTime; float slideValue = totalTime > 0 ? (skillTime / totalTime) : 0; slider.value = slideValue; } }
protected virtual void OnLeaveStopping() { EffectSkill(); SkillStruct nothingDo = new SkillStruct(); nothingDo.type = SkillType.NotReleaseSkill; BaseSkillState nothingToDoState = new BaseSkillState(m_SkillList, nothingDo); owner.SetState(nothingToDoState); }
protected virtual void EnterLostBallance() { SkillStruct lostBallance = new SkillStruct(); lostBallance.type = SkillType.HurtEffect; lostBallance.releaseTime = m_SkillStruct.lostBalanceTime; lostBallance.name = "摔倒"; BaseSkillState lostBallanceState = new BaseSkillState(m_SkillList, lostBallance); owner.SetState(lostBallanceState); }
public void ReleaseSkill(int skillIdx) { if ((m_SkillFsm.curSkillState.skillInfo.type != SkillType.NotReleaseSkill && countTime > 0)) { return; } SkillStruct skillStuct = GetSkill(skillIdx); BaseSkillState newSkillState = null; if (skillStuct.skillClassName == "") { newSkillState = new BaseSkillState(this, skillStuct, m_Target); } else { Assembly assembly = Assembly.GetExecutingAssembly(); // 获取当前程序集 Type GetState = assembly.GetType("GameProject." + skillStuct.skillClassName); newSkillState = (BaseSkillState)Activator.CreateInstance(GetState, new object[] { this, skillStuct, m_Target }); // 创建类的 } m_SkillFsm.SetState(newSkillState); }