Example #1
0
    public void setAirplaneArchtype(AirplaneArchtype type)
    {
        this.type = type;
        Transform child = transform.Find("SpeedDisplayText");
        Text      t     = child.GetComponent <Text>();

        t.text = "" + type.getSpeed();

        child  = transform.Find("PassengersDisplayText");
        t      = child.GetComponent <Text>();
        t.text = "" + type.getMaxPassengers();

        child  = transform.Find("FuelSizeDisplayText");
        t      = child.GetComponent <Text>();
        t.text = "" + type.getFuelSize();

        child  = transform.Find("AirplaneNameText");
        t      = child.GetComponent <Text>();
        t.text = "" + type.getModelName();

        child  = transform.Find("CostText");
        t      = child.GetComponent <Text>();
        t.text = "" + type.getCost();

        child = transform.Find("PurchaseButton");
        PurchaseButtonHandler handler = child.GetComponent <PurchaseButtonHandler>();

        handler.setType(type);
    }
Example #2
0
    public bool purchaseAirplane(AirplaneArchtype type)
    {
        if (type.getCost() > this.playerMoney)
        {
            return(false);
        }
        Debug.Log("Buying a " + type.getModelName());
        this.playerMoney -= type.getCost();
        Airplane airplane = new Airplane("DL130", type);

        airplanes.Add(airplane);

        return(true);
    }