예제 #1
0
 private void ActivateAppropriateTool(BuildingDef def)
 {
     Debug.Assert((UnityEngine.Object)def != (UnityEngine.Object)null, "def was null");
     if (materialSelectionPanel.AllSelectorsSelected() && BuildRequirementsMet(def))
     {
         onElementsFullySelected.Signal();
     }
     else if (!MaterialSelector.AllowInsufficientMaterialBuild() && !DebugHandler.InstantBuildMode)
     {
         if ((UnityEngine.Object)PlayerController.Instance.ActiveTool == (UnityEngine.Object)BuildTool.Instance)
         {
             BuildTool.Instance.Deactivate();
         }
         if ((UnityEngine.Object)PlanScreen.Instance != (UnityEngine.Object)null)
         {
             PrebuildTool.Instance.Activate(def, PlanScreen.Instance.BuildableState(def));
         }
         if ((UnityEngine.Object)BuildMenu.Instance != (UnityEngine.Object)null)
         {
             PrebuildTool.Instance.Activate(def, BuildMenu.Instance.BuildableState(def));
         }
     }
 }
예제 #2
0
 private void Update()
 {
     if (!DebugHandler.InstantBuildMode && !Game.Instance.SandboxModeActive && (UnityEngine.Object)currentDef != (UnityEngine.Object)null && materialSelectionPanel.CurrentSelectedElement != (Tag)null && !MaterialSelector.AllowInsufficientMaterialBuild() && currentDef.Mass[0] > WorldInventory.Instance.GetAmount(materialSelectionPanel.CurrentSelectedElement))
     {
         materialSelectionPanel.AutoSelectAvailableMaterial();
     }
 }