示例#1
0
 public Skill(eSkillType a_eType, Vec2 pos, Vec2 dir, char a_cRender)
 {
     m_eType   = a_eType;
     m_vcPos   = pos;
     m_vcDir   = dir;
     m_cRender = a_cRender;
 }
示例#2
0
        /// <summary>
        /// 工厂+依赖反转(类似面向接口编程,当然这里采用的是父类)
        /// 原理:控制反转:Inversion of Control,IoC,其中这里用到了 依赖注入(构造函数注入):Dependency injection, DI
        /// 作用:高内聚,低耦合
        /// </summary>
        public static SkillBase Create(eSkillType type, VSkillBase vSkill)
        {
            SkillBase obj = null;

            switch (type)
            {
            case eSkillType.None:
                obj = new SkillBase(m_uid, vSkill);
                break;

            case eSkillType.Near:
                obj = new SkillNear(m_uid, vSkill);
                break;

            case eSkillType.Jump:
                obj = new SkillJump(m_uid, vSkill);
                break;

            case eSkillType.Down_Up:
                obj = new SkillDownUp(m_uid, vSkill);
                break;
            }
            Add(m_uid++, obj);
            return(obj);
        }
示例#3
0
    public void ActiveSkill(eSkillType a_eType, Unit m)
    {
        if (TableManager.Ins().GetSkillTable(a_eType, out SkillTable skill) == false)
        {
            Console.WriteLine("arg error or check table");
            return;
        }
        switch (a_eType)
        {
        case eSkillType.Fire:
            if ((m.m_vcPos.x > m_vcPos.x - skill.m_nRange && m.m_vcPos.x < m_vcPos.x + skill.m_nRange) &&
                (m.m_vcPos.y > m_vcPos.y - skill.m_nRange && m.m_vcPos.y < m_vcPos.y + skill.m_nRange))
            {
                m.m_NowStat.m_nHP -= skill.m_nHP;
            }
            break;

        case eSkillType.Ice:
            break;

        case eSkillType.Water:
            break;

        case eSkillType.Wind:
            break;

        case eSkillType.Earth:
            break;

        default:
            break;
        }
    }
示例#4
0
 public SkillTable(eSkillType a_eType, int a_nPow, int a_nDef, int a_nHP, int a_nRange)
 {
     m_nPow   = a_nPow;
     m_nDef   = a_nDef;
     m_nHP    = a_nHP;
     m_eType  = a_eType;
     m_nRange = a_nRange;
 }
示例#5
0
    //通过当前技能获取冷却时间和其他信息
    float getSkillTime(eSkillType _type)
    {
        float time = 0;



        return(time);
    }
示例#6
0
 public void Update(eDispell eDispell, eSkillType eType, eSkillTypeSecondary eTypeSecondary, bool bAcivated)
 {
     this._eDispell       = eDispell;
     this._eType          = eType;
     this._eTypeSecondary = eTypeSecondary;
     this._bActivated     = bAcivated;
     this._bValid         = true;
 }
示例#7
0
    public List <string> GetSkillByType(eSkillType type)
    {
        List <string> ret = new List <string>();

        foreach (var kv in SkillAssetDict)
        {
            if (kv.Value.SkillType == type)
            {
                ret.Add(kv.Key);
            }
        }
        return(ret);
    }
示例#8
0
 protected Skill _ValidateSkill(Skill hSkill)
 {
     if (!hSkill.IsValid())
     {
         XmlElement          hElement       = this._hSkillListElement[hSkill];
         eDispell            eDispell       = (eDispell)int.Parse(this._GetElement(hElement, "iDispell"));
         eSkillType          eType          = (eSkillType)int.Parse(this._GetElement(hElement, "iType"));
         eSkillTypeSecondary eTypeSecondary = (eSkillTypeSecondary)int.Parse(this._GetElement(hElement, "iTypeSecondary"));
         bool bAcivated = bool.Parse(this._GetElement(hElement, "bActivated"));
         hSkill.Update(eDispell, eType, eTypeSecondary, bAcivated);
     }
     return(hSkill);
 }
示例#9
0
 public List <Skill> GetSkillsByType(eSkillType type)
 {
     return(Skills.Where(s => s.Info.Type == type && s.Info.ActionName != "attack").ToList());
 }
示例#10
0
 public bool GetSkillTable(eSkillType a_eType, out SkillTable a_refTb)
 {
     return(m_mapSkillTb.TryGetValue(a_eType, out a_refTb));
 }
示例#11
0
 public Fire(eSkillType a_eType, Vec2 pos, Vec2 dir, char a_cRender)
     : base(a_eType, pos, dir, a_cRender)
 {
 }