Beispiel #1
0
    /*
     * IEnumerator RankUpFactory()
     * {
     *  while (StateManager.state == StateManager.State.RANKUP)
     *  {
     *      if (Input.GetMouseButtonDown(0))
     *      {
     *          if (mapGenerator.RankUpBuilding())
     *          {
     *              int cost = factoryManager.RankUp(mapGenerator.GetThisFactoryID(), mapGenerator.GetThisFactoryRank());
     *              fundsController.FundsValueChange(-cost);
     *              FactoryStatusData data = factoryManager.GetFactoryStatus(mapGenerator.GetThisFactoryID(), mapGenerator.GetThisFactoryRank());
     *              pollutionStatus.SetPollution(data.pollutionType,data.pollutionDegree);
     *              StateManager.state = StateManager.State.PRODUCTION;
     *          }
     *      }
     *      yield return null;
     *  }
     * }
     */

    void RankUpFactory()
    {
        int productID = 0;

        switch (factoryManager.GetFactoryStatus(mapGenerator.GetThisFactoryID(), mapGenerator.GetThisFactoryRank() + 1).productName)
        {
        case "Toy":
            productID = 0;
            break;

        case "Game":
            productID = 1;
            break;

        case "Tool":
            productID = 2;
            break;

        default:
            productID = 0;
            break;
        }
        if (mapGenerator.RankUpBuilding(productID))
        {
            int cost = factoryManager.RankUp(mapGenerator.GetThisFactoryID(), mapGenerator.GetThisFactoryRank());
            fundsController.FundsValueChange(-cost);
            FactoryStatusData data = factoryManager.GetFactoryStatus(mapGenerator.GetThisFactoryID(), mapGenerator.GetThisFactoryRank());
            pollutionStatus.SetPollution(data.pollutionType, data.pollutionDegree);
            SoundManager.Instance.PlaySE("build");
            //StateManager.state = StateManager.State.PRODUCTION;
        }
    }
Beispiel #2
0
    public void OnClickBuildButton()
    {
        if (buildFactoryID < 0)
        {
            return;
        }

        int productID = 0;

        switch (factoryManager.GetFactoryStatus(buildFactoryID, 0).productName)
        {
        case "Toy":
            productID = 0;
            break;

        case "Game":
            productID = 1;
            break;

        case "Tool":
            productID = 2;
            break;

        default:
            productID = 0;
            break;
        }
        if (mapGenerator.CreateBuilding(buildFactoryID, productID))
        {
            int cost = factoryManager.Construction(mapGenerator.GetThisFactoryID());
            fundsController.FundsValueChange(-cost);
            FactoryStatusData data = factoryManager.GetFactoryStatus(mapGenerator.GetThisFactoryID(), 0);
            pollutionStatus.SetPollution(data.pollutionType, data.pollutionDegree);
            SoundManager.Instance.PlaySE("build");
            //buildFactoryID = -1;
        }

        /*else
         * {
         *  missPopups[0].SetActive(true);
         * }*/
    }