コード例 #1
0
ファイル: ElectionUI.cs プロジェクト: Beefstyles/GMTKJam
 public void ContinueOrRestart()
 {
     if (electionWon)
     {
         ElectionScreen.SetActive(false);
         GameOnScreen.SetActive(true);
         GameOnObjects.SetActive(true);
         pt.currentElectionNumber++;
         pt.AlterPercentApproval(UnityEngine.Random.Range(-10, 2), PoliticsParty.Balance);
         pt.AlterPercentApproval(UnityEngine.Random.Range(-10, 2), PoliticsParty.Peacenik);
         pt.AlterPercentApproval(UnityEngine.Random.Range(-10, 2), PoliticsParty.Warhawk);
         pt.PreviousElectionResult = pt.ElectionResult;
     }
     else
     {
         SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
     }
 }
コード例 #2
0
ファイル: GameController.cs プロジェクト: Beefstyles/GMTKJam
    public void ObjectSpawner(GameObject objectToBeSpawned, Vector3 location)
    {
        spawnTargetCoords = hexGrid.ReturnHexCoords(location);
        UnitTypes spawnUt;

        if (OverallHexCoordsDict.GameDictionary.TryGetValue(spawnTargetCoords, out spawnUt))
        {
            switch (spawnUt)
            {
            default:
                StartCoroutine(gameUI.SetMessage("Move out unit from spawn Zone"));
                break;
            }
        }
        else
        {
            if (bc.NumberOfActionsRemaining > 0)
            {
                switch (objectToBeSpawned.GetComponent <ObjectInfo>().ut)
                {
                case (UnitTypes.Miner):
                    NumberOfResources -= baseActionController.CostOfMiner;
                    pt.AlterPercentApproval(Random.Range(-2, 2), PoliticsParty.Warhawk);
                    pt.AlterPercentApproval(Random.Range(2, 5), PoliticsParty.Peacenik);
                    pt.AlterPercentApproval(Random.Range(0, 1), PoliticsParty.Balance);
                    break;

                case (UnitTypes.Settler):
                    pt.AlterPercentApproval(Random.Range(-2, 2), PoliticsParty.Warhawk);
                    pt.AlterPercentApproval(Random.Range(2, 5), PoliticsParty.Peacenik);
                    pt.AlterPercentApproval(Random.Range(0, 2), PoliticsParty.Balance);
                    NumberOfResources -= baseActionController.CostOfSettler;
                    break;

                case (UnitTypes.Soldier):
                    pt.AlterPercentApproval(Random.Range(2, 5), PoliticsParty.Warhawk);
                    pt.AlterPercentApproval(Random.Range(-4, -2), PoliticsParty.Peacenik);
                    pt.AlterPercentApproval(Random.Range(-2, 2), PoliticsParty.Balance);
                    NumberOfResources -= baseActionController.CostOfSoldier;
                    break;
                }
                Instantiate(objectToBeSpawned, location, Quaternion.identity);
                StartCoroutine("RefreshUnitArray");
                bc.NumberOfActionsRemaining--;
            }
        }
    }
コード例 #3
0
ファイル: UnitBehaviour.cs プロジェクト: Beefstyles/GMTKJam
    public void HandleUpgrade()
    {
        if (gc.NumberOfResources >= CostToUpgrade)
        {
            gc.NumberOfResources -= CostToUpgrade;
            switch (gc.SelectedObject.GetComponent <ObjectInfo>().ut)
            {
            case (UnitTypes.Miner):
                pt.AlterPercentApproval(Random.Range(-2, 2), PoliticsParty.Warhawk);
                pt.AlterPercentApproval(Random.Range(1, 3), PoliticsParty.Peacenik);
                pt.AlterPercentApproval(Random.Range(-3, 3), PoliticsParty.Balance);
                break;

            case (UnitTypes.Soldier):
                pt.AlterPercentApproval(Random.Range(1, 3), PoliticsParty.Warhawk);
                pt.AlterPercentApproval(Random.Range(-1, -3), PoliticsParty.Peacenik);
                pt.AlterPercentApproval(Random.Range(-3, 3), PoliticsParty.Balance);
                break;

            case (UnitTypes.Settler):
                pt.AlterPercentApproval(Random.Range(1, 3), PoliticsParty.Warhawk);
                pt.AlterPercentApproval(Random.Range(-1, -3), PoliticsParty.Peacenik);
                pt.AlterPercentApproval(Random.Range(-3, 3), PoliticsParty.Balance);
                break;
            }
            StartCoroutine(gameUI.SetMessage("Upgraded: " + gc.SelectedObject.GetComponent <ObjectInfo>().ut.ToString()));
            NumberOfActions++;
            maxActions++;
        }
    }