public Construction(Game game, Thing thing, TypeOfThing?buildOn, TypeOfThing builds, ConstructionGroup group, TypeOfThing requires) { _buildOn = buildOn; _builds = builds; _thing = thing; _game = game; _group = group; _requires = requires; }
public void SetupGroupButtons(ConstructionGroup group) { ButtonPooler.DeactivateAll(); var things = _game.ThingConfigs.Where(t => t.ConstructionConfig != null && t.ConstructionConfig.Group == group).ToList(); foreach (var thing in things) { var obj = ButtonPooler.GetPooledObject(); obj.GetComponentInChildren <Text>().text = thing.Name.ToUppercaseFirst(); obj.SetActive(true); obj.transform.GetComponentInChildrenExcludingParent <Image>().sprite = Assets.GetSprite(thing.Sprite); var button = obj.GetComponentInChildren <Button>(); button.onClick.RemoveAllListeners(); button.onClick.AddListener(() => { _cursor.SetCursor(thing.TypeOfThing, true); }); } }