private static Door BackupDoor(DoorSlot door) { var ret = new Door { Icon = door.GetComponentsInChildren <Image>()[1].sprite, Color = RGBFromColor(door.defaultBackgroundColor).ToString("X6"), Locations = new Dictionary <string, Location> { ["door"] = FromV3(door.transform.position), ["card_door"] = FromV3(door.cardPositions[0].position), ["card_1"] = FromV3(door.cardPositions[1].position), ["card_2"] = FromV3(door.cardPositions[2].position) } }; return(ret); }
private static void ModifyDoor(DoorSlot door, Door d) { if (d.Icon != null) { var img = door.GetComponentsInChildren <Image>()[1]; img.sprite = d.Icon; } if (!string.IsNullOrEmpty(d.Color)) { var c = int.Parse(d.Color, NumberStyles.HexNumber); door.defaultBackgroundColor = ColorFromRGB(c); } if (d.Locations != null) { TrySetLocation(d.Locations, door.transform, "door"); TrySetLocation(d.Locations, door.cardPositions[0], "card_door"); TrySetLocation(d.Locations, door.cardPositions[1], "card_1"); TrySetLocation(d.Locations, door.cardPositions[2], "card_2"); } }