Esempio n. 1
0
 static void Postfix(PlacementMode __instance, bool notFirstPlacement)
 {
     if (notFirstPlacement == false)
     {
         degrees = 0;
     }
     else
     {
         float degreesOld = degrees;
         int   rotations  = Mathf.RoundToInt(((degrees % 360 + 360) % 360) / 90f);
         for (int rotation = 0; rotation < rotations; rotation++)
         {
             GameUI.inst.RotateBuilding(__instance.GetHoverBuilding(), true);
         }
         degrees = degreesOld;
     }
 }
Esempio n. 2
0
 static void Postfix(PlacementMode __instance)
 {
     Mod.helper.Log("test");
     if (__instance.IsPlacing())
     {
         Mod.dLog("placing");
         bool dragging = (bool)typeof(PlacementMode)
                         .GetField("attemptedDrag", BindingFlags.NonPublic | BindingFlags.Instance)
                         .GetValue(__instance);
         if (!dragging)
         {
             Building b    = __instance.GetHoverBuilding();
             Cell     cell = World.inst.GetCellData(b.transform.position);
             if (cell != null)
             {
                 Cell other = FindClosestGroundTile(cell);
                 if (other != null)
                 {
                     DebugExt.dLog("found close ground-level tile", false, other.Center);
                 }
             }
         }
     }
 }