Ejemplo n.º 1
0
        private async void DelayBullet1()
        {
            const int count = 10;

            for (var i = 0; i < count; i++)
            {
                var bullet = Instantiate(_magic2Bullet);
                bullet.player = transform;
                bullet.target = _target;

                bullet.bulleting();
                await UniTask.Delay(1);

                if (i % 9 != 0)
                {
                    continue;
                }
                bullet.effectObj = _damageEffect1;
                if (_damageEffect2 == null)
                {
                    continue;
                }
                var effect = Instantiate(_damageEffect2);
                effect.transform.position = MathUtil1.findChild(_target, "attackedPivot").position;
                effect.play();
            }
        }
Ejemplo n.º 2
0
        private void preAction(string actionName)
        {
            var arr  = actionName.Split('|');
            var name = arr[0];

            switch (name)
            {
            case AnimationName.Attack:
                DelayBullet1();
                break;

            case AnimationName.Magic:
                DelayBullet2();
                break;

            case AnimationName.Magic2:
                break;

            case AnimationName.Ultimate:
                if (_damageEffect3 != null)
                {
                    var effect = Instantiate(_damageEffect3);
                    effect.transform.position = MathUtil1.findChild(_target, "attackedPivot").position;
                    effect.play();
                }
                DelayBullet3();
                break;
            }
        }
Ejemplo n.º 3
0
    void updateLineRender()
    {
        float speed = 1.2f;

        if (color > 0)
        {
            color -= speed * Time.deltaTime;
        }

        for (int i = 0; i < lineRenderArr.Length; i++)
        {
            lineRenderArr[i].SetPosition(0, MathUtil1.findChild(player, "attackPivot").position);
            lineRenderArr[i].SetPosition(1, MathUtil1.findChild(target, "attackedPivot").position);
            if (i == 0)
            {
                Color c = new Color(1, 1, 1, color);
                lineRenderArr[i].startColor = c;
                lineRenderArr[i].endColor   = c;
            }
            else
            {
                Color c = new Color(1, 1, 1, color);
                lineRenderArr[i].startColor = c;
                lineRenderArr[i].endColor   = c;
            }
        }

        if (color <= speed)
        {
            base.complete();
            GameObject.Destroy(gameObject);
        }
    }
Ejemplo n.º 4
0
    IEnumerator delayBullet1()
    {
        int count = 10;

        for (int i = 0; i < count; i++)
        {
            AttackedController1 c      = GameObject.Find("bigzhangjiao (1)").GetComponent <AttackedController1>();
            GameObject          obj    = GameObject.Instantiate(magic2Bullet);
            CurvelBullet2       bullet = obj.GetComponent <CurvelBullet2>();
            bullet.player = transform;
            bullet.target = c.transform;

            bullet.bulleting();
            yield return(null);

            if (i % 9 == 0)
            {
                bullet.effectObj = damageEffect1;
                c.attacked();
                if (damageEffect2 != null)
                {
                    GameObject       obj1   = GameObject.Instantiate(damageEffect2);
                    ParticlesEffect1 effect = obj1.AddComponent <ParticlesEffect1>();
                    Transform        target = GameObject.Find("bigzhangjiao (1)").transform;
                    effect.transform.position = MathUtil1.findChild(target, "attackedPivot").position;
                    effect.play();
                }
            }
        }
    }
Ejemplo n.º 5
0
    protected virtual void complete()
    {
        if (target == null)
        {
            GameObject.Destroy(gameObject);
            return;
        }
        AttackedController1 c = target.GetComponent <AttackedController1>();

        if (c != null)
        {
            c.attacked();
        }
        stopParticle();
        if (effectObj != null)
        {
            GameObject       obj    = GameObject.Instantiate(effectObj);
            ParticlesEffect1 effect = obj.AddComponent <ParticlesEffect1>();
            if (effectPos == 0)
            {
                effect.transform.position = MathUtil1.findChild(target, "attackedPivot").position;
            }
            else
            {
                effect.transform.position = target.position;
            }
            effect.play();
        }
        GameObject.Destroy(gameObject);
    }
