Example #1
0
    // #################
    // ## Methods     ##
    // #################

    void Awake()
    {
        InitSingleton();
        ValidateConfig();
        LoadPrefabs();
        cubesWallHandler.Initialize();
        gunHandler.Initialize();
    }
    public void InitializeGun(GunHandler handler)
    {
        GunObject gun = handler.gun;

        handler.gameObject.SetActive(true);
        handler.Initialize();

        if (gun.shootType == GunObject.GunType.rigidbody && gun.rigidbodyBullet)
        {
            ObjectPool bulletPool = getFromPool(gun, gun.rigidbodyBullet, ref bulletPools);
            handler.SetBulletPool(bulletPool.getPool);
        }

        if (gun.impactEffect == null)
        {
            return;
        }
        ObjectPool impactPool = getFromPool(gun, gun.impactEffect, ref impactPools);

        handler.SetImpactPool(impactPool.getPool);
    }