void ClearBlock(GameBlock block, bool score) { if (block == SelectedBlock) { SelectBlock(null, null); } if (block.IsAnimating) { CurrentState = GameState.Selecting; } if (score) { // Collect Powerups if (block.PowerupId.HasValue) { if (block.PowerupId.Value == GameBlock.Powerup.BoardClear) { Flier.Spawn(block.PowerupSprite, block.transform.position, BoardClearTransform.position, BoardClearTransform.gameObject, 1, Flier.AudioToPlay.ItemCollect); } else if (block.PowerupId.Value == GameBlock.Powerup.TimeStop) { Flier.Spawn(block.PowerupSprite, block.transform.position, TimeStopTransform.position, TimeStopTransform.gameObject, 1, Flier.AudioToPlay.ItemCollect); } } Flier.Spawn(block.BlockSprite, block.transform.position, ScoreTransform.position, ScoreTransform.gameObject, (collector.Count > 3) ? ScorePerBlock * (collector.Count - 2) : ScorePerBlock, Flier.AudioToPlay.BlockCollect ); } CloudPuff.Spawn(block.transform.position); GameBlock.Despawn(block); }
public static CloudPuff Spawn(Vector3 position) { // Attempt to use pooled smoke tmp = null; for (int i = 0; i < Pool.Count; i++) { if (Pool[i] != null && !Pool[i].gameObject.activeSelf) { tmp = Pool[i]; tmp.gameObject.SetActive(true); tmp.InitializeFromPool(position); return(tmp); } } // Create a new smoke tmp = (CloudPuff)Instantiate(prefab); tmp.InitializeFromPool(position); Pool.Add(tmp); return(tmp); }
public static void Despawn(CloudPuff puff) { puff.gameObject.SetActive(false); }