Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public override void Do()
        {
            var wire = NetObject.GetByNetId(Packet.WireNetID)?.gameObject;

            if (wire == null)
            {
                return;
            }

            StuffDeleter.DestroyWire(wire);
        }
Exemplo n.º 3
0
        public override void Do()
        {
            var parentBoard = NetObject.GetByNetId(Packet.ParentBoardID);

            var component = SavedObjectUtilities.LoadSavedObject(Packet.SavedObject, parentBoard?.transform);

            component.AddComponent <NetObject>().NetID = Packet.NetID;

            if (Network.IsServer)
            {
                foreach (var item in component.GetComponentsInChildren <CircuitOutput>())
                {
                    CircuitStatePacket.SetOutputState(item, item.On, true);
                }
            }
        }
Exemplo n.º 4
0
        public override void Do()
        {
            var netObj1 = NetObject.GetByNetId(Packet.NetObj1Id);
            var netObj2 = NetObject.GetByNetId(Packet.NetObj2Id);

            if (netObj1 == null || netObj2 == null)
            {
                return;
            }

            var io1 = netObj1.IO[Packet.Point1Id];
            var io2 = netObj2.IO[Packet.Point2Id];

            if (io1 == null || io2 == null)
            {
                return;
            }

            var  wireObj = GameObject.Instantiate(Prefabs.Wire);
            Wire wire;

            if (io1.tag == "Input" && io2.tag == "Input")
            {
                wire = wireObj.AddComponent <InputInputConnection>();
            }
            else
            {
                wire = wireObj.AddComponent <InputOutputConnection>();
            }

            wire.Point1 = Wire.GetWireReference(io1);
            wire.Point2 = Wire.GetWireReference(io2);

            wire.DrawWire();

            wire.SetPegsBasedOnPoints();
            StuffConnector.LinkConnection(wire);
            StuffConnector.SetAppropriateConnectionParent(wire);

            SoundPlayer.PlaySoundAt(Sounds.ConnectionFinal, wireObj);

            wireObj.AddComponent <ObjectInfo>().ComponentType = ComponentType.Wire;
            wireObj.AddComponent <NetObject>().NetID          = Packet.NetID;
            wireObj.GetComponent <Collider>().enabled         = true;
        }
Exemplo n.º 5
0
        public override void Do()
        {
            var RotateThis = NetObject.GetByNetId(Packet.ComponentID)?.gameObject;

            if (RotateThis != null)
            {
                BoxCollider[] componentsInChildren = RotateThis.GetComponentsInChildren <BoxCollider>();
                SoundPlayer.PlaySoundAt(Sounds.RotateSomething, RotateThis);

                RotateThis.transform.localEulerAngles = Packet.EulerAngles;

                FloatingPointRounder.RoundIn(RotateThis, false);
                StuffRotater.RedrawCircuitGeometryOf(RotateThis);
                StuffRotater.DestroyIntersectingConnections(RotateThis);
                SnappingPeg.TryToSnapIn(RotateThis);
                MegaMeshManager.RecalculateGroupsOf(RotateThis);
            }
        }
Exemplo n.º 6
0
        public override void Do()
        {
            NetObject         parentBoard = NetObject.GetByNetId(Packet.ParentBoardID);
            SavedCircuitBoard savedBoard;

            using (var mem = new MemoryStream(Packet.SavedBoard))
            {
                savedBoard = (SavedCircuitBoard)BinFormatter.Deserialize(mem);
            }

            var boardObj = SavedObjectUtilities.LoadSavedObject(savedBoard, parentBoard?.transform);

            boardObj.transform.position    = Packet.Position;
            boardObj.transform.eulerAngles = Packet.EulerAngles;

            foreach (var item in boardObj.GetComponentsInChildren <CircuitOutput>())
            {
                item.On = item.On; //It works 100% of the times most of the time
            }

            BoardFunctions.RecalculateClustersOfBoard(boardObj);
            SnappingPeg.TryToSnapIn(boardObj);
        }
Exemplo n.º 7
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);
        }