private void UpdateHighlight() { if (StuffPlacer.GameObjectIntersectingStuffOrWouldDestroyWires(StackedBoard)) { CurrentPlacementIsValid = false; StuffPlacer.SetObjectOutlineColor(StackedBoard, OutlineColor.red); } else { CurrentPlacementIsValid = true; StuffPlacer.SetObjectOutlineColor(StackedBoard, OutlineColor.green); } }
public void Initialize() { RaycastHit hit; if (Physics.Raycast(FirstPersonInteraction.Ray(), out hit, Settings.ReachDistance, Wire.IgnoreWiresLayermask)) { if (hit.collider.tag == "CircuitBoard") { GameObject StackThis = hit.collider.gameObject; if (Input.GetButton("Mod")) { GameObject RootBoard = hit.collider.transform.root.gameObject; if (RootBoard.tag == "CircuitBoard") { StackThis = RootBoard; } // make sure to check for circuitboard in case of mounts } BoardBeingStacked = StackThis; BoardBeingStackedCircuitBoard = StackThis.GetComponent <CircuitBoard>(); AllSubBoardsInvolvedWithStacking.Add(BoardBeingStacked); BoardBeingStacked.AddComponent <cakeslice.Outline>(); // added before we get the copy so clones will have it too BoardBeingStackedCopy = Instantiate(BoardBeingStacked, new Vector3(-1000, -1000, -1000), BoardBeingStacked.transform.rotation); GameplayUIManager.UIState = UIState.StackBoardMenu; Canvas.enabled = true; IterationsInput.ActivateInputField(); StuffPlacer.SetObjectOutlineColor(BoardBeingStacked, OutlineColor.blue); // so that you don't accidentally crash your PC when you first stacked on a simple board then you go to stack on a complex board. Don't set iterations directly for // the reason outlined below TrueIterations = 1; // Using Invoke because for some reason this MUST be done a frame later. If it is not, outputs have duplicated geometry Invoke("ShittyHackThatShouldntExist", 0.01f); return; } } SoundPlayer.PlaySoundGlobal(Sounds.FailDoSomething); GameplayUIManager.UIState = UIState.None; }