コード例 #1
0
 public void DoActions(ITriggerDoActionParam param = null)
 {
     if (this.func_actions != null)
     {
         this.func_actions(param);
     }
 }
コード例 #2
0
 private void OnSkill(ITriggerDoActionParam param)
 {
     if (!this.CanHandleControl())
     {
         return;
     }
     this.signalCom.Init();
     this.InvokeEveryCom("OnSkill", new object[]
     {
         param
     });
 }
コード例 #3
0
        public bool CheckConditions(ITriggerDoActionParam param = null)
        {
            bool flag = true;

            if (this.func_conditions != null)
            {
                for (int i = 0; i < this.func_conditions.Count; i++)
                {
                    if (this.func_conditions[i] != null)
                    {
                        flag &= this.func_conditions[i](param);
                    }
                }
            }
            return(flag);
        }
コード例 #4
0
        private void OnStopOrStart(ITriggerDoActionParam param)
        {
            TriggerParam_touchController triggerParam_touchController = param as TriggerParam_touchController;

            if (triggerParam_touchController == null)
            {
                return;
            }
            if (triggerParam_touchController.Start)
            {
                this.OnStart();
            }
            else
            {
                this.OnStop();
            }
        }
コード例 #5
0
        private void OnMoveEnd(ITriggerDoActionParam param)
        {
            if (!this.CanHandleControl())
            {
                return;
            }
            TriggerParamTouch triggerParamTouch;

            if (!this.HandleTouchParam(param, out triggerParamTouch))
            {
                return;
            }
            this.signalCom.Init();
            this.InvokeEveryCom("OnMoveEnd", new object[]
            {
                triggerParamTouch
            });
        }
コード例 #6
0
        public void Trigger2(ITriggerDoActionParam param)
        {
            if (param == null)
            {
                return;
            }
            ETriggerType2 typeID  = param.TypeID;
            int           eventID = param.EventID;

            if (this.tMap.ContainsKey(typeID) && this.tMap[typeID].ContainsKey(eventID))
            {
                Dictionary <string, TriggerEvent2> dictionary = this.tMap[typeID][eventID];
                foreach (KeyValuePair <string, TriggerEvent2> current in dictionary)
                {
                    if (current.Value.CheckConditions(param))
                    {
                        current.Value.DoActions(param);
                    }
                }
            }
        }
コード例 #7
0
 public virtual void OnSkill(ITriggerDoActionParam param)
 {
 }
コード例 #8
0
 private bool HandleTouchParam(ITriggerDoActionParam param, out TriggerParamTouch info)
 {
     info = (param as TriggerParamTouch);
     return(info != null);
 }
コード例 #9
0
        private bool IsPlayer(ITriggerDoActionParam param = null)
        {
            TriggerParamNavigation triggerParamNavigation = param as TriggerParamNavigation;

            return(triggerParamNavigation != null && triggerParamNavigation.IsPlayer);
        }
コード例 #10
0
 private void OnNavigateEnd(ITriggerDoActionParam param = null)
 {
     this.signalCom.Init();
     this.InvokeEveryCom("OnNavigateEnd", null);
 }
コード例 #11
0
        public override void OnSkill(ITriggerDoActionParam param)
        {
            TriggerParamSkillControl triggerParamSkillControl = param as TriggerParamSkillControl;

            if (!this.self.CanManualControl())
            {
                return;
            }
            Skill     skillOrAttackById = this.self.getSkillOrAttackById(triggerParamSkillControl.SkillID);
            Units     selectedTarget    = PlayerControlMgr.Instance.GetSelectedTarget();
            Units     units             = null;
            TargetTag targetTag         = skillOrAttackById.data.targetTag;

            if (!skillOrAttackById.NeedCustomTargetInCrazy())
            {
                if (selectedTarget == null || skillOrAttackById.NeedAutoLaunchToHero())
                {
                    if (selectedTarget == null && skillOrAttackById.skillIndex == 4 && units == null && targetTag == TargetTag.HeroAndMonster)
                    {
                        units = this.self;
                    }
                    else
                    {
                        units = FindTargetHelper.FindAutoSkillTarget(this.self, this.self.trans.position, TargetTag.Hero, (this.self.atk_type != 1) ? (base.GetSkillRange(skillOrAttackById) + 3f) : 6.5f, skillOrAttackById.data.targetCamp, null);
                    }
                }
                if (units == null)
                {
                    units = selectedTarget;
                }
                if (!skillOrAttackById.data.needTarget && skillOrAttackById.data.isMoveSkill)
                {
                    units = null;
                }
                else if (((units == null || units.isHero) && targetTag == TargetTag.CreepsAndMinions) || targetTag == TargetTag.Monster || targetTag == TargetTag.Minions || targetTag == TargetTag.Creeps)
                {
                    units = FindTargetHelper.FindAutoSkillTarget(this.self, this.self.trans.position, targetTag, (this.self.atk_type != 1) ? (base.GetSkillRange(skillOrAttackById) + 3f) : 6.5f, SkillTargetCamp.None, null);
                }
                else if (units == null && targetTag == TargetTag.HeroAndMonster)
                {
                    units = FindTargetHelper.FindAutoSkillTarget(this.self, this.self.trans.position, targetTag, (this.self.atk_type != 1) ? (base.GetSkillRange(skillOrAttackById) + 3f) : 6.5f, skillOrAttackById.data.targetCamp, skillOrAttackById);
                }
            }
            else
            {
                units = skillOrAttackById.CustomTargetInCrazy();
            }
            if (skillOrAttackById.needTarget)
            {
                units = base.GetSkillTarget(skillOrAttackById, units, true);
                if (units != null && !units.CanBeSelected)
                {
                    units = null;
                }
                units = skillOrAttackById.ReselectTarget(units, true);
                if (units != null)
                {
                    this.DisableAIAutoAttackMove();
                    this.targetCom.ClearMoveFlag();
                    if (units != null)
                    {
                        this.self.mCmdCacheController.EnqueueSkillCmd(triggerParamSkillControl.SkillID, units.mTransform.position, units, true, true);
                    }
                }
                else
                {
                    Singleton <SkillView> .Instance.ShowSkillWarn("需要指定一个有效目标!");

                    Singleton <TriggerManager> .Instance.SendUnitSkillStateEvent(UnitEvent.UnitSkillCmdCrazyPointer, this.self, skillOrAttackById);
                }
            }
            else
            {
                if (units != null && !units.CanBeSelected)
                {
                    units = null;
                }
                if (units == this.self)
                {
                    units = null;
                }
                Vector3 vector = this.self.mTransform.forward;
                if (units != null)
                {
                    vector = units.mTransform.position;
                    if (Vector3.Distance(vector, this.self.mTransform.position) > skillOrAttackById.distance + 3f)
                    {
                        Vector3 a = vector - this.self.mTransform.position;
                        a.Normalize();
                        vector = this.self.mTransform.position + a * skillOrAttackById.distance;
                    }
                }
                else
                {
                    vector.Normalize();
                    if (skillOrAttackById.distance == 0f)
                    {
                        vector = this.self.mTransform.position + vector;
                    }
                    else
                    {
                        vector = this.self.mTransform.position + vector * skillOrAttackById.distance;
                    }
                }
                if (skillOrAttackById.NeedResetTargetPos())
                {
                    vector = skillOrAttackById.GetExtraTargetPos(units, vector, true);
                }
                this.DisableAIAutoAttackMove();
                this.targetCom.ClearMoveFlag();
                this.self.mCmdCacheController.EnqueueSkillCmd(triggerParamSkillControl.SkillID, vector, units, true, true);
            }
        }
