Пример #1
0
    // show the selected race
    private void ShowRace(bool[] gameObjectIsVisible)
    {
        // get the current race game data
        GD_CrewRace race = DataController.m_instance.m_gameData.m_crewRaceList[m_currentRaceIndex];

        // update the race name
        m_raceNameText.text = race.m_name;

        // update the bio values text to show the race's bio
        m_bioValuesText.text = race.m_type + Environment.NewLine + race.m_averageHeight + Environment.NewLine + race.m_averageWeight + Environment.NewLine + race.m_durability + Environment.NewLine + race.m_learningRate;

        // show the correct image for this race
        switch (m_currentRaceIndex)
        {
        case 0: gameObjectIsVisible[(int)GameObjects.HumanImage] = true; break;

        case 1: gameObjectIsVisible[(int)GameObjects.VeloxImage] = true; break;

        case 2: gameObjectIsVisible[(int)GameObjects.ThrynnImage] = true; break;

        case 3: gameObjectIsVisible[(int)GameObjects.ElowanImage] = true; break;

        case 4: gameObjectIsVisible[(int)GameObjects.AndroidImage] = true; break;
        }
    }
Пример #2
0
    // update screen for the select race state
    private bool UpdateScreenForSelectRaceState(bool[] gameObjectIsVisible, bool[] buttonIsInteractable)
    {
        // update the file number text
        m_fileNumberText.text = "New Personnel File";

        // show the left and right arrows
        gameObjectIsVisible[(int)GameObjects.LeftArrowImage]  = true;
        gameObjectIsVisible[(int)GameObjects.RightArrowImage] = true;

        // show the select and cancel buttons
        gameObjectIsVisible[(int)GameObjects.SelectButton] = true;
        gameObjectIsVisible[(int)GameObjects.CancelButton] = true;

        buttonIsInteractable[(int)Buttons.SelectButton] = true;
        buttonIsInteractable[(int)Buttons.CancelButton] = true;

        // get the current race game data
        GD_CrewRace race = DataController.m_instance.m_gameData.m_crewRaceList[m_currentRaceIndex];

        // update the skill values text to show the race's initial values
        m_skillValuesText.text = "";

        for (int skillIndex = 0; skillIndex < c_numSkills; skillIndex++)
        {
            m_skillValuesText.text += race.GetInitialSkill(skillIndex).ToString();

            if (skillIndex < (c_numSkills - 1))
            {
                m_skillValuesText.text += Environment.NewLine;
            }
        }

        // we do want to show the personnel file
        return(true);
    }
Пример #3
0
    // train the currently selected skill
    private void TrainSelectedSkill()
    {
        // get access to the player data
        PlayerData playerData = DataController.m_instance.m_playerData;

        // get access to the bank player data
        PD_Bank bank = playerData.m_bank;

        if (bank.m_currentBalance < 300)
        {
            UpdateTrainingText(5);

            SoundController.m_instance.PlaySound(SoundController.Sound.Error);
        }
        else
        {
            // get access to the current personnel file we are looking at
            PD_Personnel.PD_PersonnelFile personnelFile = playerData.m_personnel.m_personnelList[m_currentFileIndex];

            // get access to the race data for this personnel file
            GD_CrewRace race = DataController.m_instance.m_gameData.m_crewRaceList[m_currentRaceIndex];

            // calculate the current skill and maximum skill points for the selected skill
            int currentSkill = personnelFile.GetSkill(m_currentSkillIndex);
            int maximumSkill = race.GetMaximumSkill(m_currentSkillIndex);

            // check if the maximum skill is zero
            if (maximumSkill == 0)
            {
                UpdateTrainingText(4);

                SoundController.m_instance.PlaySound(SoundController.Sound.Error);
            }
            else if (currentSkill < maximumSkill)               // check if we are still below the maximum skill points
            {
                // increase the skill by the learn amount
                personnelFile.SetSkill(m_currentSkillIndex, Math.Min(maximumSkill, currentSkill + race.m_learningRate));

                // take off 300 credits from the bank balance
                bank.m_currentBalance -= 300;

                // update the bank balance text
                UpdateBankBalanceText();

                // update the skill values text
                UpdateSkillValues();

                // play a ui sound
                SoundController.m_instance.PlaySound(SoundController.Sound.Update);
            }
            else             // the selected skill is already maxxed out
            {
                UpdateTrainingText(3);

                SoundController.m_instance.PlaySound(SoundController.Sound.Error);
            }
        }
    }
