Ejemplo n.º 1
0
    IEnumerator delayBullet2()
    {
        int   count = 10;
        float angle = -5 / 2f * 10f;

        for (int i = 0; i < count; i++)
        {
            GameObject obj    = GameObject.Instantiate(magicBullet);
            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.º 2
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.º 3
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.º 4
0
    IEnumerator delayAttacked()
    {
        yield return(new WaitForSeconds(1.5f));

        AttackedController1 c = GameObject.Find("bigzhangjiao (1)").GetComponent <AttackedController1>();

        c.attacked();
        //yield return new WaitForSeconds(2.5f);
        //c.attacked();
    }
Ejemplo n.º 5
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.º 6
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;
        }
    }