void CustomInitialize() { LocalLogManager.AddLine("Main Menu - Load GameState Data"); GameStateManager.LoadIfNecessary(); LocalLogManager.AddLine("Main Menu - Load Player Data"); PlayerDataManager.LoadData(); #if WINDOWS || DESKTOP_GL FlatRedBallServices.IsWindowsCursorVisible = true; #endif StructureChoiceSound = StructureSelection.CreateInstance(); AssignClickEventsAndStatusToButtons(); MapScreenGumInstance.CurrentFadingState = MapScreenGumRuntime.Fading.Faded; OfferStructureChoiceIfAvailable(); ShowIntroMessageIfNecessary(); CurrentMusicDisplayInstance.TimedDisplay(true); }
void BuildSelection(GameObject startStage, GameObject endStage) { if (!isLastObjectInProgress) { if (CanBuild()) // only check if we can build once we press the mouse instead of every frame rate { // Debug.Log("Can build"); // reaching here RaycastHit hitInfo; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); Debug.Log(Input.mousePosition); if (Physics.Raycast(ray, out hitInfo)) { // not reaching here Debug.Log("Reached place structure scope"); PlaceStructure(hitInfo.point, startStage); } } } if (isLastObjectInProgress) // we still want to move the last object around, even if we run out of money so don't place inside CanBuild() scope { FollowMouseAround(GO); if (Input.GetMouseButtonDown(0)) // wait for finalization on click { FinalizeBuilding(endStage); Data.tokens -= Settings.BuildingCost; // subtract money after we build -- later we will need to subtract funds based on the type of building // structureSelection = StructureSelection.none; // if we want to keep building we will not reset to none, not sure how to handle this yet } // we will need to reset isLastObjectInProgress since we will only be able to build one building } if (Input.GetMouseButtonDown(1)) { structureSelection = StructureSelection.none; Destroy(GO); isLastObjectInProgress = false; } }
void Start() { structureSelection = StructureSelection.road; }