private void AdjustPlane(IEnumerable <Vector3Int> planeDirection) { bool toAdd = false; foreach (Vector3Int nextCoordinate in planeDirection) { // Remove voxels in the negative X-direction if (toAdd == false) { if (CreatedVoxels.ContainsKey(nextCoordinate) == true) { PoolingManager.ReturnToPool(CreatedVoxels[nextCoordinate]); CreatedVoxels.Remove(nextCoordinate); } if (CreatedCollectables.ContainsKey(nextCoordinate) == true) { PoolingManager.ReturnToPool(CreatedCollectables[nextCoordinate]); CreatedCollectables.Remove(nextCoordinate); } } else if (toAdd == true) { // Add voxels in the positive X-direction AddVoxel(nextCoordinate); } toAdd = !toAdd; } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player") == true) { PlayerMove player = PlayerMove.GetPlayer(other); if (player != null) { player.CollectibleSound.Play(); Singleton.Get <CameraManager>().Effects.FlashOnce(flashScreenColor); Singleton.Get <TimeManager>().HitPause(); } if (Logs != null) { Logs.GetNextLog(); } PoolingManager.ReturnToPool(this); } }
/// <summary> /// /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public Block RemoveBlock(int x, int y) { Block oldBlock = null; if (IsValidGridPosition(x, y) == true) { // Check if there's a block in this location already oldBlock = Blocks[x, y]; if (oldBlock != null) { // If there is, return this block to the pool oldBlock.ResetPosition(); PoolingManager.ReturnToPool(oldBlock); Blocks[x, y] = null; } } return(oldBlock); }
private IEnumerator FadeEffect() { Renderer[] components = _shotObject.GetComponentsInChildren <Renderer>(); foreach (Renderer r in components) { r.material.mainTexture = null; } foreach (Color c in destructionColors) { foreach (Renderer r in components) { r.material.color = c; } yield return(new WaitForSeconds(waitBetweenColors)); } _poolingManager.ReturnToPool(_shotObject); }
IEnumerator DisableAfter(float seconds) { yield return(new WaitForSeconds(seconds)); PoolingManager.ReturnToPool(this); }