Example #1
0
    private static ResourceHandleWrapper <LinePointer> CreateLinePointer(Units self)
    {
        ResourceHandle resourceHandle = MapManager.Instance.SpawnResourceHandle("LinePointer", null, 0);
        Transform      raw            = resourceHandle.Raw;

        raw.gameObject.SetActive(false);
        raw.gameObject.layer = LayerMask.NameToLayer("SkillPointer");
        EffectFollowBehavior effectFollowBehavior = raw.gameObject.GetComponent <EffectFollowBehavior>();

        if (effectFollowBehavior == null)
        {
            effectFollowBehavior = raw.gameObject.AddComponent <EffectFollowBehavior>();
        }
        effectFollowBehavior.SetFollowObj(self.transform, Vector3.up / 5f);
        raw.position      = Vector3.zero;
        raw.localRotation = Quaternion.Euler(Vector3.up);
        LinePointer component = raw.GetComponent <LinePointer>();

        component.theurgist      = self;
        component.followBehavior = effectFollowBehavior;
        return(new ResourceHandleWrapper <LinePointer>(resourceHandle));
    }
Example #2
0
    public static ResourceHandleWrapper <SkillPointer> CreateSkillPointer(Units self, string skill_id, float distance)
    {
        ResourceHandle resourceHandle = null;
        Skill          skillById      = self.getSkillById(skill_id);
        int            num            = skillById.castingType;

        if (skillById.data.IsUseSkillPointer)
        {
            num = (int)skillById.data.SkillPointerType;
        }
        switch (num)
        {
        case 1:
            resourceHandle = MapManager.Instance.SpawnResourceHandle("LinePointer", null, 0);
            break;

        case 2:
            resourceHandle = MapManager.Instance.SpawnResourceHandle("CirclePointer", null, 0);
            break;

        case 3:
        {
            float num2 = 45f;
            if (skillById.data.IsUseSkillPointer)
            {
                num2 = skillById.data.SectorPointerAngle;
            }
            if (Math.Abs(num2 - 20f) < 1f)
            {
                resourceHandle = MapManager.Instance.SpawnResourceHandle("SectorPointer20", null, 0);
            }
            else if (Math.Abs(num2 - 30f) < 1f)
            {
                resourceHandle = MapManager.Instance.SpawnResourceHandle("SectorPointer30", null, 0);
            }
            else if (Math.Abs(num2 - 45f) < 1f)
            {
                resourceHandle = MapManager.Instance.SpawnResourceHandle("SectorPointer45", null, 0);
            }
            else if (Math.Abs(num2 - 60f) < 1f)
            {
                resourceHandle = MapManager.Instance.SpawnResourceHandle("SectorPointer60", null, 0);
            }
            break;
        }

        default:
            resourceHandle = MapManager.Instance.SpawnResourceHandle("CirclePointer", null, 0);
            break;
        }
        if (resourceHandle == null)
        {
            return(null);
        }
        Transform raw = resourceHandle.Raw;

        raw.gameObject.layer = LayerMask.NameToLayer("SkillPointer");
        EffectFollowBehavior effectFollowBehavior = raw.gameObject.GetComponent <EffectFollowBehavior>();

        if (effectFollowBehavior == null)
        {
            effectFollowBehavior = raw.gameObject.AddComponent <EffectFollowBehavior>();
        }
        effectFollowBehavior.SetFollowObj(self.transform, Vector3.up / 5f);
        raw.position      = self.transform.position + Vector3.up / 5f;
        raw.localRotation = Quaternion.Euler(Vector3.zero);
        SkillPointer component = raw.GetComponent <SkillPointer>();

        component.theurgist = self;
        component.CreateSkillPointer(skillById.skillMainId, skillById.distance, skillById.effect_range1, skillById.effect_range2);
        ResourceHandleWrapper <SkillPointer> resourceHandleWrapper = new ResourceHandleWrapper <SkillPointer>(resourceHandle);

        self.mSkillPointer = resourceHandleWrapper;
        return(resourceHandleWrapper);
    }
