public Ground[] detectSourroundings(int botPosX, int botPosY, Premises premises) { // 0 = current, 1 = left, 2 = right, 3 = behind, 4 = infront // Cast the objects to Ground Objects Ground[] sourroundings = new Ground[5]; sourroundings[0] = (Ground)premises.returnUnderground(botPosX, botPosY); sourroundings[1] = (Ground)premises.returnUnderground(botPosX - 1, botPosY); sourroundings[2] = (Ground)premises.returnUnderground(botPosX + 1, botPosY); sourroundings[3] = (Ground)premises.returnUnderground(botPosX, botPosY + 1); sourroundings[4] = (Ground)premises.returnUnderground(botPosX, botPosY - 1); return(sourroundings); }
public bool checkWater(int botPosX, int botPosY, Premises premises) { if (premises.returnUnderground(botPosX, botPosY).GetType() == typeof(Water)) { return(true); } else { return(false); } }