public void UpdatePosition(Board board, Directions Direction) { BaseBlock block = this.GetNeighbour(Direction); if (block == null || block.blockCanBeConsumed) { this.MoveTo(Direction); } if (block != null && block.blockCanBeConsumed) { if (block is HeartBlock) { board.HeartsTaken++; Sounds.Instance.PlayEffect(SoundType.Heart); } if (block is ExitBlock) { Sounds.Instance.PlayEffect(SoundType.LevelFinish); } if (!(block is HeartBlock)) { Sounds.Instance.PlayEffect(SoundType.SnowShuffeld); } board.RemoveBlock(block); } if (block != null && block.blockCanBePushed && ((Direction == Directions.East && block.GetNeighbour(Directions.East) == null) || (Direction == Directions.West && block.GetNeighbour(Directions.West) == null))) { this.MoveTo(Direction); block.MoveTo(Direction); } }
public void AddBlock(BaseBlock Block) { Block._board = this; if (Block is HeartBlock) { HeartsToComplete++; } _blocks.Add(Block); }
public void AddBlock(BaseBlock Block) { Block._board = this; if (Block is HeartBlock) { HeartsToComplete++; } _blocks.Add(Block); }
public virtual bool GeneratePhysics() { BaseBlock block = this.GetNeighbour(Directions.South); if (block == null) { this.MoveTo(Directions.South); isFalling = true; return(false); } else { if (block is PlayerBlock && this.isFalling) { block.ExplodeNeighbour(Directions.None); //_board.GetBombSound().Play(); } if ((block.doFall && !block.isFalling) || (block.othersFallFrom)) { if (this.GetNeighbour(Directions.East) == null && this.GetNeighbour(Directions.SouthEast) == null && (this.GetNeighbour(Directions.NorthEast) == null || !this.GetNeighbour(Directions.NorthEast).doFall)) { this.MoveTo(Directions.East); isFalling = true; return(false); } if (this.GetNeighbour(Directions.West) == null && this.GetNeighbour(Directions.SouthWest) == null && (this.GetNeighbour(Directions.NorthWest) == null || !this.GetNeighbour(Directions.NorthWest).doFall)) { this.MoveTo(Directions.West); isFalling = true; return(false); } } } isFalling = false; return(true); }
public void RemoveBlock(BaseBlock block) { _blocks.Remove(block); }
public void RemoveBlock(BaseBlock block) { _blocks.Remove(block); }