예제 #1
0
    private void NonStaticCreateFx(int fxIndex, Vector3 position, Quaternion rotation)
    {
        var gob = GobPool.Instantiate(Fx[fxIndex]);

        gob.transform.position = position;
        gob.transform.rotation = rotation;
    }
예제 #2
0
    private void ShootBullet()
    {
        GameObject b  = GobPool.Instantiate(bulletPrefab);
        Bullet     bc = b.GetComponent <Bullet>();

        b.transform.SetPositionAndRotation(gunBarrel.position, gunBarrel.rotation);
        bc.Start();
        bc.Velocity = gunBarrel.forward * 30 + velocity;
        bc.wobble   = 0;
        if (gunPower / maxGunPower > gunWaveThreshold)
        {
            bc.wobble = 0.5f;
        }
        if (gunPower / maxGunPower > gunSpreadThreshold)
        {
            bc.wobble = 1;
            b         = GobPool.Instantiate(bulletPrefab);
            bc        = b.GetComponent <Bullet>();
            b.transform.SetPositionAndRotation(gunBarrel.position, gunBarrel.rotation * Quaternion.FromToRotation(Vector3.forward, new Vector3(0, 0.25f, 0.75f)));
            bc.Start();
            bc.Velocity = b.transform.forward * 30 + velocity;
            bc.wobble   = 0.5f;

            b  = GobPool.Instantiate(bulletPrefab);
            bc = b.GetComponent <Bullet>();
            b.transform.SetPositionAndRotation(gunBarrel.position, gunBarrel.rotation * Quaternion.FromToRotation(Vector3.forward, new Vector3(0, -0.25f, 0.75f)));
            bc.Start();
            bc.Velocity = b.transform.forward * 30 + velocity;
            bc.wobble   = 0.5f;
        }
    }
예제 #3
0
    void SpawnBird()
    {
        GameObject gob = GobPool.Instantiate(birdPrefab);

        gob.transform.SetPositionAndRotation(transform.position, transform.rotation);
        BirdDriver bd = gob.GetComponent <BirdDriver>();

        if (bd)
        {
            bd.Start();
        }
    }
예제 #4
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag.Equals("PlayerBullet"))
     {
         GobPool.Destroy(other.gameObject);
         DataDump.SetInt("BirdsKilled", DataDump.GetInt("BirdsKilled") + 1);
         var df = GobPool.Instantiate(deadFacade);
         df.transform.SetPositionAndRotation(transform.position, Quaternion.identity);
         Doomed();
     }
     if (other.tag.Equals("Player"))
     {
         DataDump.SetInt("BirdsKilled", DataDump.GetInt("BirdsKilled") + 1);
         other.GetComponent <ShipDriver>().TakeDamage(1);
         var df = GobPool.Instantiate(deadFacade);
         df.transform.SetPositionAndRotation(transform.position, Quaternion.identity);
         Doomed();
     }
 }
예제 #5
0
    private void Update()
    {
        stateTimer -= Time.deltaTime;
        if (stateTimer < 0)
        {
            switch (state)
            {
            case State.Wave:
                stateTimer = 15;
                spawnWave.SetActive(true);
                spawnBomb.SetActive(false);
                state = State.Bombers;
                break;

            case State.Bombers:
                stateTimer = 15;
                spawnWave.SetActive(false);
                spawnBomb.SetActive(true);
                state = State.Rest;
                break;

            case State.Rest:
                stateTimer = 10;
                spawnWave.SetActive(false);
                spawnBomb.SetActive(false);
                state = State.Wave;
                break;
            }
        }
        if (hpSpawns * 100 > bossHP)
        {
            hpSpawns--;
            var gob = GobPool.Instantiate(hpDrop);
            gob.transform.SetPositionAndRotation(transform.position, transform.rotation);
        }
    }