頂級遊戲設計大師
阿新 • • 發佈:2019-01-29
using UnityEngine; using System.Collections; using System.Collections.Generic; public enum SkillTypes{ BornSkill = 0, //降臨技能 NormalSkill = 1, // 普通攻擊技能 AttackSkill = 2, // 攻擊技能 SuperSkill = 3, // 大招 } public enum SkillHitTypes { //HitType: 擊中型別(0:對敵方目標 1:敵方範圍 2:友方目標 3:友方範圍 4:自己); SelectedEnemy = 0, ScaleEnemy = 1, SelectedFriend = 2, ScaleFriend = 3, Self = 4, }; public enum SkillHitSharpTypes {//HitSharpType: 攻擊範圍型別(0:對目標 1:圓形 2:扇形); None = 0, Circle = 1, Fan = 2, }; public enum SkillEffectTypes { ImmedDamage = 0, // 立即傷害 ImmedHeal = 1, // 治療 AddBuff = 2, // 新增buff Sneer = 3, // 嘲諷 HitDown = 4, // 擊倒 HitOut = 5, // 擊飛 }; public class Skill { //public float AttackDist; public int SkillId ; private SkillData m_SkillBaseData; public SkillData BaseData{ get{ return m_SkillBaseData; } } public string SkillName{ get{return m_SkillBaseData.Name;} } public SkillTypes SkillType{ get{return (SkillTypes)m_SkillBaseData.SkillType;} } public string Icon{ get{return m_SkillBaseData.Icon;} } public bool CoolDown = false; public float CDTime{ get{return m_SkillBaseData.CDTime;} } public float AttackDist{ get{return m_SkillBaseData.AttackDist;} } public int HitNum{ get{return m_SkillBaseData.HitNum;} } public float AttackRadius{ get{return m_SkillBaseData.AttackRadius;} } public float AttackAngel{ get{return m_SkillBaseData.AttackAngle;} } public SkillHitTypes HitType{ get{return (SkillHitTypes)m_SkillBaseData.HitType;} } public SkillHitSharpTypes HitSharpType{ get{return (SkillHitSharpTypes)m_SkillBaseData.HitSharpType;} } public int BpNeed{ get{return m_SkillBaseData.BpNeed;} } public List<SkillEffectData> EffectList{ get{return m_SkillBaseData.EffectList;} } public Skill(int dataId){ SkillId = dataId; m_SkillBaseData = DataManager.s_SkillDataManager.GetData(dataId); if (m_SkillBaseData == null) { Debug.LogError("SkillData is null,dataID="+dataId); return ; } //return m_SkillBaseData; } private GameObject m_SkillCaster= null; private GameObject m_SkillTarget = null; public void SetSkillCaster(GameObject m,GameObject tar){ m_SkillCaster = m; m_SkillTarget = tar; } public void SetCD(){ CoolDown = true; TimerManager.Instance.AddTimer ("Skill" + m_SkillCaster.gameObject.name + SkillId.ToString (), CDTime, ResetCD, null); } void ResetCD(params object[] args){ CoolDown = false; } }