Beispiel #1
0
        // 添加主动技能
        public void AddActiveSkill(ActiveSkill skill, bool asDefaultActiveSkill = true)
        {
            var name = skill.ID;

            Debug.Assert(!activeSkills.ContainsKey(name), "skill named: " + name + " has aleardy existed. Use ReplaceActiveSkill to replace it.");
            activeSkills[name] = skill;

            if (asDefaultActiveSkill)
            {
                defaultSkillName = name;
            }
        }
Beispiel #2
0
        public virtual void FireSkillAt(ActiveSkill skill, int x, int y)
        {
            if (Energy < skill.EnergyCost)
            {
                return;
            }

            if (skill.Owner.IsSkillReleased)
            {
                return;
            }

            BeforeFireSkillAt?.Invoke(skill, x, y);

            AddEN(-skill.EnergyCost);
            (skill as ISkillWithPosSel).FireAt(x, y);
            skill.Owner.IsSkillReleased = true;

            OnFireSkillAt?.Invoke(skill, x, y);
            AfterFireSkillAt?.Invoke(skill, x, y);
        }
Beispiel #3
0
        public virtual void FireSkill(ActiveSkill skill)
        {
            if (Energy < skill.EnergyCost)
            {
                return;
            }

            if (skill.Owner.IsSkillReleased)
            {
                return;
            }

            BeforeFireSkill?.Invoke(skill);

            AddEN(-skill.EnergyCost);
            skill.Owner.IsSkillReleased = true;
            skill.Fire();

            OnFireSkill?.Invoke(skill);
            AfterFireSkill?.Invoke(skill);
        }
Beispiel #4
0
 // 移除主动技能
 public void RemoveActiveSkill(ActiveSkill skill)
 {
     Debug.Assert(skill.Owner == this, "skill named: " + skill.ID + " doest not exist.");
     RemoveActiveSkill(skill.ID);
 }