Example #1
0
 void Start()
 {
     render        = gameObject.GetComponent <MeshRenderer>();
     buildPosition = new Vector3(transform.position.x, transform.position.y + .5f, transform.position.z);
     bl            = GameObject.FindGameObjectWithTag("GameController").GetComponent <BuildingLogic>();
     builtOn       = false;
 }
Example #2
0
        public static void TransitionToCopyRoomBlueprintState(this BuildingLogic __instance, Room room, Level level)
        {
            RoomDefinition definition = room.Definition;

            //var NewRoomState = typeof(BuildingLogic).GetNestedType("NewRoomState", AccessTools.all);
            var _newRoomState     = Traverse.Create(__instance).Field("_newRoomState").GetValue();
            var LeaveCurrentState = Traverse.Create(__instance).Method("LeaveCurrentState", new Type[] { typeof(bool) }).GetValue(false);

            var BlueprintFloorPlan = new BlueprintFloorPlan(room.FloorPlan)
            {
                AutoFlowActive = true
            };

            Traverse.Create(_newRoomState).Field("BlueprintFloorPlan").SetValue(BlueprintFloorPlan);
            var BlueprintFloorPlanVisual = new BlueprintFloorPlanVisual(level.WorldState, level.VisualManager, level.DataViewManager, __instance.Configuration.RoomItemEditConfig, level.BuildEvents, "Blueprint", __instance.Configuration.BlueprintFloorTilePrefab, definition._blueprintWallDefinition.Instance, __instance.Configuration.BlueprintFloorMaterialValid, __instance.Configuration.BlueprintFloorMaterialInvalid, __instance.Configuration.BlueprintFloorMaterialInvalidSize);

            Traverse.Create(_newRoomState).Field("BlueprintFloorPlanVisual").SetValue(BlueprintFloorPlanVisual);
            Traverse.Create(__instance).Field("_newRoomState").SetValue(_newRoomState);

            level.BuildEvents.OnBeginNewRoom.InvokeSafe(definition);
            level.CursorManager.PopMode <CursorRoomBuild>();
            level.CursorManager.PushMode(new CursorRoomBuild(level.CursorManager, level, level.Config.GetCursorRoomBuildConfig(), BlueprintFloorPlan, BlueprintFloorPlanVisual));
            level.CursorManager.PushMode(new CursorRoomMove(level.CursorManager, level, level.WorldState, level.BuildEvents, BlueprintFloorPlan, BlueprintFloorPlanVisual, false));

            Traverse.Create(__instance).Field("_currentState").SetValue(BuildingLogic.State.NewRoom);

            level.BuildEvents.OnEnterNewRoomState.InvokeSafe(BlueprintFloorPlan, BlueprintFloorPlanVisual);
            level.HospitalHUDManager.ShowItemsList(definition._type, BlueprintFloorPlan, false);
            level.HospitalHUDManager.TryShowBuildBar();

            foreach (var item in __instance.CurrentBlueprintFloorPlan.Items)
            {
                if (item.UpgradeLevel > 0)
                {
                    Traverse.Create(item).Field("_upgradeLevel").SetValue(0);
                }

                if (item.MaintenanceLevel != null && item.MaintenanceLevel.Value() > 0)
                {
                    item.MaintenanceLevel.SetValue(0, false);
                }
            }
        }
 public BodyResponse SellMotherhipModule(string playerName, string password, int structureType)
 {
     return(BuildingLogic.SellMothershipModule(playerName, password, structureType));
 }
 public BodyResponse GetBodyOptions(string playerName, string password, int bodyID)
 {
     return(BuildingLogic.GetBodyOptions(playerName, password, bodyID));
 }
 public BodyResponse SellStructure(string playerName, string password, int celestialObjectID, int structureTypeID)
 {
     return(BuildingLogic.SellStructure(playerName, password, celestialObjectID, structureTypeID));
 }
 public IEnumerable <StructureOption> GetMotherhipModuleBuildOptions(string playerName, string password)
 {
     return(BuildingLogic.GetMotherhipModuleBuildOption(playerName, password));
 }
 public BodyResponse BuildShip(string playerName, string password, int celestialObjectID, int shipType, int count)
 {
     return(BuildingLogic.BuildShip(count, playerName, password, celestialObjectID, shipType));
 }