Example #3
0
        public static void SetPosition(Units tempUnit, List <Units> targets, Units parentUnit, HighEffectData data, Vector3 position)
        {
            bool flag  = data.param2 == 1f;
            bool flag2 = data.param2 == 2f;

            switch ((int)data.param3)
            {
            case 0:
                tempUnit.SetPosition(parentUnit.mTransform.position, false);
                tempUnit.mTransform.rotation = parentUnit.mTransform.rotation;
                if (flag)
                {
                    EffectFollowBehavior effectFollowBehavior = tempUnit.gameObject.GetComponent <EffectFollowBehavior>();
                    if (effectFollowBehavior == null)
                    {
                        effectFollowBehavior = tempUnit.gameObject.AddComponent <EffectFollowBehavior>();
                    }
                    effectFollowBehavior.SetFollowObj(parentUnit.mTransform, Vector3.zero);
                }
                else if (flag2)
                {
                    RotationBehavior rotationBehavior = tempUnit.gameObject.GetComponent <RotationBehavior>();
                    if (rotationBehavior == null)
                    {
                        rotationBehavior = tempUnit.gameObject.AddComponent <RotationBehavior>();
                    }
                    rotationBehavior.SetFollowObj(parentUnit.mTransform, Vector3.zero, 0f);
                }
                break;

            case 1:
                tempUnit.transform.position = position + Vector3.up * 10f;
                HOTween.To(tempUnit.transform, data.param4, new TweenParms().Prop("localPosition", position));
                if (data.param5 == 1f)
                {
                    tempUnit.transform.localRotation = parentUnit.transform.rotation;
                }
                break;

            case 2:
                if (tempUnit.gameObject.GetComponent <JiTui>() == null)
                {
                    tempUnit.gameObject.AddComponent <JiTui>().Init(tempUnit, position, data.param4, true, 70f);
                }
                parentUnit.TurnToTarget(new Vector3?(position), true, false, 0f);
                break;

            case 3:
                tempUnit.transform.position = position;
                break;

            case 4:
                tempUnit.SetPosition(new Vector3(parentUnit.mTransform.position.x, parentUnit.mTransform.position.y + parentUnit.GetHeight(), parentUnit.mTransform.position.z), false);
                tempUnit.mTransform.rotation = parentUnit.mTransform.rotation;
                if (flag)
                {
                    EffectFollowBehavior effectFollowBehavior2 = tempUnit.gameObject.GetComponent <EffectFollowBehavior>();
                    if (effectFollowBehavior2 == null)
                    {
                        effectFollowBehavior2 = tempUnit.gameObject.AddComponent <EffectFollowBehavior>();
                    }
                    effectFollowBehavior2.SetFollowObj(parentUnit.mTransform, new Vector3(0f, parentUnit.GetHeight(), 0f));
                }
                else if (flag2)
                {
                    RotationBehavior rotationBehavior2 = tempUnit.gameObject.GetComponent <RotationBehavior>();
                    if (rotationBehavior2 == null)
                    {
                        rotationBehavior2 = tempUnit.gameObject.AddComponent <RotationBehavior>();
                    }
                    rotationBehavior2.SetFollowObj(parentUnit.mTransform, new Vector3(0f, parentUnit.GetHeight(), 0f), 0f);
                }
                break;

            case 5:
            {
                Vector3 vector;
                Vector3 b;
                BornUnitAction.GetModelPoint(data, out vector, out b);
                tempUnit.SetPosition(parentUnit.mTransform.position + vector, false);
                tempUnit.mTransform.rotation = Quaternion.Euler(parentUnit.mTransform.eulerAngles + b);
                if (flag)
                {
                    EffectFollowBehavior effectFollowBehavior3 = tempUnit.gameObject.GetComponent <EffectFollowBehavior>();
                    if (effectFollowBehavior3 == null)
                    {
                        effectFollowBehavior3 = tempUnit.gameObject.AddComponent <EffectFollowBehavior>();
                    }
                    effectFollowBehavior3.SetFollowObj(parentUnit.mTransform, vector);
                }
                else if (flag2)
                {
                    RotationBehavior rotationBehavior3 = tempUnit.gameObject.GetComponent <RotationBehavior>();
                    if (rotationBehavior3 == null)
                    {
                        rotationBehavior3 = tempUnit.gameObject.AddComponent <RotationBehavior>();
                    }
                    rotationBehavior3.SetFollowObj(parentUnit.mTransform, vector, 0f);
                }
                break;
            }

            case 6:
            {
                float   param  = data.param4;
                float   num    = 0.0174532924f * data.param5;
                float   param2 = data.param6;
                Vector3 zero   = Vector3.zero;
                Vector3 vector2;
                BornUnitAction.GetModelPoint(data, out vector2, out zero);
                float x = Mathf.Sin(num) * param;
                float z = Mathf.Cos(num) * param;
                vector2 = new Vector3(x, vector2.y, z);
                zero    = new Vector3(0f, num, 0f);
                tempUnit.SetPosition(parentUnit.mTransform.position + vector2, false);
                tempUnit.mTransform.rotation = Quaternion.Euler(parentUnit.mTransform.eulerAngles + zero);
                if (flag)
                {
                    EffectFollowBehavior effectFollowBehavior4 = tempUnit.gameObject.GetComponent <EffectFollowBehavior>();
                    if (effectFollowBehavior4 == null)
                    {
                        effectFollowBehavior4 = tempUnit.gameObject.AddComponent <EffectFollowBehavior>();
                    }
                    effectFollowBehavior4.SetFollowObj(parentUnit.mTransform, vector2);
                }
                else if (flag2)
                {
                    RotationBehavior rotationBehavior4 = tempUnit.gameObject.GetComponent <RotationBehavior>();
                    if (rotationBehavior4 == null)
                    {
                        rotationBehavior4 = tempUnit.gameObject.AddComponent <RotationBehavior>();
                    }
                    rotationBehavior4.speed = param2;
                    rotationBehavior4.SetFollowObj(parentUnit.mTransform, vector2, 0f);
                }
                break;
            }

            case 7:
                if (targets == null)
                {
                    return;
                }
                if (targets.Count == 0)
                {
                    return;
                }
                if (targets[0].mTransform == null)
                {
                    ClientLogger.Error("targets[0].mTransform == null  targets[0]=" + targets[0].name);
                    return;
                }
                if (tempUnit == null)
                {
                    return;
                }
                tempUnit.SetPosition(targets[0].mTransform.position, false);
                tempUnit.mTransform.rotation = targets[0].mTransform.rotation;
                if (flag)
                {
                    EffectFollowBehavior effectFollowBehavior5 = tempUnit.gameObject.GetComponent <EffectFollowBehavior>();
                    if (effectFollowBehavior5 == null)
                    {
                        effectFollowBehavior5 = tempUnit.gameObject.AddComponent <EffectFollowBehavior>();
                    }
                    effectFollowBehavior5.SetFollowObj(targets[0].mTransform, Vector3.zero);
                }
                else if (flag2)
                {
                    RotationBehavior rotationBehavior5 = tempUnit.gameObject.GetComponent <RotationBehavior>();
                    if (rotationBehavior5 == null)
                    {
                        rotationBehavior5 = tempUnit.gameObject.AddComponent <RotationBehavior>();
                    }
                    rotationBehavior5.SetFollowObj(targets[0].mTransform, Vector3.zero, 0f);
                }
                break;
            }
        }