/// <summary> /// A function that will handle the input of the player and use it accordingly /// </summary> /// <param name="eVirtualKey">Keybaord input</param> /// <param name="cellObject">The object that the player controls</param> public static void HandleInput(VirtualKey eVirtualKey, ICellObject cellObject) { switch (Game.Instance.CurrentGameState) { case Game.GameState.Movement: if (IsDirectional(eVirtualKey)) { MoveCellObject(cellObject, Game.Instance.CurrentArea, eVirtualKey); } else { InteractWithCellObject(cellObject, Game.Instance.CurrentArea); } break; case Game.GameState.Dialog: //TODO add dialog controls break; case Game.GameState.Combat: //TODO Add combat controls break; case Game.GameState.Menu: //TODO add menu controls break; } }
/// <summary> /// A function to try to interact with the cells around the player /// </summary> /// <param name="cellObject">The object that you control</param> /// <param name="area">The area the object is in</param> public static void InteractWithCellObject(ICellObject cellObject, Area area) { int xPos = cellObject.Position.x; int yPos = cellObject.Position.y; if (!CheckIfNextCellIsPassable(xPos - 1, yPos, area)) { TriggerEventHandlerInNextCellObject(xPos - 1, yPos, area, GameEvent.EventTypes.Interaction); } if (!CheckIfNextCellIsPassable(xPos + 1, yPos, area)) { TriggerEventHandlerInNextCellObject(xPos + 1, yPos, area, GameEvent.EventTypes.Interaction); } if (!CheckIfNextCellIsPassable(xPos, yPos - 1, area)) { TriggerEventHandlerInNextCellObject(xPos, yPos - 1, area, GameEvent.EventTypes.Interaction); } if (!CheckIfNextCellIsPassable(xPos, yPos + 1, area)) { TriggerEventHandlerInNextCellObject(xPos, yPos + 1, area, GameEvent.EventTypes.Interaction); } }
private Image PrepareImageFromCellObject(ICellObject cellObject) { Image img = cellObject.Sprite.SpriteImage; img.Width = cellSize * cellObject.CellWidth; img.Height = cellSize * cellObject.CellHeight; return(img); }
public void resetArea() { Area = new Area(); int areaWidth = 20; int areaHeight = 14; Area.SetAreaGrid(areaWidth, areaHeight); Area.BackgroundCellObject = CellObjectFactory.Build(CellObjectType.Grass); Area.AreaMusic = new MediaHandler("new_bark_town.mp3"); //Area.AreaMusic = new MediaHandler(""); ICellObject N = CellObjectFactory.Build(CellObjectType.Npc); ICellObject E = CellObjectFactory.Build(CellObjectType.Enemy); ICellObject S = CellObjectFactory.Build(CellObjectType.SmallHouse); ICellObject M = CellObjectFactory.Build(CellObjectType.MediumHouse); ICellObject B = CellObjectFactory.Build(CellObjectType.BigHouse); ICellObject T = CellObjectFactory.Build(CellObjectType.Tree); ICellObject V = CellObjectFactory.Build(CellObjectType.Merchant); ICellObject R = CellObjectFactory.Build(CellObjectType.Sign); ICellObject F = CellObjectFactory.Build(CellObjectType.Flower); ICellObject P = new Portal(RouteOne.Instance.Area, (30, 7), GameEvent.EventTypes.Enter, true, RouteOne.Instance); ICellObject p = new Portal(RouteOne.Instance.Area, (30, 8), GameEvent.EventTypes.Enter, true, RouteOne.Instance); ICellObject e = new Portal(ElmsLab.Instance.Area, (5, 7), GameEvent.EventTypes.Collision, true, ElmsLab.Instance); ICellObject _ = null; ICellObject x = null; ICellObject I = null; ICellObject[][] area = { // 1 10 20 // 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 new ICellObject[] { T, T, T, T, T, T, B, x, x, x, x, x, T, T, T, T, T, T, T, T }, //1 new ICellObject[] { I, I, I, I, I, I, x, _, _, _, _, x, I, I, I, I, I, I, I, I }, //2 new ICellObject[] { T, T, T, F, F, F, x, _, _, _, _, x, _, _, M, x, x, x, T, T }, //3 new ICellObject[] { I, I, _, F, _, _, x, x, e, x, x, x, _, _, x, _, _, x, I, I }, //4 new ICellObject[] { T, T, _, _, _, _, N, _, _, _, _, _, _, _, x, _, _, x, _, T }, //5 new ICellObject[] { I, I, _, _, _, _, _, _, _, _, _, _, _, R, x, x, x, x, _, I }, //6 new ICellObject[] { P, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, T }, //7 new ICellObject[] { p, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, E, _, _, I }, //8 new ICellObject[] { T, T, T, T, S, x, x, x, _, _, _, _, _, _, _, _, _, _, T, T }, //9 new ICellObject[] { I, I, I, I, x, x, x, x, _, _, _, _, S, x, x, x, _, _, I, I }, //10 new ICellObject[] { T, T, _, V, _, _, _, _, _, _, _, _, x, x, x, x, _, _, T, T }, //11 new ICellObject[] { I, I, _, _, _, _, _, _, _, _, _, _, _, _, F, _, _, _, I, I }, //12 new ICellObject[] { T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T }, //13 new ICellObject[] { I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I } //14 }; for (int i = 0; i < areaHeight; i++) { for (int j = 0; j <= areaWidth - 1; j++) { if (area[i][j] != null) { Area.SetCellObjectGridPosition(j + 1, i + 1, area[i][j]); } } } }
public static void SetCellObjectCopyProps(ICellObject original, ICellObject copy) { copy.Sprite = original.Sprite; copy.IsPassable = original.IsPassable; copy.Position = original.Position; copy.EventTriggers = original.EventTriggers; copy.CellWidth = original.CellWidth; copy.CellHeight = original.CellHeight; }
public void resetArea() { Area = new Area(); int areaWidth = 30; int areaHeight = 12; Area.SetAreaGrid(areaWidth, areaHeight); Area.BackgroundCellObject = CellObjectFactory.Build(CellObjectType.Grass); Area.AreaMusic = new MediaHandler("route_one.mp3"); //Area.AreaMusic = new MediaHandler(""); ICellObject N = CellObjectFactory.Build(CellObjectType.Npc); ICellObject E = CellObjectFactory.Build(CellObjectType.Enemy); ICellObject S = CellObjectFactory.Build(CellObjectType.SmallHouse); ICellObject M = CellObjectFactory.Build(CellObjectType.MediumHouse); ICellObject B = CellObjectFactory.Build(CellObjectType.BigHouse); ICellObject T = CellObjectFactory.Build(CellObjectType.Tree); ICellObject H = CellObjectFactory.Build(CellObjectType.FancyHouse); ICellObject F = CellObjectFactory.Build(CellObjectType.Flower); ICellObject P = new Portal(NewBarkTown.Instance.Area, (1, 7), GameEvent.EventTypes.Enter, true, NewBarkTown.Instance); ICellObject p = new Portal(NewBarkTown.Instance.Area, (1, 8), GameEvent.EventTypes.Enter, true, NewBarkTown.Instance); ICellObject _ = null; ICellObject x = null; ICellObject I = null; ICellObject[][] area = { // 1 10 20 30 // 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 new ICellObject[] { T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T }, //1 new ICellObject[] { I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I }, //2 new ICellObject[] { T, T, T, T, T, T, T, T, H, x, x, x, x, _, _, _, _, _, T, T, T, T, T, T, T, T, T, T, T, T }, //3 new ICellObject[] { I, I, I, I, I, I, I, I, x, _, _, _, x, _, _, _, F, _, I, I, I, I, I, I, I, I, I, I, I, I }, //4 new ICellObject[] { T, _, F, F, F, F, _, _, x, _, _, _, x, _, _, F, _, _, _, _, _, _, _, _, _, _, _, _, _, T }, //5 new ICellObject[] { I, _, F, F, F, F, _, _, x, x, x, x, x, _, _, _, _, _, _, _, _, _, _, F, _, _, _, _, _, I }, //6 new ICellObject[] { T, _, F, F, F, F, _, _, _, _, _, _, _, _, _, _, _, F, _, _, _, _, _, _, _, _, _, _, _, P }, //7 new ICellObject[] { I, _, _, _, _, _, _, _, _, _, _, _, _, _, F, _, _, _, _, _, _, _, _, _, _, F, _, _, _, p }, //8 new ICellObject[] { T, _, _, F, _, _, _, _, _, _, _, _, F, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, T }, //9 new ICellObject[] { I, _, _, _, _, _, _, _, F, _, _, _, _, _, _, _, _, F, F, F, F, _, _, _, _, _, _, _, _, I }, //10 new ICellObject[] { T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T }, //11 new ICellObject[] { I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I }, //12 }; for (int i = 0; i < areaHeight; i++) { for (int j = 0; j <= areaWidth - 1; j++) { if (area[i][j] != null) { Area.SetCellObjectGridPosition(j + 1, i + 1, area[i][j]); } } } }
// row and column span is how many cells the object should span over. rowSpan=1 columnSpan=2 will create a 1x2 object public void InsertCellObject(ICellObject cellObject, int xPos, int yPos, int rowSpan, int columnSpan) { var game = Game.Instance; Image img = PrepareImageFromCellObject(cellObject); SetImageGridProperties(img, xPos, yPos, rowSpan, columnSpan); if (!MainGrid.Children.Contains(img)) { MainGrid.Children.Add(img); } }
public void resetArea() { Area = new Area(); int areaWidth = 10; int areaHeight = 7; Area.SetAreaGrid(areaWidth, areaHeight); Area.BackgroundCellObject = CellObjectFactory.Build(CellObjectType.Floor); Area.AreaMusic = new MediaHandler("shop.mp3"); ICellObject N = CellObjectFactory.Build(CellObjectType.Npc); ICellObject L = CellObjectFactory.Build(CellObjectType.LabThing); ICellObject B = CellObjectFactory.Build(CellObjectType.Bookshelf); ICellObject R = CellObjectFactory.Build(CellObjectType.Rug); ICellObject P = new Portal(NewBarkTown.Instance.Area, (9, 5), GameEvent.EventTypes.Enter, true, NewBarkTown.Instance); ICellObject _ = null; ICellObject x = null; ICellObject[][] area = { // 1 10 // 1 2 3 4 5 6 7 8 9 0 new ICellObject[] { _, B, x, _, _, _, _, _, _, _ }, //1 new ICellObject[] { _, _, _, _, N, _, _, _, _, _ }, //2 new ICellObject[] { _, B, x, _, _, _, _, L, x, _ }, //3 new ICellObject[] { _, _, _, _, _, _, _, _, _, _ }, //4 new ICellObject[] { _, _, _, _, _, _, _, _, _, _ }, //5 new ICellObject[] { L, x, _, _, _, _, _, _, _, _ }, //6 new ICellObject[] { _, _, _, _, P, P, _, _, _, _ }, //7 }; for (int i = 0; i < areaHeight; i++) { for (int j = 0; j <= areaWidth - 1; j++) { if (area[i][j] != null) { Area.SetCellObjectGridPosition(j + 1, i + 1, area[i][j]); } } } //Placing a rug over the portal Area.SetCellObjectGridPosition(5, 7, R); }
/// <summary> /// Places an object in the grid /// </summary> /// <param name="xCoordinate">X coordinates</param> /// <param name="yCoordinate">Y Coordinates</param> /// <param name="cellObject">The object to placed in the grid</param> public void SetCellObjectGridPosition(int xCoordinate, int yCoordinate, ICellObject cellObject) { if (!GameObjects.Contains(cellObject)) { GameObjects.Add(cellObject); } if (Width < xCoordinate + cellObject.CellWidth - 1) { throw new System.ArgumentOutOfRangeException("(xCoordinate + cellWidth - 1) is out of range."); } if (Height < yCoordinate + cellObject.CellHeight - 1) { throw new System.ArgumentOutOfRangeException("(yCoordinate + cellHeight - 1) is out of range."); } if (AreaGrid.Length > 0) { AreaGrid[xCoordinate - 1][yCoordinate - 1].CellObjects.Add(cellObject); //if cell objects are larger than 1x1 we insert invisible cells in the empty places //for each column we add an empty cell for (int width = 1; width <= cellObject.CellWidth; width++) { //skip first cell since it is created above if (width != 1) { AreaGrid[xCoordinate - 2 + width][yCoordinate - 1].CellObjects.Add(new EmptyCell(cellObject.EventTriggers)); } // for each row we add an empty cell for (int height = 1; height < cellObject.CellHeight; height++) { AreaGrid[xCoordinate - 2 + width][yCoordinate - 1 + height].CellObjects.Add(new EmptyCell(cellObject.EventTriggers)); } } } if (cellObject is IPlayableCharacter) { cellObject.Position = (xCoordinate, yCoordinate); } }
public void FillBoardWithOneCellObject(ICellObject cellObject) { var area = Game.Instance.CurrentArea; if (cellObject == null) { return; } //for each column for (int x = 0; x < area.Width; x++) { //for each row for (int y = 0; y < area.Height; y++) { // a new instance of background-object needs to be created in order to place it in the view more than once cellObject.SetSprite(); InsertCellObject(cellObject, x, y, cellObject.CellHeight, cellObject.CellWidth); } } }
/// <summary> /// A function to send the keyboard input to the right classes based on what state the game is in /// </summary> /// <param name="eVirtualKey">Keyboard input</param> /// <param name="cellObject">The object that is going to me manipulated</param> public static void HandleInput(VirtualKey eVirtualKey, ICellObject cellObject) { switch (Game.Instance.CurrentGameState) { case Game.GameState.Movement: Movement.HandleInput(eVirtualKey, cellObject); break; case Game.GameState.Dialog: //TODO add logic break; case Game.GameState.Combat: //TODO add logic break; case Game.GameState.Menu: //TODO add logic break; } }
private static void ExplodeLevelFive(int row, int col, int n, IGameInstance battleField, ICellObject explodedFieldCell) { ExplodeLevelFour(row, col, n, battleField, explodedFieldCell); if (row - 2 >= 0 && col - 2 >= 0) { battleField.Field[row - 2, col - 2] = explodedFieldCell; } if (row - 2 >= 0 && col < n - 2) { battleField.Field[row - 2, col + 2] = explodedFieldCell; } if (row < n - 2 && col - 2 >= 0) { battleField.Field[row + 2, col - 2] = explodedFieldCell; } if (row < n - 2 && col < n - 2) { battleField.Field[row + 2, col + 2] = explodedFieldCell; } }
protected override void Awake() { base.Awake(); CellObject = GetComponentInterface <ICellObject>(); houseController = GetComponentInParent <HouseController>(); }
public FirstArea() { Area = new Area(); // Set how many cells the area should have int areaWidth = 30; int areaHeight = 12; Area.SetAreaGrid(areaWidth, areaHeight); // Set a sprite that will fill the entire board Area.BackgroundCellObject = CellObjectFactory.Build(CellObjectType.Grass); // Upload a tune to the assets folder and play it when the player enters the area Area.AreaMusic = new MediaHandler("firstAreaMusic.mp3"); // To easily build an area, you can bind each object you plan to use on the screen in a single character // variable. You can then draw the board using code like below. Cell objects with "null" will be empty. // since some objects are larger than one cell you can place empty variables in the spaces they occupy to make // readability easier. // If you want to place more than one object in a cell you can either place it into the code like so: // Area.SetCellObjectGridPosition(8,8,cellObject); // Or draw a new area with another two dimentional array and place it on top of the other one // To move to a new area you can create a portal and select the new area like below. instead of "FirstArea" you can // enter the area the portal shall lead to, the start position, how the event will be triggered and if the cell // can be stepped on // ICellObject P = new Portal(SecondArea.Instance.Area, (1,7), GameEvent.EventTypes.Enter, true); ICellObject T = CellObjectFactory.Build(CellObjectType.Tree); ICellObject _ = null; // "I" represents the lower side of a tree ICellObject I = null; // hero position is decided in the game initializer or when traveling. // the x shows where the hero will be placed according to the initializer ICellObject x = null; // Objects are placed in their top left part in the grid. // If a 2x4 object is placed at at the 1x1 space, 1x2, 1x3, 1x4, 2x2, 2x3, and 2x4 will be ocupied ICellObject[][] area = { // 1 10 20 30 // 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 new ICellObject[] { T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T }, //1 new ICellObject[] { I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I }, //2 new ICellObject[] { T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T }, //3 new ICellObject[] { I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I }, //4 new ICellObject[] { T, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, T }, //5 new ICellObject[] { I, _, _, _, _, x, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, I }, //6 new ICellObject[] { T, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, T }, //7 new ICellObject[] { I, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, I }, //8 new ICellObject[] { T, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, T }, //9 new ICellObject[] { I, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, I }, //10 new ICellObject[] { T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T }, //11 new ICellObject[] { I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I } //12 }; // Can't touch this for (int i = 0; i < areaHeight; i++) { for (int j = 0; j <= areaWidth - 1; j++) { if (area[i][j] != null) { Area.SetCellObjectGridPosition(j + 1, i + 1, area[i][j]); } } } /* * * ,-===-. _ * :__ __: (#) * ______ [__]=[__] \\ _ * '---___) ) (| c_) |) ((\( 3 )) * / / |.-=_=-.| \ \ * / / \ \_/ / \ \ * / /__.------`---'------.__\ \ * / \ \ # / / \ * `-------\ \#/ /-------' )) \ / --- / \ |o / \ |o / \ |o / \ ______ >-----<_______ \ (( \ / \ / \ / \ .-------. / \ \ / / \ \ / / \ __\___\ /___/__ \ '----^-' '-^----' )) \ */ }
public Cell() { Content = VoidCell.Instance; }
/// <summary> /// A function used to move a character in different directions based on user input /// </summary> /// <param name="cellObject">The object that is supposed to be moved</param> /// <param name="area">What area the object is in</param> /// <param name="direction">Keyboard input that determines the direction to move</param> public static void MoveCellObject(ICellObject cellObject, Area area, VirtualKey direction) { var originalXCoordinate = cellObject.Position.x; var originalYCoordinate = cellObject.Position.y; var nextXCoordinate = originalXCoordinate; var nextYCoordinate = originalYCoordinate; switch (direction) { case VirtualKey.Left: if (originalXCoordinate > 1) { if (CheckIfNextCellIsPassable(nextXCoordinate - 1, nextYCoordinate, area)) { nextXCoordinate--; } else { TriggerEventHandlerInNextCellObject(nextXCoordinate - 1, nextYCoordinate, area, GameEvent.EventTypes.Collision); } } break; case VirtualKey.Up: if (originalYCoordinate > 1) { if (CheckIfNextCellIsPassable(nextXCoordinate, nextYCoordinate - 1, area)) { nextYCoordinate--; } else { TriggerEventHandlerInNextCellObject(nextXCoordinate, nextYCoordinate - 1, area, GameEvent.EventTypes.Collision); } } break; case VirtualKey.Down: if (originalYCoordinate < area.AreaGrid[0].Length) { if (CheckIfNextCellIsPassable(nextXCoordinate, nextYCoordinate + 1, area)) { nextYCoordinate++; } else { TriggerEventHandlerInNextCellObject(nextXCoordinate, nextYCoordinate + 1, area, GameEvent.EventTypes.Collision); } } break; case VirtualKey.Right: if (originalXCoordinate < area.AreaGrid.Length) { if (CheckIfNextCellIsPassable(nextXCoordinate + 1, nextYCoordinate, area)) { nextXCoordinate++; } else { TriggerEventHandlerInNextCellObject(nextXCoordinate + 1, nextYCoordinate, area, GameEvent.EventTypes.Collision); } } break; default: return; } // cellobject has moved if (nextXCoordinate != originalXCoordinate || nextYCoordinate != originalYCoordinate) { } area.AreaGrid[originalXCoordinate - 1][originalYCoordinate - 1].CellObjects?.Remove(cellObject); area.AreaGrid[nextXCoordinate - 1][nextYCoordinate - 1].CellObjects.Add(cellObject); cellObject.Position = (nextXCoordinate, nextYCoordinate); TriggerEventHandlerInNextCellObject(nextXCoordinate, nextYCoordinate, area, GameEvent.EventTypes.Enter); }
protected override void Awake () { base.Awake (); CellObject = GetComponentInterface<ICellObject>(); houseController = GetComponentInParent<HouseController>(); }
private static void ExplodeLevelTwo(int row, int col, int n, IGameInstance battleField, ICellObject explodedFieldCell) { ExplodeLevelOne(row, col, n, battleField, explodedFieldCell); if (row - 1 >= 0) { battleField.Field[row - 1, col] = explodedFieldCell; } if (col - 1 >= 0) { battleField.Field[row, col - 1] = explodedFieldCell; } if (col < n - 1) { battleField.Field[row, col + 1] = explodedFieldCell; } if (row < n - 1) { battleField.Field[row + 1, col] = explodedFieldCell; } }
private static void ExplodeLevelThree(int row, int col, int n, IGameInstance battleField, ICellObject explodedFieldCell) { ExplodeLevelTwo(row, col, n, battleField, explodedFieldCell); if (row - 2 >= 0) { battleField.Field[row - 2, col] = explodedFieldCell; } if (col - 2 >= 0) { battleField.Field[row, col - 2] = explodedFieldCell; } if (col < n - 2) { battleField.Field[row, col + 2] = explodedFieldCell; } if (row < n - 2) { battleField.Field[row + 2, col] = explodedFieldCell; } }
private static void ExplodeLevelOne(int row, int col, int n, IGameInstance battleField, ICellObject explodedFieldCell) { if (row - 1 >= 0 && col - 1 >= 0) { battleField.Field[row - 1, col - 1] = explodedFieldCell; } if (row - 1 >= 0 && col < n - 1) { battleField.Field[row - 1, col + 1] = explodedFieldCell; } if (row < n - 1 && col - 1 > 0) { battleField.Field[row + 1, col - 1] = explodedFieldCell; } if (row < n - 1 && col < n - 1) { battleField.Field[row + 1, col + 1] = explodedFieldCell; } battleField.Field[row, col] = explodedFieldCell; }
/// <summary> /// задает новый объект для ячейки /// </summary> public Cell SetObject(ICellObject obj) { _cellObject = obj; return(this); }
private static void ExplodeLevelFour(int row, int col, int n, IGameInstance battleField, ICellObject explodedFieldCell) { ExplodeLevelThree(row, col, n, battleField, explodedFieldCell); if (row - 2 >= 0 && col - 1 >= 0) { battleField.Field[row - 2, col - 1] = explodedFieldCell; } if (row - 2 >= 0 && col < n - 1) { battleField.Field[row - 2, col + 1] = explodedFieldCell; } if (row - 1 >= 0 && col - 2 >= 0) { battleField.Field[row - 1, col - 2] = explodedFieldCell; } if (row - 1 >= 0 && col < n - 2) { battleField.Field[row - 1, col + 2] = explodedFieldCell; } if (row < n - 1 && col - 2 >= 0) { battleField.Field[row + 1, col - 2] = explodedFieldCell; } if (row < n - 1 && col < n - 2) { battleField.Field[row + 1, col + 2] = explodedFieldCell; } if (row < n - 2 && col - 1 > 0) { battleField.Field[row + 2, col - 1] = explodedFieldCell; } if (row < n - 2 && col < n - 1) { battleField.Field[row + 2, col + 1] = explodedFieldCell; } }