예제 #1
0
        static void Awake(BehaviorManager __instance)
        {
            MyMod.SetUpdateRate = rate =>
            {
                CustomFixedUpdate updateDelegate =
                    ModUtilities.GetFieldValue <CustomFixedUpdate>(__instance, "CircuitLogicUpdate");

                updateDelegate.updateRate = MyMod.CurrentUpdateRate = rate;
            };
        }
예제 #2
0
        static Highlighter()
        {
            Materials = new Material[Colors.Length];

            Shader outlineShader = ModUtilities.GetFieldValue <Shader>(OutlineEffect.Instance, "outlineShader");

            for (int i = 0; i < Colors.Length; i++)
            {
                Material mat = new Material(outlineShader);

                Texture2D tex = new Texture2D(1, 1, TextureFormat.ARGB32, false);
                tex.SetPixel(0, 0, Colors[i]);
                tex.Apply();

                mat.SetTexture("_MainTex", tex);
                mat.renderQueue = 5000;

                Materials[i] = mat;
            }
        }
예제 #3
0
        public static void Place(StackBoardMenu __instance)
        {
            if (!ModUtilities.GetFieldValue <bool>(__instance, "CurrentPlacementIsValid"))
            {
                return;
            }

            var allBoards   = ModUtilities.GetFieldValue <List <GameObject> >(__instance, "AllSubBoardsInvolvedWithStacking");
            var parentBoard = ModUtilities.GetFieldValue <GameObject>(__instance, "BoardBeingStacked");
            var firstBoard  = allBoards.First(o => o != parentBoard);

            foreach (var item in firstBoard.GetComponentsInChildren <ObjectInfo>())
            {
                var netObj = item.GetComponent <NetObject>() ?? item.gameObject.AddComponent <NetObject>();
                netObj.NetID = NetObject.GetNewID();
            }

            var packet = PlaceBoardPacket.BuildFromBoard(firstBoard.GetComponent <CircuitBoard>(), parentBoard.transform);

            Network.SendPacket(packet);
        }