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); }
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(); } } } }
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(); } } } }
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(); } } } }
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(); } } } }
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(); } } } }
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; } }
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; } }
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 = m_targetSpellAnimation; //GameObject.Find("bigzhangjiao (1)").transform; bullet.effectObj = damageEffect1; bullet.bulleting(); } if (damageEffect1 != null) { GameObject obj = GameObject.Instantiate(damageEffect1); ParticlesEffect effect = obj.AddComponent <ParticlesEffect>(); //Transform target = GameObject.Find("bigzhangjiao (1)").transform; effect.transform.position = m_targetSpellAnimation.position; //MathUtil.findChild(m_target, "attackedPivot").position; effect.play(); } //c.attacked(); break; case AnimationName.Magic: if (magicBullet != null) { GameObject obj = GameObject.Instantiate(magicBullet); NormalBullet bullet = obj.GetComponent <NormalBullet>(); bullet.player = transform; bullet.target = m_targetSpellAnimation; //GameObject.Find("bigzhangjiao (1)").transform; bullet.effectObj = damageEffect1; bullet.bulleting(); } if (damageEffect3 != null) { GameObject obj = GameObject.Instantiate(damageEffect3); ParticlesEffect effect = obj.AddComponent <ParticlesEffect>(); //Transform target = GameObject.Find("bigzhangjiao (1)").transform; effect.transform.position = m_targetSpellAnimation.position; //MathUtil.findChild(m_target, "attackedPivot").position; effect.play(); } //c.attacked(); break; case AnimationName.Magic2: if (magic2Bullet != null) { GameObject obj = GameObject.Instantiate(magic2Bullet); NormalBullet bullet = obj.GetComponent <NormalBullet>(); bullet.player = transform; bullet.target = m_targetSpellAnimation; //GameObject.Find("bigzhangjiao (1)").transform; bullet.effectObj = damageEffect2; bullet.bulleting(); } if (damageEffect2 != null) { GameObject obj = GameObject.Instantiate(damageEffect2); ParticlesEffect effect = obj.AddComponent <ParticlesEffect>(); effect.transform.position = m_targetSpellAnimation.position; //GameObject.Find("bigzhangjiao (1)").transform.position; effect.play(); } //c.attacked(); break; case AnimationName.Ultimate: if (ultimateBullet != null) { GameObject obj = GameObject.Instantiate(ultimateBullet); LightBullet bullet = obj.GetComponent <LightBullet>(); bullet.player = transform; bullet.target = m_targetSpellAnimation; //GameObject.Find("bigzhangjiao (1)").transform; bullet.effectObj = damageEffect3; bullet.bulleting(); } if (damageEffect2 != null) { GameObject obj = GameObject.Instantiate(damageEffect2); ParticlesEffect effect = obj.AddComponent <ParticlesEffect>(); effect.transform.position = m_targetSpellAnimation.position; //GameObject.Find("bigzhangjiao (1)").transform.position; effect.play(); } //c.attacked(); break; } }
void preAction(string actionName) { 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 = damageEffect1; bullet.bulleting(); } 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 (ultimateBullet != null) { GameObject obj = GameObject.Instantiate(ultimateBullet); LightBullet bullet = obj.GetComponent <LightBullet>(); bullet.player = transform; bullet.target = GameObject.Find("bigzhangjiao (1)").transform; bullet.effectObj = damageEffect3; bullet.bulleting(); } if (damageEffect3 != null) { GameObject obj = GameObject.Instantiate(damageEffect3); ParticlesEffect effect = obj.AddComponent <ParticlesEffect>(); effect.transform.position = GameObject.Find("bigzhangjiao (1)").transform.position; effect.play(); StartCoroutine(delayAttacked()); } break; } }