Ejemplo n.º 6
0
        private async void DelayBullet3()
        {
            const int   count = 20;
            const float angle = -10 / 2f * 10f;

            for (var i = 0; i < count; i++)
            {
                var bullet = Instantiate(_ultimateBullet);
                bullet.player    = transform;
                bullet.startPos  = transform.position + new Vector3(0f, 0.01f, 0f);
                bullet.tarPos    = MathUtil1.calcTargetPosByRotation(transform, angle + i * 10f, 10f);
                bullet.effectObj = _damageEffect1;
                bullet.bulleting();
                await UniTask.Delay(1);

                if (i % 6 != 0)
                {
                    continue;
                }
                if (_damageEffect2 == null)
                {
                    continue;
                }
                var effect = Instantiate(_damageEffect2);
                effect.transform.position = MathUtil1.findChild(_target, "attackedPivot").position;
                effect.play();
            }
        }
Ejemplo n.º 7
0
    IEnumerator delayBullet3()
    {
        int   count = 20;
        float angle = -10 / 2f * 10f;

        for (int i = 0; i < count; i++)
        {
            GameObject obj    = GameObject.Instantiate(ultimateBullet);
            PosBullet1 bullet = obj.GetComponent <PosBullet1>();
            bullet.player    = transform;
            bullet.startPos  = transform.position + new Vector3(0f, 0.01f, 0f);
            bullet.tarPos    = MathUtil1.calcTargetPosByRotation(transform, angle + i * 10f, 10f);
            bullet.effectObj = damageEffect1;
            bullet.bulleting();
            yield return(new WaitForSeconds(0.015f));

            if (i % 6 == 0)
            {
                AttackedController1 c = GameObject.Find("bigzhangjiao (1)").GetComponent <AttackedController1>();
                c.attacked();
                if (damageEffect2 != null)
                {
                    GameObject       obj1   = GameObject.Instantiate(damageEffect2);
                    ParticlesEffect1 effect = obj1.AddComponent <ParticlesEffect1>();
                    Transform        target = GameObject.Find("bigzhangjiao (1)").transform;
                    effect.transform.position = MathUtil1.findChild(target, "attackedPivot").position;
                    effect.play();
                }
            }
        }
    }
Ejemplo n.º 8
0
        private void preAction(string actionName)
        {
            var arr  = actionName.Split('|');
            var name = arr[0];

            switch (name)
            {
            case AnimationName.Attack:
                if (_attackBullet != null)
                {
                    var bullet = Instantiate(_attackBullet);
                    bullet.player    = transform;
                    bullet.target    = _target;
                    bullet.effectObj = _damageEffect1;
                    bullet.bulleting();
                }
                break;

            case AnimationName.Magic:
                if (_attackBullet != null)
                {
                    var bullet = Instantiate(_attackBullet);
                    bullet.player    = transform;
                    bullet.target    = _target;
                    bullet.effectObj = _damageEffect1;
                    bullet.bulleting();
                }
                break;

            case AnimationName.Magic2:
                if (_attackBullet != null)
                {
                    var bullet = Instantiate(_attackBullet);
                    bullet.player    = transform;
                    bullet.target    = _target;
                    bullet.effectObj = _damageEffect2;
                    bullet.bulleting();
                }
                break;

            case AnimationName.Ultimate:
                if (_ultimateBullet != null)
                {
                    DelayBullet();
                    DelayBullet1();
                }

                if (_damageEffect3 != null)
                {
                    var effect = Instantiate(_damageEffect3);
                    effect.transform.position = MathUtil1.findChild(_target, "attackedPivot").position;
                    effect.play();
                }
                break;
            }
        }
Ejemplo n.º 9
0
    public override void bulleting()
    {
        base.bulleting();
        Vector3 attackPos = MathUtil1.findChild(player, "attackPivot").position;

        transform.position = attackPos;
        stopParticle();
        addLineRender();
        StartCoroutine(delayBulleting());
    }
Ejemplo n.º 10
0
    IEnumerator delayBulleting()
    {
        yield return(null);

        bulletState = BulletState1.line;
        Vector3 attackPos = MathUtil1.findChild(player, "attackPivot").position;

        transform.position = attackPos;
        startParticle();
    }
