Exemple #1
0
        public static GameObject Create(BulletConfig config)
        {
            GameObject bulletObject = new GameObject("Bullet");

            bulletObject.hideFlags = HideFlags.HideInHierarchy;
            AddConcreteBulletComponent(bulletObject, config.bulletType);

            return(bulletObject);
        }
        public BulletSpawner(BulletConfig config, Transform inactiveBulletParent)
        {
            GameObject bulletBlueprintObject = BulletObjectCreator.Create(config);
            BulletBase bullet = bulletBlueprintObject.GetComponent <BulletBase>();

            bullet.Initialize(config);
            _pool = new PrefabPool(bulletBlueprintObject, inactiveBulletParent, config.poolPrewarm,
                                   config.poolIncreaseStep);

            bulletBlueprintObject.SetActive(false);
        }