void Awake() { instance = this; #if !UNITY_EDITOR forceEditorLowRes = false; #endif if (GameObjectsPool.IsLowRes || forceEditorLowRes) { targetTileBreakEffectPrefab = lowTileBreakEffectPrefab; targetTileBreakEffectMaterials = lowTileBreakEffectMaterials; } else { targetTileBreakEffectPrefab = tileBreakEffectPrefab; targetTileBreakEffectMaterials = tileBreakEffectMaterials; } // Setup each type of tile break effect for each require material type and cache the particle system instances based on the material. for (int i = 0; i < tileBreakEffectMaterials.Length; i++) { TileBreakEffectController breakEffectInstance = (Instantiate(targetTileBreakEffectPrefab) as GameObject).GetComponent <TileBreakEffectController>(); breakEffectInstance.UpdateTileRenderersMaterial(targetTileBreakEffectMaterials[i]); ParticleSystemManager.Instance.CacheParticleSystem(breakEffectInstance.gameObject, true); // Add particle system to objects pool. objectsPool.Add(tileBreakEffectMaterials[i], breakEffectInstance.gameObject); } }
public static void InitWorld() { GameObjectsPool.Clear(); Stats.CansEatten = 0; creationTime = DateTime.Now; var topWall = new Wall( new Vector(0, View.Height + 10), new Vector(View.Width, View.Height + 10)); var bottomWall = new Wall( new Vector(0, -10), new Vector(View.Width, -10)); var leftWall = new Wall( new Vector(-10, View.Height), new Vector(-10, 0)); var RightWall = new Wall( new Vector(View.Width + 10, View.Height), new Vector(View.Width + 10, 0)); GameObjectsPool.Add(topWall); GameObjectsPool.Add(bottomWall); GameObjectsPool.Add(leftWall); GameObjectsPool.Add(RightWall); var can = new PetrolCan(); can.Translate(new Vector(200, 200)); GameObjectsPool.Add(can); SpawnCar(); }
void Awake() { instance = this; #if !UNITY_EDITOR forceEditorLowRes = false; #endif if ( GameObjectsPool.IsLowRes || forceEditorLowRes ) { targetTileBreakEffectPrefab = lowTileBreakEffectPrefab; targetTileBreakEffectMaterials = lowTileBreakEffectMaterials; } else { targetTileBreakEffectPrefab = tileBreakEffectPrefab; targetTileBreakEffectMaterials = tileBreakEffectMaterials; } // Setup each type of tile break effect for each require material type and cache the particle system instances based on the material. for(int i = 0; i < tileBreakEffectMaterials.Length; i++) { TileBreakEffectController breakEffectInstance = (Instantiate(targetTileBreakEffectPrefab) as GameObject).GetComponent<TileBreakEffectController>(); breakEffectInstance.UpdateTileRenderersMaterial(targetTileBreakEffectMaterials[i]); ParticleSystemManager.Instance.CacheParticleSystem(breakEffectInstance.gameObject, true); // Add particle system to objects pool. objectsPool.Add(tileBreakEffectMaterials[i], breakEffectInstance.gameObject); } }
public RocketLauncher(IRocketLauncherOwner rocketLauncherOwner) { _rocketLauncherOwner = rocketLauncherOwner; _cachedRocketsPool = rocketLauncherOwner.RocketsPool; _cachedOwnerTransform = rocketLauncherOwner.RocketLauncherOwner.transform; _spendTimeFromLastAttack = rocketLauncherOwner.ReloadDelayInSeconds; }
private static void SpawnCar() { var car = new Car(); car.Translate(new Vector(100, 100)); GameObjectsPool.Add(car); currentCar = car; }
private void Start() { for (int i = 0; i < poolTemplates.Count; i++) { var gameObjectsPool = new GameObjectsPool(poolTemplates[i].TemplatePrefab, poolTemplates[i].AmountToPool, poolTemplates[i].TemplateTagName); pools.Add(poolTemplates[i].TemplateTagName, gameObjectsPool); } }
internal PlayerController( IPlayerInput input, GameObject camera, IManagedPerson managedPerson) { _managedPerson = managedPerson; _input = input; _camera = camera.GetComponent <Camera>(); _pathMarkPool = new GameObjectsPool <PathMarksFabric>( new PathMarksFabric(), _marksPoolSize); }
private GameObjectsPool GetPullByPrefab(GameObject prefab) { if (!_pools.ContainsKey(prefab)) { GameObjectsPool pool = Instantiate(GameObjectsPool); pool.Prefab = prefab; _pools.Add(prefab, pool); } return(_pools[prefab]); }
private static void LoadSave() { var save = JsonSerializer.Deserialize <GameSave>(File.ReadAllText("save.json")); StartNewGame(); GameObjectsPool.Clear(); GameObjectsPool.AddRange(save.cans); GameObjectsPool.AddRange(save.cars); GameObjectsPool.AddRange(save.cones); Stats.CansEatten = save.cansEatten; creationTime = save.creation; View.InitSlips(new Bitmap(Image.FromFile("slips.bmp"))); }
public void AddCompanyIndicator(IIndicator indicator) { if (_companyPools.Count < _currentPoolIndex + 1) { return; } GameObjectsPool pool = _companyPools[_currentPoolIndex]; GameObject indObject = pool.GetInstance(); IndicatorContainer ic = indObject.GetComponent <IndicatorContainer>(); if (ic != null) { ic.InitContainer(indicator); _currentPoolIndex++; _currentPoolIndex = _currentPoolIndex % _companyPools.Count; } }
public void Initialize() { _bombsPool = new GameObjectsPool <BombFabricTemplate>( new BombFabricTemplate(), _poolSize); }