Ejemplo n.º 1
0
    IEnumerator delayBullet()
    {
        int count = 20;

        for (int i = 0; i < count; i++)
        {
            AttackedController c      = GameObject.Find("bigzhangjiao (1)").GetComponent <AttackedController>();
            GameObject         obj    = GameObject.Instantiate(ultimateBullet);
            CurvelBullet       bullet = obj.GetComponent <CurvelBullet>();
            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);
                    ParticlesEffect effect = obj1.AddComponent <ParticlesEffect>();
                    Transform       target = GameObject.Find("bigzhangjiao (1)").transform;
                    effect.transform.position = MathUtil.findChild(target, "attackedPivot").position;
                    effect.play();
                }
            }
        }
    }
Ejemplo n.º 2
0
    protected virtual void complete()
    {
        if (target == null)
        {
            GameObject.Destroy(gameObject);
            return;
        }
        AttackedController c = target.GetComponent <AttackedController>();

        if (c != null)
        {
            c.attacked();
        }
        stopParticle();
        if (effectObj != null)
        {
            GameObject      obj    = GameObject.Instantiate(effectObj);
            ParticlesEffect effect = obj.AddComponent <ParticlesEffect>();
            if (effectPos == 0)
            {
                effect.transform.position = MathUtil.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++)
        {
            GameObject   obj    = GameObject.Instantiate(rbullet);
            RotateBullet bullet = obj.GetComponent <RotateBullet>();
            bullet.player    = transform;
            bullet.effectObj = damageEffect1;
            bullet.bulleting();
            bullet.y    = 0.7f;
            bullet.flag = -1f;
            yield return(new WaitForSeconds(0.1f));

            if (i % 9 == 0)
            {
                AttackedController c = GameObject.Find("bigzhangjiao (1)").GetComponent <AttackedController>();
                c.attacked();
                if (damageEffect2 != null)
                {
                    GameObject      obj1   = GameObject.Instantiate(damageEffect2);
                    ParticlesEffect effect = obj1.AddComponent <ParticlesEffect>();
                    Transform       target = GameObject.Find("bigzhangjiao (1)").transform;
                    effect.transform.position = MathUtil.findChild(target, "attackedPivot").position;
                    effect.play();
                }
            }
        }
    }
Ejemplo n.º 4
0
    IEnumerator delayBullet1()
    {
        int   count = 20;
        float angle = -count / 2f * 5f;

        for (int i = 0; i < count; i++)
        {
            GameObject obj    = GameObject.Instantiate(ultimateBullet);
            PosBullet  bullet = obj.GetComponent <PosBullet>();
            bullet.player    = transform;
            bullet.tarPos    = MathUtil.calcTargetPosByRotation(transform, angle + i * 10f, 10f);
            bullet.effectObj = damageEffect1;
            bullet.bulleting();
            yield return(new WaitForSeconds(0.1f));

            if (i % 9 == 0)
            {
                AttackedController c = GameObject.Find("bigzhangjiao (1)").GetComponent <AttackedController>();
                c.attacked();
                if (damageEffect2 != null)
                {
                    GameObject      obj1   = GameObject.Instantiate(damageEffect2);
                    ParticlesEffect effect = obj1.AddComponent <ParticlesEffect>();
                    Transform       target = GameObject.Find("bigzhangjiao (1)").transform;
                    effect.transform.position = MathUtil.findChild(target, "attackedPivot").position;
                    effect.play();
                }
            }
        }
    }
Ejemplo n.º 5
0
    IEnumerator delayBullet()
    {
        int count            = 10;
        AttackedController c = GameObject.Find("bigzhangjiao (1)").GetComponent <AttackedController>();

        for (int i = 0; i < count; i++)
        {
            GameObject obj    = GameObject.Instantiate(attackBullet);
            PosBullet  bullet = obj.GetComponent <PosBullet>();
            bullet.player = transform;
            Vector3 newPos      = c.transform.position + new Vector3(Random.Range(-5f, 5f), Random.Range(2f, 5f), Random.Range(-5f, 5f));
            Vector3 attackedPos = MathUtil.findChild(c.transform, "attackedPivot").position;
            bullet.startPos  = MathUtil.calcTargetPosByRotation(attackedPos, Quaternion.LookRotation(newPos - c.transform.position), 0f, 5f);
            bullet.tarPos    = attackedPos - bullet.startPos + attackedPos;
            bullet.effectObj = damageEffect1;
            bullet.bulleting();
            yield return(null);

            if (i % 9 == 0)
            {
                c.attacked();
                if (damageEffect2 != null)
                {
                    GameObject      obj1   = GameObject.Instantiate(damageEffect2);
                    ParticlesEffect effect = obj1.AddComponent <ParticlesEffect>();
                    Transform       target = GameObject.Find("bigzhangjiao (1)").transform;
                    effect.transform.position = MathUtil.findChild(target, "attackedPivot").position;
                    effect.play();
                }
            }
        }
    }
Ejemplo n.º 6
0
    IEnumerator delayBullet()
    {
        int count = 30;

        for (int i = 0; i < count; i++)
        {
            GameObject obj    = GameObject.Instantiate(ultimateBullet);
            PosBullet  bullet = obj.GetComponent <PosBullet>();
            bullet.player = transform;
            AttackedController c       = GameObject.Find("bigzhangjiao (1)").GetComponent <AttackedController>();
            Vector3            basePos = transform.position + c.transform.position;
            basePos        /= 2f;
            basePos.y      -= 3f;
            bullet.startPos = basePos;
            float padding = 5f;
            basePos         += new Vector3(Random.Range(-padding, padding), 0f, Random.Range(-padding, padding));
            bullet.tarPos    = basePos += new Vector3(0f, 10f, 0f);
            bullet.effectObj = damageEffect1;
            bullet.bulleting();
            yield return(null);

            if (i % 9 == 0)
            {
                c.attacked();
                if (damageEffect2 != null)
                {
                    GameObject      obj1   = GameObject.Instantiate(damageEffect2);
                    ParticlesEffect effect = obj1.AddComponent <ParticlesEffect>();
                    Transform       target = GameObject.Find("bigzhangjiao (1)").transform;
                    effect.transform.position = MathUtil.findChild(target, "attackedPivot").position;
                    effect.play();
                }
            }
        }
    }
Ejemplo n.º 7
0
    void preAction(string actionName)
    {
        AttackedController c = GameObject.Find("bigzhangjiao (1)").GetComponent <AttackedController>();

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

        switch (name)
        {
        case AnimationName.Attack:
            if (attackBullet != null)
            {
                GameObject   obj    = GameObject.Instantiate(attackBullet);
                NormalBullet bullet = obj.GetComponent <NormalBullet>();
                bullet.player    = transform;
                bullet.target    = GameObject.Find("bigzhangjiao (1)").transform;
                bullet.effectObj = damageEffect1;
                bullet.bulleting();
            }
            break;

        case AnimationName.Magic:
            if (magicBullet != null)
            {
                GameObject   obj    = GameObject.Instantiate(magicBullet);
                NormalBullet bullet = obj.GetComponent <NormalBullet>();
                bullet.player    = transform;
                bullet.target    = GameObject.Find("bigzhangjiao (1)").transform;
                bullet.effectObj = damageEffect2;
                bullet.bulleting();
            }
            StartCoroutine(delayBullet());
            StartCoroutine(delayBullet1());
            break;

        case AnimationName.Magic2:
            if (magic2Bullet != null)
            {
                GameObject   obj    = GameObject.Instantiate(magic2Bullet);
                NormalBullet bullet = obj.GetComponent <NormalBullet>();
                bullet.player    = transform;
                bullet.target    = GameObject.Find("bigzhangjiao (1)").transform;
                bullet.effectObj = damageEffect2;
                bullet.bulleting();
            }
            break;

        case AnimationName.Ultimate:
            if (damageEffect3 != null)
            {
                GameObject      obj1   = GameObject.Instantiate(damageEffect3);
                ParticlesEffect effect = obj1.AddComponent <ParticlesEffect>();
                Transform       target = GameObject.Find("bigzhangjiao (1)").transform;
                effect.transform.position = MathUtil.findChild(target, "attackedPivot").position;
                effect.play();
            }
            c.attacked();
            break;
        }
    }
Ejemplo n.º 8
0
    void preAction(string actionName)
    {
        AttackedController c = GameObject.Find("bigzhangjiao (1)").GetComponent <AttackedController>();

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

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

        case AnimationName.Magic:
            if (damageEffect2 != null)
            {
                GameObject      obj    = GameObject.Instantiate(damageEffect2);
                ParticlesEffect effect = obj.AddComponent <ParticlesEffect>();
                Transform       target = GameObject.Find("bigzhangjiao (1)").transform;
                effect.transform.position = MathUtil.findChild(target, "attackedPivot").position;
                effect.play();
            }
            c.attacked();
            break;

        case AnimationName.Magic2:
            if (damageEffect2 != null)
            {
                GameObject      obj    = GameObject.Instantiate(damageEffect2);
                ParticlesEffect effect = obj.AddComponent <ParticlesEffect>();
                Transform       target = GameObject.Find("bigzhangjiao (1)").transform;
                effect.transform.position = MathUtil.findChild(target, "attackedPivot").position;
                effect.play();
            }
            c.attacked();
            break;

        case AnimationName.Ultimate:

            if (damageEffect3 != null)
            {
                GameObject      obj    = GameObject.Instantiate(damageEffect3);
                ParticlesEffect effect = obj.AddComponent <ParticlesEffect>();

                effect.transform.position = GameObject.Find("bigzhangjiao (1)").transform.position;
                effect.transform.rotation = Quaternion.Euler(0f, -111f, 0f);
                effect.play();
            }
            c.attacked();
            break;
        }
    }
Ejemplo n.º 9
0
    IEnumerator delayBullet()
    {
        yield return(new WaitForSeconds(2f));

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

        c.attacked();
    }
Ejemplo n.º 10
0
    IEnumerator delayBullet()
    {
        AttackedController c = GameObject.Find("bigzhangjiao (1)").GetComponent <AttackedController>();
        int count            = 10;

        for (int i = 0; i < count; i++)
        {
            GameObject      obj    = GameObject.Instantiate(ultimateBullet);
            xuanzhuanBullet bullet = obj.GetComponent <xuanzhuanBullet>();
            bullet.player    = transform;
            bullet.effectObj = damageEffect1;
            bullet.target    = c.transform;
            bullet.bulleting();
            yield return(new WaitForSeconds(0.1f));

            if (i % 9 == 0)
            {
                c.attacked();
            }
        }
    }
Ejemplo n.º 11
0
	// Use this for initialization
	void Start () {
		audioSource = GetComponent<AudioSource>();
		attackedController = GetComponent<AttackedController>();
	}