示例#1
0
        private void DeleteBoard()
        {
            if (Physics.Raycast(FirstPersonInteraction.Ray(), out var raycastHit, Settings.ReachDistance, 769) && StuffDeleter.AllowedToDoDeleting && raycastHit.collider.gameObject.tag == "CircuitBoard")
            {
                var board = raycastHit.collider.gameObject;

                BoardFunctions.SetMostRecentlyDeletedBoard(board);

                BoardFunctions.DestroyAllWiresConnectedToBoardButNotPartOfIt(board);
                MegaMeshManager.RemoveComponentsImmediatelyIn(board);

                CircuitInput[]  componentsInChildren  = board.GetComponentsInChildren <CircuitInput>();
                CircuitOutput[] componentsInChildren2 = board.GetComponentsInChildren <CircuitOutput>();

                foreach (CircuitInput input in componentsInChildren)
                {
                    StuffDeleter.DestroyInput(input);
                }

                foreach (CircuitOutput output in componentsInChildren2)
                {
                    StuffDeleter.DestroyOutput(output);
                }

                GameObject.Destroy(board);

                SoundPlayer.PlaySoundGlobal(Sounds.DeleteSomething);
            }
        }
    public static void CancelPlacement()
    {
        SoundPlayer.PlaySoundAt(Sounds.DeleteSomething, BoardBeingPlaced);

        BoardFunctions.SetMostRecentlyDeletedBoard(BoardBeingPlaced);

        DestroyBoardBeingPlaced();

        GameplayUIManager.UIState = UIState.None;
    }