Example #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);
            }
        }
Example #2
0
        public void Do()
        {
            var board = NetObject.GetByNetId(BoardID);

            if (board == null)
            {
                return;
            }

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

            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.gameObject);
        }
    public static void DestroyBoardBeingPlaced()
    {
        ReferenceObject.transform.parent = null; // without this line the referenceobject is left on the board and you are unable to delete it without move board
        if (BoardBeingPlaced == null)
        {
            return;
        }

        // so that we don't end up with empty clusters when deleting boards.
        // this code is from stuffdeleter.cs. TODO: merge in a nice way
        CircuitInput[]  inputs  = BoardBeingPlaced.GetComponentsInChildren <CircuitInput>();
        CircuitOutput[] outputs = BoardBeingPlaced.GetComponentsInChildren <CircuitOutput>();
        foreach (CircuitInput input in inputs)
        {
            StuffDeleter.DestroyInput(input);
        }
        foreach (CircuitOutput output in outputs)
        {
            StuffDeleter.DestroyOutput(output);
        }

        BoardBeingPlaced.transform.parent = null; // this is done so that when StuffPlacer sets the BoxCollidersOfThingBeingPlaced it doesn't get the box collider from the old board. Maybe a better way would be DestroyImmediate but the documentation is really insistant that you don't use that so IDK. Man... the extent to which stuff in this codebase is interdependant on other stuff in unintuitive ways really bothers me. I'll need to refactor the refactor at this rate...

        Object.Destroy(BoardBeingPlaced);
        StuffPlacer.ResetReferences();
    }
Example #4
0
        public override void Do()
        {
            var obj = NetObject.GetByNetId(Packet.ComponentNetID).gameObject;

            var interactable = obj.GetComponentInChildren <Interactable>();

            if (interactable is DisplayInteractable)
            {
                EditDisplayColorMenu.Instance.DoneMenu();
            }

            CircuitInput[]  componentsInChildren  = obj.GetComponentsInChildren <CircuitInput>();
            CircuitOutput[] componentsInChildren2 = obj.GetComponentsInChildren <CircuitOutput>();
            foreach (CircuitInput input in componentsInChildren)
            {
                StuffDeleter.DestroyInput(input);
            }
            foreach (CircuitOutput output in componentsInChildren2)
            {
                StuffDeleter.DestroyOutput(output);
            }

            GameObject.Destroy(obj);
        }