Ejemplo n.º 11
0
    public override void bulleting()
    {
        base.bulleting();
        Vector3 attackPos = MathUtil1.findChild(player, "attackPivot").position;

        transform.position = attackPos;
        Vector3 attackedPos = MathUtil1.findChild(target, "attackedPivot").position;

        transform.forward = attackedPos - transform.position;
        stopParticle();
        StartCoroutine(delayBulleting());
    }
Ejemplo n.º 12
0
    public override void bulleting()
    {
        base.bulleting();
        Vector3 attackPos = Vector3.zero;

        if (startPos != Vector3.zero)
        {
            attackPos = startPos;
        }
        else
        {
            attackPos = MathUtil1.findChild(player, "attackPivot").position;
        }
        transform.position = attackPos;
        //stopParticle ();
        StartCoroutine(delayBulleting());
    }
Ejemplo n.º 13
0
    public override void bulleting()
    {
        base.bulleting();
        Vector3 attackPos = MathUtil1.findChild(player, "attackPivot").position;

        transform.position = attackPos;
        stopParticle();
        Vector3 attackedPos = MathUtil1.findChild(target, "attackedPivot").position;
        Vector3 pos1        = (attackedPos - transform.position) / 3 + transform.position;

        pos1.y += Random.Range(-1f, 2f);
        pos1   += new Vector3(Random.Range(-4f, 4f), 0f, Random.Range(-4f, 4f));
        Vector3 pos2 = 2f * (attackedPos - transform.position) / 3f + transform.position;

        pos2.y += Random.Range(0f, 1f);
        pos2   += new Vector3(Random.Range(-2f, 2f), 0f, Random.Range(-2f, 2f));
        b       = new beisaier1(transform.position, pos1, pos2, attackedPos);
        StartCoroutine(delayBulleting());
    }
Ejemplo n.º 14
0
    protected override void update()
    {
        if (bulletState == BulletState1.none)
        {
            return;
        }
        base.update();
        Vector3 attackedPos = MathUtil1.findChild(target, "attackedPivot").position;

        if (Vector3.SqrMagnitude(attackedPos - transform.position) <= speed * Time.deltaTime)
        {
            complete();
            return;
        }

        Vector3 pos = MathUtil1.calcTargetPosByDis(transform.position, attackedPos, speed * Time.deltaTime);

        transform.forward  = pos - transform.position;
        transform.position = pos;
    }
Ejemplo n.º 15
0
    protected override void update()
    {
        if (bulletState == BulletState1.none)
        {
            return;
        }
        base.update();
        Vector3 attackedPos = MathUtil1.findChild(target, "attackedPivot").position;

        time += Time.deltaTime * speed;
        if (time >= 1f)
        {
            complete();
            return;
        }
        Vector3 pos = b.GetPointAtTime(time);

        transform.forward  = pos - transform.position;
        transform.position = pos;
    }
Ejemplo n.º 16
0
    void preAction(string actionName)
    {
        AttackedController1 c = GameObject.Find("bigzhangjiao (1)").GetComponent <AttackedController1>();

        string[] arr  = actionName.Split('|');
        string   name = arr[0];

        switch (name)
        {
        case AnimationName1.Attack:
            if (damageEffect1 != null)
            {
                GameObject       obj    = GameObject.Instantiate(damageEffect1);
                ParticlesEffect1 effect = obj.AddComponent <ParticlesEffect1>();
                Transform        target = GameObject.Find("bigzhangjiao (1)").transform;
                effect.transform.position = MathUtil1.findChild(target, "attackedPivot").position;
                effect.play();
            }
            c.attacked();
            StartCoroutine(delayBullet1());
            break;

        case AnimationName1.Magic:
            StartCoroutine(delayBullet2());
            if (damageEffect1 != null)
            {
                GameObject       obj    = GameObject.Instantiate(damageEffect1);
                ParticlesEffect1 effect = obj.AddComponent <ParticlesEffect1>();
                Transform        target = GameObject.Find("bigzhangjiao (1)").transform;
                effect.transform.position = MathUtil1.findChild(target, "attackedPivot").position;
                effect.play();
            }
            c.attacked();

            break;

        case AnimationName1.Magic2:
            StartCoroutine(delayBullet2());
            if (damageEffect1 != null)
            {
                GameObject       obj    = GameObject.Instantiate(damageEffect1);
                ParticlesEffect1 effect = obj.AddComponent <ParticlesEffect1>();

                effect.transform.position = GameObject.Find("bigzhangjiao (1)").transform.position;
                effect.play();
            }
            c.attacked();
            break;

        case AnimationName1.Ultimate:
            StartCoroutine(delayBullet3());
            if (damageEffect2 != null)
            {
                GameObject       obj    = GameObject.Instantiate(damageEffect2);
                ParticlesEffect1 effect = obj.AddComponent <ParticlesEffect1>();

                effect.transform.position = GameObject.Find("bigzhangjiao (1)").transform.position;
                effect.play();
            }
            c.attacked();
            break;
        }
    }
