コード例 #1
0
    public bool payEmployees()
    {
        employees.Sort(Citizen.jobTimeComparison);
        foreach (Citizen e in employees)
        {
            double         wage     = 0;
            CapitalistCity location = (CapitalistCity)this.owner;
            if (e.getEducation() == 0)
            {
                wage = location.getMinimumWage();
            }
            if (e.getEducation() == 1)
            {
                wage = location.getMinimumWage() * 1.5;
            }
            if (e.getEducation() == 2)
            {
                wage = location.getMinimumWage() * 2;
            }
            e.recievePay(wage, location.getWageTax());
            money -= wage;
            if (money <= 0)
            {
                return(false);
            }
        }

        return(true);
    }
コード例 #2
0
    //Called before other Starts()
    void Awake()
    {
        gameMap = GameObject.FindObjectOfType <HexMap>();
        gameMap.Begin();
        turn    = 1;
        players = new List <Player>();
        int numPlayers = 1;

        players.Add(new Player(0, true));
        for (int i = 1; i < numPlayers; i++)
        {
            players.Add(new AIPlayer(i, Random.Range(0, 1) > .5f));
        }
        unitToGameObject = new Dictionary <Unit, GameObject>();
        //Debug.Log("Game Manager started");
        foreach (Player p in players)
        {
            Hex[,] hexes = HexMap.hexes;
            City c = new City(hexes, true, true, p);
            if (p.communist)
            {
                c = new CommunistCity(hexes, true, true, p);
            }
            else if (!p.communist)
            {
                c = new CapitalistCity(hexes, true, true, p);
            }
            p.city = c;
        }
        g = new GlobalMarket();
        Camera cam = FindObjectOfType <Camera>();

        gameMap.colorHexes(cam.transform.position);
        playing = players[0];
        playing.StartTurn();
        unitToGameObject = new Dictionary <Unit, GameObject>();
    }