Ejemplo n.º 1
0
        public void AttackEvent(int i)
        {
            switch (i)
            {
            case 0:
                Attack_Arrow a0 = GameObject.Instantiate(attacks.attack, point.position, point.rotation);
                a0.Launch((target.GetPosition(Vector3.zero, Vector3.one) - point.position).normalized * UnityEngine.Random.Range(6f, 8f));
                break;

            case 1:
                StartCoroutine(Attack2Cor(target));
                attacks.prelude.gameObject.SetActive(false);
                attacks.launch.gameObject.SetActive(true);
                attacks.launch.Play();
                break;

            case 2:
                Attack_Arrow a2 = GameObject.Instantiate(attacks.attack, point.position, point.rotation);
                a2.GetComponent <Rigidbody>().useGravity = false;
                a2.Launch((target.position - a2.transform.position).normalized * 10f);
                attacks.prelude.gameObject.SetActive(false);
                attacks.launch.gameObject.SetActive(true);
                attacks.launch.Play();
                break;
            }
        }
Ejemplo n.º 2
0
 private IEnumerator Attack2Cor(Transform t)
 {
     for (int i = 0; i < 5f; i++)
     {
         int r = UnityEngine.Random.Range(8, 16);
         for (int _i = 0; _i < r; _i++)
         {
             Attack_Arrow a = GameObject.Instantiate(attacks.attack, transform.position + new Vector3(UnityEngine.Random.Range(-3f, 3f), 10f, UnityEngine.Random.Range(-3f, 3f)), Quaternion.identity);
             a.transform.LookAt(t.GetPosition(Vector3.zero, Vector3.one * 8f));
             a.Launch(a.transform.forward * UnityEngine.Random.Range(4f, 7f));
         }
         yield return(new WaitForSeconds(0.3f));
     }
 }