public void SelectSkillTarget(Vector2 axis, bool isSkillCursorInCancelArea)
        {
            SLevelContext curLvelContext = Singleton <BattleLogic> .get_instance().GetCurLvelContext();

            Skill skill = (this.skillSlot.NextSkillObj == null) ? this.skillSlot.SkillObj : this.skillSlot.NextSkillObj;

            if (curLvelContext != null && curLvelContext.m_isCameraFlip)
            {
                axis = -axis;
            }
            Vector3 zero  = Vector3.zero;
            Vector3 zero2 = Vector3.zero;

            if (this.effectPrefab != null && skill != null)
            {
                if (skill.cfgData.bRangeAppointType == 1)
                {
                    zero2.x = skill.cfgData.iGuideDistance * axis.x;
                    zero2.z = skill.cfgData.iGuideDistance * axis.y;
                    if ((double)zero2.magnitude <= (double)skill.cfgData.iGuideDistance * 0.5)
                    {
                        this.bUseAdvanceSelect = false;
                    }
                    else
                    {
                        this.bUseAdvanceSelect = true;
                    }
                    zero.x = axis.x;
                    zero.z = axis.y;
                    this.useOffsetPosition = Vector3.zero;
                    this.bRotateFlag       = true;
                    this.rotateAngle       = Vector3.Angle(this.useSkillDirection, zero);
                    this.deltaAngle        = 0f;
                    this.rotateDirection   = zero;
                    this.rootRosition      = this.skillSlot.Actor.get_handle().myTransform.position;
                    this.useSkillPosition  = this.skillSlot.Actor.get_handle().myTransform.position;
                }
                else if (skill.cfgData.bRangeAppointType == 2)
                {
                    zero2.x = skill.cfgData.iGuideDistance / 1000f * axis.x;
                    zero2.z = skill.cfgData.iGuideDistance / 1000f * axis.y;
                    this.useOffsetPosition = zero2;
                    this.movePosition      = this.skillSlot.Actor.get_handle().myTransform.position + zero2 - this.effectPrefab.transform.position;
                    this.movePosition.y    = 0f;
                    this.deltaDirection    = this.movePosition;
                    this.deltaDirection.Normalize();
                    this.deltaPosition = Vector3.zero;
                    this.bMoveFlag     = true;
                    this.rootRosition  = this.skillSlot.Actor.get_handle().myTransform.position;
                    this.bControlMove  = true;
                    if (skill.cfgData.bIndicatorType == 1)
                    {
                        zero.x               = axis.x;
                        zero.z               = axis.y;
                        this.bRotateFlag     = true;
                        this.rotateAngle     = Vector3.Angle(this.useSkillDirection, zero);
                        this.deltaAngle      = 0f;
                        this.rotateDirection = zero;
                    }
                }
                else if (skill.cfgData.bRangeAppointType == 3)
                {
                    if (axis == Vector2.zero && !isSkillCursorInCancelArea)
                    {
                        return;
                    }
                    zero.x = axis.x;
                    zero.z = axis.y;
                    this.useOffsetPosition = Vector3.zero;
                    this.bRotateFlag       = true;
                    this.rotateAngle       = Vector3.Angle(this.useSkillDirection, zero);
                    this.deltaAngle        = 0f;
                    this.rotateDirection   = zero;
                    this.rootRosition      = this.skillSlot.Actor.get_handle().myTransform.position;
                    this.useSkillPosition  = this.skillSlot.Actor.get_handle().myTransform.position;
                }
            }
            if (isSkillCursorInCancelArea)
            {
                if (this.effectWarnPrefab != null && this.effectPrefab != null)
                {
                    this.effectWarnPrefab.transform.position = this.effectPrefab.transform.position;
                    this.effectWarnPrefab.transform.forward  = this.effectPrefab.transform.forward;
                }
                this.SetGuildWarnPrefabShow(true);
                this.SetGuildPrefabShow(false);
                this.SetFixedPrefabShow(false);
            }
            else
            {
                this.SetGuildWarnPrefabShow(false);
                this.SetFixedPrefabShow(true);
                if (!this.bUseAdvanceSelect)
                {
                    this.SetGuildPrefabShow(false);
                    this.SetEffectPrefabShow(false);
                }
                else
                {
                    this.SetGuildPrefabShow(true);
                    this.SetEffectPrefabShow(true);
                }
            }
        }
        public bool IsAllowUseSkill()
        {
            Skill skill = (this.skillSlot.NextSkillObj == null) ? this.skillSlot.SkillObj : this.skillSlot.NextSkillObj;

            return(skill.cfgData.bRangeAppointType != 2 || this.bControlMove || this.pressTime > 1000);
        }
        public void CreateIndicatePrefab(Skill _skillObj)
        {
            if (!this.skillSlot.Actor || !ActorHelper.IsHostActor(ref this.skillSlot.Actor))
            {
                return;
            }
            if (_skillObj == null || _skillObj.cfgData == null)
            {
                return;
            }
            this.effectHideFrameNum = 0;
            ActorRoot  handle   = this.skillSlot.Actor.get_handle();
            Quaternion rotation = handle.myTransform.rotation;
            Vector3    position = handle.myTransform.position;

            position.y += 0.3f;
            GameObject pooledGameObjLOD = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(_skillObj.GuidePrefabName, true, SceneObjType.ActionRes, position, rotation);

            if (pooledGameObjLOD != null)
            {
                this.guidePrefab = pooledGameObjLOD;
                this.guidePrefab.transform.SetParent(handle.myTransform);
                this.HidePrefab(this.guidePrefab);
                this.SetPrefabTag(this.guidePrefab);
                this.guideSelectActive = false;
            }
            pooledGameObjLOD = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(_skillObj.GuideWarnPrefabName, true, SceneObjType.ActionRes, position, rotation);

            if (pooledGameObjLOD != null)
            {
                this.guideWarnPrefab = pooledGameObjLOD;
                this.guideWarnPrefab.transform.SetParent(handle.myTransform);
                this.HidePrefab(this.guideWarnPrefab);
                this.SetPrefabTag(this.guideWarnPrefab);
            }
            pooledGameObjLOD = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(_skillObj.EffectPrefabName, true, SceneObjType.ActionRes, position, rotation);

            if (pooledGameObjLOD != null)
            {
                this.effectPrefabNormal = pooledGameObjLOD;
                this.HidePrefab(this.effectPrefabNormal);
                this.SetPrefabTag(this.effectPrefabNormal);
                this.effectSelectActive = false;
                MonoSingleton <SceneMgr> .GetInstance().AddToRoot(this.effectPrefabNormal, SceneObjType.ActionRes);
            }
            this.bSelectEffectPrefab = (_skillObj.cfgData.bSelectEffectPrefab > 0);
            if (this.bSelectEffectPrefab)
            {
                pooledGameObjLOD = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(_skillObj.EffectPrefabName + "_y", true, SceneObjType.ActionRes, position, rotation);

                if (pooledGameObjLOD != null)
                {
                    this.effectPrefabBlock = pooledGameObjLOD;
                    this.HidePrefab(this.effectPrefabBlock);
                    this.SetPrefabTag(this.effectPrefabBlock);
                    MonoSingleton <SceneMgr> .GetInstance().AddToRoot(this.effectPrefabBlock, SceneObjType.ActionRes);
                }
                pooledGameObjLOD = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(_skillObj.EffectPrefabName + "_G", true, SceneObjType.ActionRes, position, rotation);

                if (pooledGameObjLOD != null)
                {
                    this.effectPrefabGrass = pooledGameObjLOD;
                    this.HidePrefab(this.effectPrefabGrass);
                    this.SetPrefabTag(this.effectPrefabGrass);
                    MonoSingleton <SceneMgr> .GetInstance().AddToRoot(this.effectPrefabGrass, SceneObjType.ActionRes);
                }
            }
            pooledGameObjLOD = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(_skillObj.EffectWarnPrefabName, true, SceneObjType.ActionRes, position, rotation);

            if (pooledGameObjLOD != null)
            {
                this.effectWarnPrefab = pooledGameObjLOD;
                this.HidePrefab(this.effectWarnPrefab);
                this.SetPrefabTag(this.effectWarnPrefab);
                MonoSingleton <SceneMgr> .GetInstance().AddToRoot(this.effectWarnPrefab, SceneObjType.ActionRes);
            }
            pooledGameObjLOD = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(_skillObj.FixedPrefabName, true, SceneObjType.ActionRes, position, rotation);

            if (pooledGameObjLOD != null)
            {
                this.fixedPrefab = pooledGameObjLOD;
                this.HidePrefab(this.fixedPrefab);
                this.SetPrefabTag(this.fixedPrefab);
                this.fixedPrefab.transform.SetParent(handle.myTransform);
            }
            pooledGameObjLOD = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(_skillObj.FixedWarnPrefabName, true, SceneObjType.ActionRes, position, rotation);

            if (pooledGameObjLOD != null)
            {
                this.fixedWarnPrefab = pooledGameObjLOD;
                this.HidePrefab(this.fixedWarnPrefab);
                this.SetPrefabTag(this.fixedWarnPrefab);
                this.fixedWarnPrefab.transform.SetParent(handle.myTransform);
            }
            int distance = _skillObj.cfgData.iGuideDistance;

            this.SetPrefabScaler(this.guidePrefab, distance);
            this.SetPrefabScaler(this.guideWarnPrefab, distance);
            if (_skillObj.cfgData.bRangeAppointType == 3 || _skillObj.cfgData.bRangeAppointType == 1)
            {
                this.SetPrefabScaler(this.effectPrefabNormal, distance);
                this.SetPrefabScaler(this.effectPrefabBlock, distance);
                this.SetPrefabScaler(this.effectPrefabGrass, distance);
                this.SetPrefabScaler(this.effectWarnPrefab, distance);
            }
            int distance2 = _skillObj.cfgData.iFixedDistance;

            this.SetPrefabScaler(this.fixedPrefab, distance2);
            this.SetPrefabScaler(this.fixedWarnPrefab, distance2);
        }
