void Update() { if (!isLocalPlayer) { return; } // Unit placing logic GameUnit placeableUnit = inputController.GetPlaceableUnit(); if (placeableUnit != null) { FieldCell cell; if (placeableUnit.cost <= resources.GetMeal() && (cell = inputController.GetHoveredCell()) != null) { cell.Highlight(); if (inputController.AcceptButtonPressed()) { if (placeableUnit.tag == "Building") { CmdPlaceBuilding(cell.gameObject, placeableUnit.GetComponent <NetworkIdentity>().assetId); } else if (placeableUnit.tag == "Pawn") { } } } } // Selecting units logic if (inputController.SelectButtonPressed()) { GameUnit unit = inputController.GetHoveredUnit(); if (unit != null) { inputController.SelectUnit(unit); } } // Deselecting buildings logic if (inputController.RejectButtonPressed()) { inputController.SelectPlaceableUnit(null); } // Exit logic if (inputController.ExitButtonPressed()) { StopNetworkManager(); } // Update input controller if (isLocalPlayer && resources != null) { inputController.SetMealAmount(resources.GetMeal()); inputController.SetManaAmount(resources.GetMana()); } }