Ejemplo n.º 1
0
 public void GetInfo(Transform activePool, Transform inActivePool, GameObject o, TidalWave tidal)
 {
     ultimateActive   = activePool;
     ultimateInActive = inActivePool;
     owner            = o;
     tidalWave        = tidal;
 }
Ejemplo n.º 2
0
    IEnumerator makewaves()
    {
        HUB.S.PlaySound("Siren", 1f);
        tidalWaveWarning.SetActive(true);
        EventIndicator.Panels.SetPanel(0);
        yield return(new WaitForSeconds(2f));

        int rand = Random.Range(10, 20);

        HUB.S.PlaySound("TidalWaves", 1f);
        GameObject measurer = new GameObject();

        measurer.transform.position  = new Vector3(0, 0, 0);
        measurer.transform.rotation  = Quaternion.Euler(new Vector3(0f, 0f, Random.Range(0f, 360f)));
        measurer.transform.position += measurer.transform.up * 10f;
        print(measurer.transform.position);
        for (int c = 0; c < rand; ++c)
        {
            float      rnjesus = Random.Range(-5f, 5f);
            Vector3    slammer = measurer.transform.position + measurer.transform.right * rnjesus;
            GameObject g       = Instantiate(wave, new Vector3(slammer.x, slammer.y, 0f), transform.rotation) as GameObject;

            TidalWave tw  = g.GetComponent <TidalWave>();
            Vector3   dir = ((Vector3.zero + Vector3.up * Random.Range(-6f, 6f) + Vector3.right * Random.Range(-6f, 6f)) - g.transform.position);
            tw.direction = dir;
            g.GetComponent <Rigidbody2D>().velocity = dir * Random.Range(0.9f, 1.4f);
            float rot_z = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
            g.transform.rotation = Quaternion.Euler(0f, 0f, rot_z - 90f);
        }
        Destroy(measurer);
        tidalWaveWarning.SetActive(false);
    }