Exemplo n.º 4
0
        public void CreateIndicatePrefab(Skill _skillObj)
        {
            if (((this.skillSlot.Actor != 0) && ActorHelper.IsHostActor(ref this.skillSlot.Actor)) && ((_skillObj != null) && (_skillObj.cfgData != null)))
            {
                this.effectHideFrameNum = 0;
                ActorRoot  handle   = this.skillSlot.Actor.handle;
                Quaternion rotation = handle.gameObject.transform.rotation;
                Vector3    position = handle.gameObject.transform.position;
                position.y += 0.3f;
                GameObject obj2 = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(_skillObj.GuidePrefabName, true, SceneObjType.ActionRes, position, rotation);

                if (obj2 != null)
                {
                    this.guidePrefab = obj2;
                    this.guidePrefab.transform.SetParent(handle.gameObject.transform);
                    this.HidePrefab(this.guidePrefab);
                    this.SetPrefabTag(this.guidePrefab);
                    this.guideSelectActive = false;
                }
                obj2 = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(_skillObj.GuideWarnPrefabName, true, SceneObjType.ActionRes, position, rotation);

                if (obj2 != null)
                {
                    this.guideWarnPrefab = obj2;
                    this.guideWarnPrefab.transform.SetParent(handle.gameObject.transform);
                    this.HidePrefab(this.guideWarnPrefab);
                    this.SetPrefabTag(this.guideWarnPrefab);
                }
                obj2 = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(_skillObj.EffectPrefabName, true, SceneObjType.ActionRes, position, rotation);

                if (obj2 != null)
                {
                    this.effectPrefab = obj2;
                    this.HidePrefab(this.effectPrefab);
                    this.SetPrefabTag(this.effectPrefab);
                    this.effectSelectActive = false;
                    MonoSingleton <SceneMgr> .GetInstance().AddToRoot(this.effectPrefab, SceneObjType.ActionRes);
                }
                obj2 = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(_skillObj.EffectWarnPrefabName, true, SceneObjType.ActionRes, position, rotation);

                if (obj2 != null)
                {
                    this.effectWarnPrefab = obj2;
                    this.HidePrefab(this.effectWarnPrefab);
                    this.SetPrefabTag(this.effectWarnPrefab);
                    MonoSingleton <SceneMgr> .GetInstance().AddToRoot(this.effectWarnPrefab, SceneObjType.ActionRes);
                }
                obj2 = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(_skillObj.FixedPrefabName, true, SceneObjType.ActionRes, position, rotation);

                if (obj2 != null)
                {
                    this.fixedPrefab = obj2;
                    this.HidePrefab(this.fixedPrefab);
                    this.SetPrefabTag(this.fixedPrefab);
                    this.fixedPrefab.transform.SetParent(handle.gameObject.transform);
                }
                obj2 = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(_skillObj.FixedWarnPrefabName, true, SceneObjType.ActionRes, position, rotation);

                if (obj2 != null)
                {
                    this.fixedWarnPrefab = obj2;
                    this.HidePrefab(this.fixedWarnPrefab);
                    this.SetPrefabTag(this.fixedWarnPrefab);
                    this.fixedWarnPrefab.transform.SetParent(handle.gameObject.transform);
                }
                int iGuideDistance = (int)_skillObj.cfgData.iGuideDistance;
                this.SetPrefabScaler(this.guidePrefab, iGuideDistance);
                this.SetPrefabScaler(this.guideWarnPrefab, iGuideDistance);
                if ((_skillObj.cfgData.dwRangeAppointType == 3) || (_skillObj.cfgData.dwRangeAppointType == 1))
                {
                    this.SetPrefabScaler(this.effectPrefab, iGuideDistance);
                    this.SetPrefabScaler(this.effectWarnPrefab, iGuideDistance);
                }
                int iFixedDistance = (int)_skillObj.cfgData.iFixedDistance;
                this.SetPrefabScaler(this.fixedPrefab, iFixedDistance);
                this.SetPrefabScaler(this.fixedWarnPrefab, iFixedDistance);
            }
        }