コード例 #12
0
        public override void OnSkill(ITriggerDoActionParam param)
        {
            TriggerParamSkillControl triggerParamSkillControl = param as TriggerParamSkillControl;
            Skill     skillOrAttackById = this.self.getSkillOrAttackById(triggerParamSkillControl.SkillID);
            Units     selectedTarget    = PlayerControlMgr.Instance.GetSelectedTarget();
            Units     units             = null;
            TargetTag targetTag         = skillOrAttackById.data.targetTag;

            if (selectedTarget == null || skillOrAttackById.NeedAutoLaunchToHero())
            {
                if (selectedTarget == null && skillOrAttackById.skillIndex == 4 && units == null && targetTag == TargetTag.HeroAndMonster)
                {
                    units = this.self;
                }
                else
                {
                    units = FindTargetHelper.FindAutoSkillTarget(this.self, this.self.trans.position, TargetTag.Hero, (this.self.atk_type != 1) ? (base.GetSkillRange(skillOrAttackById) + 3f) : 6.5f, skillOrAttackById.data.targetCamp, null);
                }
            }
            if (units == null)
            {
                units = selectedTarget;
            }
            if (!skillOrAttackById.data.needTarget && skillOrAttackById.data.isMoveSkill)
            {
                units = null;
            }
            else if (((units == null || units.isHero) && targetTag == TargetTag.CreepsAndMinions) || targetTag == TargetTag.Monster || targetTag == TargetTag.Minions || targetTag == TargetTag.Creeps)
            {
                units = FindTargetHelper.FindAutoSkillTarget(this.self, this.self.trans.position, targetTag, (this.self.atk_type != 1) ? (base.GetSkillRange(skillOrAttackById) + 3f) : 6.5f, skillOrAttackById.data.targetCamp, null);
            }
            else if (units == null && targetTag == TargetTag.HeroAndMonster)
            {
                units = FindTargetHelper.FindAutoSkillTarget(this.self, this.self.trans.position, targetTag, (this.self.atk_type != 1) ? (base.GetSkillRange(skillOrAttackById) + 3f) : 6.5f, skillOrAttackById.data.targetCamp, skillOrAttackById);
            }
            this.targetCom.ClearMoveFlag();
            if (!this.self.CanManualControl())
            {
                return;
            }
            if (this.self.IsSkillCanTriggerBornPowerObj(triggerParamSkillControl.SkillID))
            {
                this.ClearReadySkill();
                this.LaunchSkill(skillOrAttackById, units, true);
                return;
            }
            if (!this.DoseSkillNeedDoubleClick(skillOrAttackById))
            {
                this.ClearReadySkill();
                this.LaunchSkill(skillOrAttackById, units, true);
                return;
            }
            if (skillOrAttackById == this.readySkill)
            {
                if (this.ReadySkillOld())
                {
                    this.readyTm = Time.realtimeSinceStartup;
                    this.ClearReadySkill();
                }
                else
                {
                    this.ClearReadySkill();
                    this.LaunchSkill(skillOrAttackById, units, true);
                }
                return;
            }
            if (this.readySkill == null && this.lastReadySkill == skillOrAttackById && Time.realtimeSinceStartup - this.readyTm < 0.5f)
            {
                this.ClearReadySkill();
                this.LaunchSkill(skillOrAttackById, units, true);
                return;
            }
            this.SetReadySkill(skillOrAttackById, units);
        }