Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        instance = this;
        print("Initialize game");

        graph = GetComponent <CityGraph> ();

        powerplantShop = GameObject.FindObjectOfType <PowerPlantShop> ();

        //setup players
        players = new ArrayList();

        playerOrderPieces = new ArrayList();

        playerOrderPieces.Add(GameObject.Find("PlayerOrderPiece1"));
        playerOrderPieces.Add(GameObject.Find("PlayerOrderPiece2"));
        playerOrderPieces.Add(GameObject.Find("PlayerOrderPiece3"));
        playerOrderPieces.Add(GameObject.Find("PlayerOrderPiece4"));

        //create objects from GUI setup
        Player[] p = FindObjectsOfType(typeof(Player)) as Player[];
        for (int i = 0; i < p.Length; i++)
        {
            players.Add(p [i]);
            ((GameObject)playerOrderPieces[i]).GetComponent <Renderer>().material.color = p[i].color;
        }

        players.Sort();
        players.Reverse();

        //create material store
        materialStore = new PowerPlantMaterialStore();

        InitializePayoutTable();
//		InitializePowerPlants ();
//		DealCards ();
//
//		ShufflePowerPlantCards ();
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        instance = this;
        print ("Initialize game");

        graph = GetComponent<CityGraph> ();

        powerplantShop = GameObject.FindObjectOfType<PowerPlantShop> ();

        //setup players
        players = new ArrayList();

        playerOrderPieces = new ArrayList ();

        playerOrderPieces.Add (GameObject.Find("PlayerOrderPiece1"));
        playerOrderPieces.Add (GameObject.Find("PlayerOrderPiece2"));
        playerOrderPieces.Add (GameObject.Find("PlayerOrderPiece3"));
        playerOrderPieces.Add (GameObject.Find("PlayerOrderPiece4"));

        //create objects from GUI setup
        Player[] p = FindObjectsOfType(typeof(Player)) as Player[];
        for (int i = 0; i < p.Length; i++) {
            players.Add (p [i]);
            ((GameObject)playerOrderPieces[i]).GetComponent<Renderer>().material.color = p[i].color;
        }

        players.Sort ();
        players.Reverse ();

        //create material store
        materialStore = new PowerPlantMaterialStore ();

        InitializePayoutTable ();
        //		InitializePowerPlants ();
        //		DealCards ();
        //
        //		ShufflePowerPlantCards ();
    }
Ejemplo n.º 3
0
    public bool Take(PowerPlantMaterialStore.Type type, int count)
    {
        if (inventory [(int)type] < count)
            return false;

        inventory [(int)type] -= count;
        return true;
    }
Ejemplo n.º 4
0
    public void Stock(PowerPlantMaterialStore.Type type, int count)
    {
        //should take into account unit owned by players?

        inventory[(int)type] += count;
        if (inventory [(int)type] > inventoryMaximums [(int)type])
            inventory [(int)type] = inventoryMaximums [(int)type];
        if (inventory [(int)type] < 0)
            inventory [(int)type] = 0;
    }
Ejemplo n.º 5
0
 public int QueryInventory(PowerPlantMaterialStore.Type type)
 {
     return inventory [(int)type];
 }
Ejemplo n.º 6
0
 public int QueryCost(PowerPlantMaterialStore.Type type)
 {
     return costTable[(int)type, QueryInventory(type)];
 }