Beispiel #1
0
    public void ShootBullet()
    {
        MultiplyingBullet b = Game_Manager.instance.enemyBulletPool.GetPooledObject <MultiplyingBullet>();

        b.currentCloneID     = 0;
        b.bulletPool         = Game_Manager.instance.enemyBulletPool;
        b.transform.position = transform.position;
        b.transform.forward  = player.position - transform.position;
        SoundManager.instance.PlayShoot2();
    }
Beispiel #2
0
    private void Update()
    {
        Collider[] collisions = hitBox.UpdateHitBox();

        if (collisions != null && collisions.Length > 0)
        {
            for (int i = 0; i < collisions.Length; i++)
            {
                IDamageable hit = collisions[i].GetComponent <IDamageable>();
                if (hit != null)
                {
                    hit.ApplyDamage(hitBox, attackData);
                }
                else
                {
                    if (currentCloneID < maxCloneLevel)
                    {
                        MultiplyingBullet b1 = bulletPool.GetPooledObject <MultiplyingBullet>();
                        MultiplyingBullet b2 = bulletPool.GetPooledObject <MultiplyingBullet>();

                        b1.currentCloneID = b2.currentCloneID = currentCloneID + 1;
                        b1.bulletPool     = b2.bulletPool = bulletPool;

                        b1.transform.position = b2.transform.position = transform.position;
                        b1.transform.rotation = b2.transform.rotation = transform.rotation;

                        b1.transform.Rotate(0, 180 - angleVariation, 0);
                        b2.transform.Rotate(0, 180 + angleVariation, 0);

                        b1.transform.position += b1.transform.forward * 1;
                        b2.transform.position += b2.transform.forward * 1;
                    }
                }
            }

            hitBox.CloseCollision();
            Transform fx = Game_Manager.instance.bulletDeathPool.GetPooledObject().transform;
            fx.position = transform.position;
            gameObject.SetActive(false);
        }
    }