Beispiel #1
0
        public static void InitProperty(this Skill self)
        {
            // 所属Unit
            self.Self = self.GetParent <SkillComponent>().GetParent <DUnit>();
            // 技能状态初始化
            self.SetSkillState(SkillState.SkillWait);
            // 是否循环使用
            self.SkillLoop = self.SkillConfig.SkillLoop > 0 ? true : false;
            // 技能伤害类型
            self.SkillDamageType = SkillDamageTypeHelper.GetSkillDamageType(self.SkillConfig.DamageType);
            // 目标阵营
            self.TargetCamp = SkillTargetHelper.GetTargetCamp(self.SkillConfig.TargetCamp);
            // 目标类型
            self.TargetType = SkillTargetHelper.GetTargetType(self.SkillConfig.TargetType);

            NumericComponent numeric = self.AddComponent <NumericComponent>();
            SkillConfig      config  = self.SkillConfig;

            // 最大攻击半径
            numeric.Set(NumericType.MaxRadiusBase, config.MaxRadius);

            // 基础技能时长
            numeric.Set(NumericType.SkillTimeBase, config.SkillTime);

            // 伤害范围缩放
            if (self.SkillDamageType != SkillDamageType.Target)
            {
                JsonData damageScale = JsonMapper.ToObject(config.DamageScale);
                numeric.Set(NumericType.ScaleXBase, (float)damageScale["x"]);
                numeric.Set(NumericType.ScaleYBase, (float)damageScale["y"]);
                numeric.Set(NumericType.ScaleZBase, (float)damageScale["z"]);
            }

            // 触发创建完成事件
            Game.EventSystem.Publish(new AppEventType.AfterSkillCreate()
            {
                Skill = self
            }).Coroutine();
        }
Beispiel #2
0
        public static void EnterDamageTrigger(this Skill self, DUnit unit)
        {
            // 如果符合阵营条件
            if (!SkillTargetHelper.IsTargetCamp(self.TargetCamp, self.Self.GetComponent <CampComponent>().Camp, unit.GetComponent <CampComponent>().Camp))
            {
                return;
            }

            // 如果符合类型条件
            UnitTypeComponent typeComponent = unit.GetComponent <UnitTypeComponent>();

            if (typeComponent.UnitType == UnitType.UnitRole)
            {
                URoleConfigComponent uRoleConfig = unit.GetComponent <URoleConfigComponent>();
                if (!SkillTargetHelper.IsTargetType(self.TargetType, uRoleConfig.RoleType))
                {
                    return;
                }
            }

            self.DamageList.List.Add(unit.Id);
        }