public override bool ActivateEffect(IBallController ball) { if (ball.GetObjectiveType() == tileModel.GetObjectiveType() && !effectActivated) { ActivateEffect(true); return(true); } else if (effectActivated && ball.GetObjectiveType() != tileModel.GetObjectiveType()) { ActivateEffect(false); return(true); } return(false); }
private bool AddObjectivesToFill() { for (int x = 0; x < model.Width; x++) { for (int y = 0; y < model.Height; y++) { IBallController ball = model.GetBrick(x, y); TileController tile = model.GetTile(x, y); if (ball.GetObjectiveType() != ObjectiveType.NONE && ball.GetObjectiveType() == tile.GetObjectiveType()) { BallFillObjectiveCommand command = new BallFillObjectiveCommand(this, ball, tile); PrepareBrickFillObjective(command); } } } return(objectiveCommands.Count > 0); }
public override void Execute() { if (tile.TryFillTile()) { turn.objectivesFilled.Add(ball.GetObjectiveType()); wasUseful = true; ball.FinishedAnimating += new EmptyEventHandler(RaiseFinishedExecuting); //GameObject.FindGameObjectWithTag(Tags.LevelController).GetComponent<LevelManager>().NotifyFilledObjective(tile.GetObjectiveType()); ball.FillObjective(); } else { RaiseFinishedExecuting(); } }
public static BoardData GetBoardData(BoardPosition[,] board) { BoardData data = new BoardData(); int X_SIZE = board.GetLength(0); int Y_SIZE = board.GetLength(1); data.balls = new BallData[X_SIZE, Y_SIZE]; data.tiles = new TileData[X_SIZE, Y_SIZE]; for (int x = 0; x < X_SIZE; x++) { for (int y = 0; y < Y_SIZE; y++) { IBallController ball = board[x, y].ball; TileController tile = board[x, y].tile; data.balls[x, y] = new BallData(ball.GetBallType(), ball.GetObjectiveType()); data.tiles[x, y] = new TileData(tile.GetObjectiveType(), tile.tileType); } } return(data); }