コード例 #1
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);
        }
コード例 #2
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);
            }
        }
コード例 #3
0
    public static void NewBoardBeingPlaced(GameObject NewBoard)
    {
        if (NewBoard == null)
        {
            return;
        }

        DestroyBoardBeingPlaced();

        BoardBeingPlaced          = NewBoard;
        NewBoard.transform.parent = ReferenceObject.transform;
        CircuitBoardBeingPlaced   = NewBoard.GetComponent <CircuitBoard>();

        SetRotationState();
        CapPlacingOffset();

        StuffPlacer.BoardRotationLockAngle = Mathf.Round(StuffPlacer.BoardRotationLockAngle / 90f) * 90; // fixes being able to place boards at non-right angles by locking rotation beforehand
        StuffPlacer.RotationAboutUpVector  = Mathf.RoundToInt(StuffPlacer.RotationAboutUpVector / 90) * 90f;

        if (!BoardBeingPlaced.GetComponent <ObjectInfo>())
        {
            BoardBeingPlaced.AddComponent <ObjectInfo>().ComponentType = ComponentType.CircuitBoard;
        }

        BoardFunctions.DestroyAllWiresConnectedToBoardButNotPartOfIt(NewBoard);

        StuffPlacer.NewThingBeingPlaced(ReferenceObject);
    }