Beispiel #1
0
    public void Update()
    {
        int selection = GetInputSelection();

        if (selection <= 0 || GameManager.ALL_DISTRICTS == null ||
            GameManager.Instance.GetAllInfrustructure() == null)
        {
            return;
        }

        switch (CommandState)
        {
        case E_COMMAND_STATE.QUIT:
            if (selection == 1)
            {
                GoToSelectDistrict();
            }
            else if (selection == 2)
            {
                Application.Quit();
            }
            break;

        case E_COMMAND_STATE.SELECT_MENU:
            switch (selection)
            {
            case 1:
                GoToSelectDistrict();
                break;

            case 2:
                GoToVirusStats();
                break;

            case 3:
                GameManager.Instance.EndPlayerTurn();
                break;

            case 4:
                GoToQuit();
                break;
            }
            break;

        case E_COMMAND_STATE.SELECT_DISTRICT:
            selection -= 1;
            if (selection == GameManager.ALL_DISTRICTS.Length)
            {
                GoToSelectMenu();
                return;
            }
            else if (selection > GameManager.ALL_DISTRICTS.Length)
            {
                PanelAudioSourceComponent.PlayOneShot(InputErrorAudio);
                return;
            }
            else
            {
                District _d = GameManager.ALL_DISTRICTS[selection];
                if (_d != null)
                {
                    SelectedDistrict = _d;
                    SelectedDistrict.Select();
                }

                /// Begin district select fade

                GoToDistrictOptions();
                return;
            }
            break;

        case E_COMMAND_STATE.DISTRICT_OPTIONS:
            /// Go back
            if (selection == 2)
            {
                GoToSelectDistrict();
            }
            else if (selection == 1)
            {
                /// Deploy
                if (!GameManager.HasVirusDeployed)
                {
                    District _d = SelectedDistrict;
                    SelectedDistrict.Deselect();
                    SelectedDistrict  = null;
                    SelectedStructure = null;

                    GameManager.Instance.DeployVirusInDistrict(_d);
                }
                else     //Go to hack
                {
                    GoToHackInfrastructure();
                    return;
                }
            }
            break;

        case E_COMMAND_STATE.HACK:
            //Back
            selection        -= 1;
            SelectedStructure = SelectedDistrict.Structures[selection];
            GoToStructureStats();
            break;

        case E_COMMAND_STATE.HACK_STATS:
            if (selection == 1)
            {
                GameManager.Instance.BeginHackStructure(SelectedStructure);
            }
            else if (selection == 2)    /// Back
            {
                GoToHackInfrastructure();
            }
            break;

        case E_COMMAND_STATE.VIRUS_STATS:
            switch (selection)
            {
            case 1:
                GoToLevelUpAirborne();
                break;

            case 2:
                GoToLevelUpWaterborne();
                break;

            case 3:
                GoToLevelUpFoodborne();
                break;

            case 4:
                GoToSelectMenu();
                break;
            }
            break;

        case E_COMMAND_STATE.LV_AIRBORNE:
            if (selection == 1 && GameManager.VirusPoints >= 27 * GameManager.PLAYER_VIRUS.Lv_Airborne)
            {
                GameManager.Instance.LevelUpAirBorne();
                GoToVirusStats();
            }
            else if (selection == 2)
            {
                GoToVirusStats();
            }
            break;

        case E_COMMAND_STATE.LV_FOODBORNE:
            if (selection == 1 && GameManager.VirusPoints >= 22 * GameManager.PLAYER_VIRUS.Lv_Foodborne)
            {
                GameManager.Instance.LevelUpFoodBorne();
                GoToVirusStats();
            }
            else if (selection == 2)
            {
                GoToVirusStats();
            }
            break;

        case E_COMMAND_STATE.LV_WATERBORNE:
            if (selection == 1 && GameManager.VirusPoints >= 25 * GameManager.PLAYER_VIRUS.Lv_Waterborne)
            {
                GameManager.Instance.LevelUpWaterBorne();
                GoToVirusStats();
            }
            else if (selection == 2)
            {
                GoToVirusStats();
            }
            break;
        }
    }