Esempio n. 1
0
 /// <summary>
 /// 设置是否生效
 /// </summary>
 /// <param name="self"></param>
 /// <param name="enable"></param>
 public static void SetEnable(this SpellPreviewComponent self, bool enable)
 {
     if (self.Enable)
     {
         self.CancelPreview();
     }
     self.Enable = enable;
 }
Esempio n. 2
0
        /// <summary>
        /// 进入预览
        /// </summary>
        /// <param name="self"></param>
        public static void EnterPreview(this SpellPreviewComponent self)
        {
            if (!self.Enable)
            {
                return;
            }
            self.CancelPreview();
            self.Previewing = true;
            //伤害作用对象(0自身1己方2敌方)
            var affectTargetType = self.PreviewingSkill.SkillConfig.DamageTarget;
            //技能预览类型(0大圈选一个目标,1大圈选小圈)
            var previewType = self.PreviewingSkill.SkillConfig.PreviewType;

            // Log.Info("affectTargetType"+affectTargetType+" targetSelectType"+targetSelectType+" previewType"+previewType);

            //0大圈选一个目标
            if (previewType == SkillPreviewType.SelectTarget)
            {
                var comp = self.GetComponent <TargetSelectComponent>();
                if (comp == null)
                {
                    comp = self.AddComponent <TargetSelectComponent>();
                }
                comp.TargetLimitType = affectTargetType;
                comp.Mode            = self.PreviewingSkill.SkillConfig.Mode;
                SelectEventSystem.Instance.Show <Action <Unit>, int[]>(comp, (a) => { self.OnSelectedTarget(a); },
                                                                       self.PreviewingSkill.SkillConfig.PreviewRange).Coroutine();
                self.CurSelect = comp;
            }
            //1大圈选小圈
            else if (previewType == SkillPreviewType.SelectCircularInCircularArea)
            {
                var comp = self.GetComponent <PointSelectComponent>();
                if (comp == null)
                {
                    comp = self.AddComponent <PointSelectComponent>();
                }
                comp.Mode = self.PreviewingSkill.SkillConfig.Mode;
                SelectEventSystem.Instance.Show <Action <Vector3>, int[]>(comp, (a) => { self.OnInputPoint(a); },
                                                                          self.PreviewingSkill.SkillConfig.PreviewRange).Coroutine();
                self.CurSelect = comp;
            }
            //2矩形
            else if (previewType == SkillPreviewType.SelectRectangleArea)
            {
                var comp = self.GetComponent <DirectRectSelectComponent>();
                if (comp == null)
                {
                    comp = self.AddComponent <DirectRectSelectComponent>();
                }
                comp.Mode = self.PreviewingSkill.SkillConfig.Mode;
                SelectEventSystem.Instance.Show <Action <Vector3>, int[]>(comp, (a) => { self.OnInputDirect(a); },
                                                                          self.PreviewingSkill.SkillConfig.PreviewRange).Coroutine();
                self.CurSelect = comp;
            }
            //自动
            else
            {
                Log.Error("未处理的施法类型" + previewType);
            }
        }