/// <summary> /// Refreshes the surrounding insects move positions /// </summary> /// <param name="insect"></param> static void UpdateSurroundingInsects(Insect insect) { // Update the surrounding insects after the move insect.TopInsect?.UpdateMovePositions(Grid, Insects); insect.RightInsect?.UpdateMovePositions(Grid, Insects); insect.DownInsect?.UpdateMovePositions(Grid, Insects); insect.LeftInsect?.UpdateMovePositions(Grid, Insects); }
/// <summary> /// Updates the cell status on the passed insects coodinates /// </summary> /// <param name="insect"></param> static void UpdateGrid(Insect insect) { // Remove the previous insect position from the grid Grid[insect.PreviousPositionX, insect.PreviousPositionY].CellStatus = EmptyCell; // Update the insect position on the grid if (insect is Ladybird) { Grid[insect.PositionX, insect.PositionY].CellStatus = LadybirdCell; } if (insect is Greenfly) { Grid[insect.PositionX, insect.PositionY].CellStatus = GreenflyCell; } }