// Update is called once per frame void Update() { Debug.Log(gs); if (selectedSquare != null) { selectedSquare.SetColor(new Color(200, 200, 0, 100)); } switch (gs) { case gameState.MOVING: //when the game is moving units //does nothing break; case gameState.PLACING: //when the game is placing units if (path == null) { path = map.Players[turn].GetSelectedUnit().getPath(goalNode.row, goalNode.column); } if (map.Players[turn].GetSelectedUnit().transform.position.x != goalNode.x || map.Players[turn].GetSelectedUnit().transform.position.y != goalNode.y) { if (currentNode == null) { currentNode = path.Pop(); } map.Players[turn].GetSelectedUnit().moveToPoint(currentNode.x, currentNode.y); if (map.Players[turn].GetSelectedUnit().transform.position.x == currentNode.x && map.Players[turn].GetSelectedUnit().transform.position.y == currentNode.y) { currentNode = null; } } if (map.Players[turn].GetSelectedUnit().transform.position.x == goalNode.x && map.Players[turn].GetSelectedUnit().transform.position.y == goalNode.y) { map.Players[turn].GetSelectedUnit().placeUnit(goalNode.row, goalNode.column); map.Players[turn].GetSelectedUnit().active = false; path = null; currentNode = null; map.Players[turn].SelectedUnit(null); if (map.Players[turn].AllUnactive()) { NextTurn(); } GameMapping.map.ChangeSelected(null); map.gs = gameState.MOVING; } break; case gameState.ATTACKING: //when a unit is attacking another unit break; } }