private void HandleBuildingButton() { if (GuiManager.Cursor.WindowPushed is IBuildButton buildButton && buildButton.IsEnabled && buildButton.CanAfford) { if (selectedObject is StructurePlacement) { var newBuilding = buildButton.BuildingFactory.CreateNew(WorldLayer) as BaseStructure; newBuilding.Position = BuildMenuInstance.CurrentPlacement.Position; newBuilding.Z = 1; newBuilding.StartWarpIn(); GuiManager.Cursor.WindowPushed = null; BuildMenuInstance.Hide(didBuild: true); PathingNodeNetwork.RemoveNodesForCollision(newBuilding.AxisAlignedRectangleInstance); SpendSatoshis(newBuilding.SatoshiCost); StructureBuildSound.Pan = newBuilding.X / (Camera.Main.OrthogonalWidth / 2); SoundManager.PlaySoundEffect(StructureBuildSound); //var towerBuiltData = new //{ // TowerType = buildButton.BuildingType.AssemblyQualifiedName, // NewTowerCount = AllStructuresList.Count, // AllTowersUnlocked = PlayerDataManager.GetAvailableTowers().Count == 6 ? "True" : "False" //}; //AnalyticsManager.AddDeferredEvent("TowerBuilt", towerBuiltData); } } }
private void ChangeGameModeToNormal() { CurrentPlayerActionMode = PlayerActionMode.Normal; CurrentLevel.IsReadyForNextWave = true; StructurePlacementInstance.Visible = false; BuildMenuInstance.Hide(); selectedObject = null; ReadyButtonInstance.PulseAnimation.Stop(); ReadyButtonInstance.Visible = false; ReadyButtonInstance.Enabled = false; if (StructureInfoInstance.Visible) { StructureInfoInstance.UpdateAffordability(CurrentSatoshis, false); } }