Beispiel #1
0
    public override void Effect()
    {
        //不飘字
        calculateDamage = false;

        base.Effect();

        //animator.speed = 0;

        int missCount = 0;

        float timeline = 0;

        for (int i = 0; i < other.Count; i++)
        {
            var o = other[i];

            //侧边
            if ((int)Vector3.Angle((o.position - character.position).normalized, character.forward) % 90 != 0)
            {
                timeline = timeline + 0.3f;
                //确定两边
                GameObject go = null;
                GameController.GetInstance().Invoke(() => { go = CreateMesh(character.position, o.position); }, timeline);
                if (DamageSystem.Miss(character, o, skillRate))
                {
                    GameController.GetInstance().Invoke(() => {
                        var mat = go.GetComponentInChildren <MeshRenderer>().material;
                        CreateTween(mat, "_TilingY", 0f, 1f);

                        DebugLogPanel.GetInstance().Log("Miss");

                        GameController.GetInstance().Invoke(() => { GameObject.Destroy(go); }, 1f);
                    }, timeline + 1);
                    missCount++;
                }
                else
                {
                    GameController.GetInstance().Invoke(() => {
                        var point = CreatePoint(o);
                        var shadowSimulationBuff = new ShadowSimulationBuff(duration, point.transform, go.transform);
                        o.GetComponent <Unit>().Buffs.Add(shadowSimulationBuff);
                        shadowSimulationBuff.Apply(o);
                    }, timeline + 1);
                }
            }
            else
            {
                GameObject go = CreateLine(character.position, o.position);

                if (DamageSystem.Miss(character, o, skillRate))
                {
                    GameController.GetInstance().Invoke(() => {
                        var mat = go.GetComponentInChildren <MeshRenderer>().material;
                        CreateTween(mat, "_TilingY", 0f, 1f);

                        DebugLogPanel.GetInstance().Log("Miss");
                        GameController.GetInstance().Invoke(() => { GameObject.Destroy(go); }, 1f);
                    }, 1);
                    missCount++;
                }
                else
                {
                    GameController.GetInstance().Invoke(() => {
                        var point = CreatePoint(o);
                        var shadowSimulationBuff = new ShadowSimulationBuff(duration, point.transform, go.transform);
                        o.GetComponent <Unit>().Buffs.Add(shadowSimulationBuff);
                        shadowSimulationBuff.Apply(o);
                    }, 1);
                }
            }
        }

        var selfPoint = CreatePoint(character);

        if (missCount == other.Count)
        {
            GameController.GetInstance().Invoke(() => {
                var meshes = character.GetComponentsInChildren <SkinnedMeshRenderer>();

                //开启原本阴影
                foreach (var m in meshes)
                {
                    m.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On;
                }

                var mat = selfPoint.GetComponentInChildren <MeshRenderer>().material;

                CreateTween(mat, "_N_mask", 0f, 1f);
            }, 2f);
        }
        else
        {
            //有命中的敌人的时候,也给自身施加禁止buff
            var buff = new ShadowSimulationBuff(duration, selfPoint.transform);
            character.GetComponent <Unit>().Buffs.Add(buff);
            GameController.GetInstance().Invoke(() => { buff.Apply(character); }, timeline + 2.5f);//稍微比动画晚0.5s
        }

        GameController.GetInstance().Invoke(() => { animator.SetTrigger("EndSkill"); }, timeline + 2);
    }