Пример #1
0
    // Returns whether or not the given player meets all requirements to create this object.
    // Note: this function is called before the Creatable is instantiated
    public BoolAndString CanCreate(Player player)
    {
        if(ResourceCostsMap == null) {
            PopulateResourceCostsMap();
        }

        BoolAndString canCreate = new BoolAndString(true);
        if(gameObject.CompareTag(GameUtil.TAG_TECH)) {
            // Creatable is a tech, check to make sure the player hasn't already researched it
            if(player.PlayerStatus.techs.Contains(GetComponent<Tech>())) {
                canCreate.Bool = false;
                canCreate.String += "You have already researched this technology: "+GetComponent<Tech>();
            }
        }
        if(canCreate.Bool) {
            // Can still create, so continue checking tech dependencies
            foreach(Tech techDependency in techDependencies) {
                if(!player.PlayerStatus.techs.Contains(techDependency)) {
                    canCreate.Bool = false;
                    canCreate.String += "Player does not have the required technology: "+techDependency;
                }
            }
        }
        return canCreate;
    }
Пример #2
0
 public ControlMenuItem(string controlCode, string destinationMenu, bool requiresPower)
 {
     ControlCode = controlCode;
     Control = ControlStore.ControlMap[ControlCode];
     DestinationMenu = destinationMenu;
     RequiresPower = requiresPower;
     Enabled = new BoolAndString(true);
 }