public void CheckIfAvailable() { if (State != ResearchObjectState.Locked) return; bool result = true; foreach (var researchObj in requiredResearchedObjects) { if (researchObj.State != ResearchObjectState.Unlocked) { result = false; } } if (result) { State = ResearchObjectState.Available; GetComponent<Button>().interactable = true; } }
public void SetUp() { if (Type == ResearchObjectType.Attachable) { var attach = AttachablesDatabase.instance.GetAttachable(AttachableID); UnlockableImage.sprite = attach.PresentationSprite; UnlockableName.text = attach.AttachableName; if (ResearchManager.instance.IsAttachableUnlocked(AttachableID)) { UnlockablePrice.text = "UNLOCKED!"; State = ResearchObjectState.Unlocked; GetComponent<Button>().interactable = true; GetComponent<Image>().color = new Color(1, 1, 0, 1); } else { UnlockablePrice.text = "Cost: " + attach.ScrapCost; State = ResearchObjectState.Locked; GetComponent<Button>().interactable = false; } } if (Type == ResearchObjectType.Ship) { var ship = ShipsDatabase.instance.GetShip(AttachableID); UnlockableImage.sprite = ship.ShipDefaultSprite; UnlockableName.text = ship.ShipName; if (VehiclesManager.instance.IsShipUnlocked(AttachableID)) { UnlockablePrice.text = "UNLOCKED!"; State = ResearchObjectState.Unlocked; GetComponent<Button>().interactable = true; GetComponent<Image>().color = new Color(1, 1, 0, 1); } else { UnlockablePrice.text = "Cost: " + ship.ScrapCost; State = ResearchObjectState.Locked; GetComponent<Button>().interactable = false; } } }