コード例 #1
0
    // Update is called once per frame
    public void NextTurn()
    {
        if (endGame)
        {
            npcController.npc.endShopKeeper();
            //for now nothing else happens
        }
        else
        {
            if (starvationCount == 2)
            {
                ScenarioManager.GameOver();                //create game over
                return;
            }
            else if (Map.map.player.Food == 0 || Map.map.player.Water == 0)
            {
                starvationCount += 1;
            }
            else
            {
                starvationCount = 0;
            }

            //it's in here as a safety net
            ApiaryOrganiser.apiaryOrg.reInitBeeDict();
            UniquesBackpack.backpack.createDict();

            //have each of these things store their turn which is then called in here
            Map.map.doTurn();                                  //at the moment map.doTurn() does nothing. Probably update fog of war or something in future
            int honeyUpdate = ApiaryOrganiser.apiaryOrg.doTurn();
            ApiaryOrganiser.apiaryOrg.reInitBeeDict();         //need before as may apply to character with scenarios

            Map.map.player.UpdateResources(0, 0, honeyUpdate); //put this into where the apiary is opened to make game smoother
            Map.map.player.doTurn(turnNumber);

            //every third day the man comes. FOR NOW we treat it as a UI screen that pops up
            //happens after other updates so npc comes in front of events
            if (turnNumber % 7 == 4)
            {
                if (firstEncounter)
                {
                    npcController.npc.initNpc(firstEncounter);
                    firstEncounter = false;
                }
                else
                {
                    npcController.npc.openNpcScreen(false);
                }
            }

            //CAN USE PLACE BOY TO SET THEM ON THE SAME TILE
            ApiaryOrganiser.apiaryOrg.reInitBeeDict();

            turnNumber += 1;
            turnCount.GetComponentInChildren <Text>().text = "Day: " + turnNumber;
        }
        //what else do i need to do?
    }