public static void LineTestor() { for (int i = 0; i < ObjectPooler.GetPlants().Count; i++) { Tools.EasyWriter(25, 0 + i, ObjectPooler.GetPlants()[i].GetX().ToString()); Tools.EasyWriter(50, 0 + i, ObjectPooler.GetPlants()[i].GetY().ToString()); Tools.EasyWriter(75, 0 + i, ObjectPooler.GetPlants()[i].GetGridPosition().ToString()); } for (int i = 0; i < GameBoard.GetGridPosX().Length; i++) { Tools.EasyWriter(100, 0 + i, GameBoard.GetGridPosX()[i].ToString()); } for (int i = 0; i < GameBoard.GetGridPosY().Length; i++) { Tools.EasyWriter(125, 0 + i, GameBoard.GetGridPosY()[i].ToString()); } //for (int i = 0; i < GameBoard.GetGrids().Length; i++) //{ // Tools.EasyWriter(100, 0 + i, GameBoard.GetGrids()[i].ToString()); //} //for (int i = 0; i < GameBoard.GetSSS().Length; i++) //{ // Tools.EasyWriter(50, 0 + i, GameBoard.GetSSS()[i]); //} }
public void SetRow() { for (int i = 0; i < 6; i++) { if ((int)yPosition == GameBoard.GetGridPosY()[i]) { inRow = i; break; } } }
void PlacePlant() { if (!Utility.GetKeyState(ConsoleKey.Spacebar)) { dropping = false; } else if (Utility.GetKeyState(ConsoleKey.Spacebar) && !dropping) { switch (currentPlant) { case (int)PlantTypes.SunFlower: currentPlantsPrice = 50; break; case (int)PlantTypes.PeaShooter: currentPlantsPrice = 100; break; case (int)PlantTypes.CherryBomb: currentPlantsPrice = 150; break; case (int)PlantTypes.WallNut: currentPlantsPrice = 50; break; case (int)PlantTypes.PotatoMine: currentPlantsPrice = 25; break; case (int)PlantTypes.GatlingPea: currentPlantsPrice = 250; break; case (int)PlantTypes.Jalapeno: currentPlantsPrice = 125; break; } if (sunPoints >= currentPlantsPrice) { for (int i = 0; i < GameBoard.GetGrids().Length; i++) { if (GameBoard.GetGrids()[i]) { if ((int)xPosition == GameBoard.GetGridPosX()[i] && (int)yPosition == GameBoard.GetGridPosY()[i]) { return; } } } ObjectSpawner.SpawnPlant(xPosition, yPosition, currentPlant); dropping = true; } } }
public void SetGridPosition() { bool finished = false; int counter = 0; for (int x = 0; x < 10; x++) { if (!finished) { for (int y = 0; y < 6; y++) { if ((int)xPosition == GameBoard.GetGridPosX()[x * 6] + 2 && (int)yPosition == GameBoard.GetGridPosY()[y]) { gridPosition = counter; finished = true; break; } counter++; } } } }