Ejemplo n.º 17
0
    void preAction(string actionName)
    {
        AttackedController1 c = GameObject.Find("bigzhangjiao (1)").GetComponent <AttackedController1>();

        string[] arr  = actionName.Split('|');
        string   name = arr[0];

        switch (name)
        {
        case AnimationName1.Attack:
            if (damageEffect1 != null)
            {
                GameObject       obj    = GameObject.Instantiate(damageEffect1);
                ParticlesEffect1 effect = obj.AddComponent <ParticlesEffect1>();
                Transform        target = GameObject.Find("bigzhangjiao (1)").transform;
                effect.transform.position = MathUtil1.findChild(target, "attackedPivot").position;
                effect.play();
            }
            c.attacked();
            break;

        case AnimationName1.Magic:
            if (magicBullet != null)
            {
                GameObject    obj    = GameObject.Instantiate(magicBullet);
                NormalBullet3 bullet = obj.GetComponent <NormalBullet3>();
                bullet.player    = transform;
                bullet.target    = GameObject.Find("bigzhangjiao (1)").transform;
                bullet.effectObj = damageEffect1;
                bullet.bulleting();
            }
            if (damageEffect1 != null)
            {
                GameObject       obj    = GameObject.Instantiate(damageEffect1);
                ParticlesEffect1 effect = obj.AddComponent <ParticlesEffect1>();
                Transform        target = GameObject.Find("bigzhangjiao (1)").transform;
                effect.transform.position = MathUtil1.findChild(target, "attackedPivot").position;
                effect.play();
            }
            c.attacked();

            break;

        case AnimationName1.Magic2:
            if (magic2Bullet != null)
            {
                GameObject    obj    = GameObject.Instantiate(magic2Bullet);
                NormalBullet3 bullet = obj.GetComponent <NormalBullet3>();
                bullet.player    = transform;
                bullet.target    = GameObject.Find("bigzhangjiao (1)").transform;
                bullet.effectObj = damageEffect2;
                bullet.bulleting();
            }
            if (damageEffect1 != null)
            {
                GameObject       obj    = GameObject.Instantiate(damageEffect1);
                ParticlesEffect1 effect = obj.AddComponent <ParticlesEffect1>();

                effect.transform.position = GameObject.Find("bigzhangjiao (1)").transform.position;
                effect.play();
            }
            c.attacked();
            break;

        case AnimationName1.Ultimate:
            if (ultimateBullet != null)
            {
                GameObject    obj    = GameObject.Instantiate(ultimateBullet);
                NormalBullet3 bullet = obj.GetComponent <NormalBullet3>();
                bullet.player    = transform;
                bullet.target    = GameObject.Find("bigzhangjiao (1)").transform;
                bullet.effectObj = damageEffect2;
                bullet.bulleting();
            }
            if (damageEffect2 != null)
            {
                GameObject       obj    = GameObject.Instantiate(damageEffect2);
                ParticlesEffect1 effect = obj.AddComponent <ParticlesEffect1>();

                effect.transform.position = GameObject.Find("bigzhangjiao (1)").transform.position;
                effect.play();
            }
            c.attacked();
            break;
        }
    }