private bool CheckAbilityCaps() { if (editorMode) { return(true); } var currentAbilitynumbers = new int[] { 0, 0, 0, 0, 0 }; foreach (ShipBuilderPart shipBuilderPart in cursorScript.parts) { var type = (int)AbilityUtilities.GetAbilityTypeByID(shipBuilderPart.info.abilityID); currentAbilitynumbers[type]++; } var extras = CoreUpgraderScript.GetExtraAbilities(player.blueprint.coreShellSpriteID); for (int i = 0; i < 4; i++) { if (currentAbilitynumbers[i] > abilityLimits[i] + extras[i]) { SetReconstructButton((ReconstructButtonStatus)(3 + i)); return(false); } } return(true); }
void DrawSlots(int type) { DestroySlots(type); int extras = CoreUpgraderScript.GetExtraAbilities(coreID)[type]; for (int i = 0; i < extras; i++) { var slot = Instantiate(slotPrefab, slotHolders[type], false); slot.transform.SetSiblingIndex(i + 1); slot.GetComponent <RectTransform>().anchoredPosition = new Vector2(-840 + 40 * i, 0); slot.GetComponent <Image>().color = Color.yellow; } for (int i = extras; i < CoreUpgraderScript.maxAbilityCap[type] + extras; i++) { var slot = Instantiate(slotPrefab, slotHolders[type], false); slot.transform.SetSiblingIndex(i + 1); slot.GetComponent <RectTransform>().anchoredPosition = new Vector2(-840 + 40 * i, 0); } var text = slotHolders[type].GetComponentInChildren <Text>(); text.text = $"{(AbilityHandler.AbilityTypes)type}: {(caps[type] + extras)}"; for (int i = extras + 1; i < CoreUpgraderScript.maxAbilityCap[type] + extras + 1; i++) { slotHolders[type].GetChild(i).GetComponent <Image>().color = Color.green; } }