Пример #4
0
    // this is called if we clicked on the train button
    public void TrainClicked()
    {
        InputController.m_instance.Debounce();

        // check if the current race is an android
        if (m_currentRaceIndex == 4)
        {
            UpdateTrainingText(1);

            SoundController.m_instance.PlaySound(SoundController.Sound.Error);
        }
        else
        {
            // get access to the player data
            PlayerData playerData = DataController.m_instance.m_playerData;

            // get access to the current personnel file we are looking at
            PD_Personnel.PD_PersonnelFile personnelFile = playerData.m_personnel.m_personnelList[m_currentFileIndex];

            // get access to the race data for this personnel file
            GD_CrewRace race = DataController.m_instance.m_gameData.m_crewRaceList[m_currentRaceIndex];

            // enable the train button only if the current personnel is not maxxed out
            int maxTotalPoints     = 0;
            int currentTotalPoints = 0;

            for (int skillIndex = 0; skillIndex < c_numSkills; skillIndex++)
            {
                maxTotalPoints     = race.GetMaximumSkill(skillIndex);
                currentTotalPoints = personnelFile.GetSkill(skillIndex);
            }

            // check if we are maxxed out
            if (currentTotalPoints < maxTotalPoints)
            {
                // switch to the train select skill state
                SwitchToTrainCrewmemberState();
            }
            else
            {
                UpdateTrainingText(2);

                SoundController.m_instance.PlaySound(SoundController.Sound.Error);
            }
        }

        // play a ui sound
        SoundController.m_instance.PlaySound(SoundController.Sound.Activate);
    }
Пример #5
0
    // this is called when we hit enter in the name input field
    public void OnEndEdit()
    {
        InputController.m_instance.Debounce();

        if (m_nameInputField.text.Length == 0)
        {
            // cancel because the player did not type in anything
            SwitchToViewFileState();

            // play a ui sound
            SoundController.m_instance.PlaySound(SoundController.Sound.Deactivate);
        }
        else
        {
            // get the current race game data
            GD_CrewRace race = DataController.m_instance.m_gameData.m_crewRaceList[m_currentRaceIndex];

            // create a new personnel file
            PD_Personnel.PD_PersonnelFile personnelFile = DataController.m_instance.m_playerData.m_personnel.CreateNewPersonnel();

            // set up the personnel file
            personnelFile.m_name           = m_nameInputField.text;
            personnelFile.m_vitality       = 100.0f;
            personnelFile.m_crewRaceId     = m_currentRaceIndex;
            personnelFile.m_science        = race.m_scienceInitial;
            personnelFile.m_navigation     = race.m_navigationInitial;
            personnelFile.m_engineering    = race.m_engineeringInitial;
            personnelFile.m_communications = race.m_communicationsInitial;
            personnelFile.m_medicine       = race.m_medicineInitial;

            // add the new personnel file to the list
            DataController.m_instance.m_playerData.m_personnel.m_personnelList.Add(personnelFile);


            // make the new file our current one
            m_currentFileIndex = DataController.m_instance.m_playerData.m_personnel.m_personnelList.Count - 1;

            // switch to the doing nothing state
            SwitchToViewFileState();

            // play a ui sound
            SoundController.m_instance.PlaySound(SoundController.Sound.Update);
        }
    }