Пример #1
0
    void ChangeCurrentRole(PD_CrewAssignment.Role role)
    {
        // update the current position index
        m_currentRole = role;

        // get access to the crew assignment player data
        PD_CrewAssignment crewAssignment = DataController.m_instance.m_playerData.m_crewAssignment;

        // check if we have don't have someone assigned to this position
        if (!crewAssignment.IsAssigned(m_currentRole))
        {
            // automatically select the first personnel file
            ChangeCurrentPersonnelId(0, true);
        }
        else
        {
            // get the current file id for this position
            int fileId = crewAssignment.GetFileId(m_currentRole);

            // get access to the personnel player data
            PD_Personnel personnel = DataController.m_instance.m_playerData.m_personnel;

            // update the current personnel id
            m_currentPersonnelId = personnel.GetPersonnelId(fileId);
        }

        // play a sound
        SoundController.m_instance.PlaySound(SoundController.Sound.Update);
    }
Пример #2
0
    void ChangeCurrentPersonnelId(int personnelId, bool forceUpdate = false)
    {
        // don't do anything if we aren't changing the file index to a different one
        if ((personnelId != m_currentPersonnelId) || forceUpdate)
        {
            // update the current personnel id
            m_currentPersonnelId = personnelId;

            // get access to the crew assignment player data
            PD_CrewAssignment crewAssignment = DataController.m_instance.m_playerData.m_crewAssignment;

            // get access to the personnel player data
            PD_Personnel personnel = DataController.m_instance.m_playerData.m_personnel;

            // get the personnel file
            PD_Personnel.PD_PersonnelFile personnelFile = personnel.m_personnelList[m_currentPersonnelId];

            // assign this personnel to this position
            crewAssignment.Assign(m_currentRole, personnelFile.m_fileId);

            // update the assigned crewmember list
            UpdateAssignedCrewmemberList();

            // play a sound
            SoundController.m_instance.PlaySound(SoundController.Sound.Update);
        }
    }
Пример #3
0
    // call this to switch to the select race state
    void SwitchToAssignPersonnelState()
    {
        // change the current state
        m_currentState = State.AssignPersonnel;

        // start with the captain
        ChangeCurrentRole(PD_CrewAssignment.Role.Captain);

        // show the crewmember panel
        m_bottomPanelGameObject.SetActive(true);

        // show the selection xform
        m_selectionXform.SetActive(true);

        // get access to the personnel player data
        PD_Personnel personnel = DataController.m_instance.m_playerData.m_personnel;

        // show the enabled arrows only if we have more than one personnel on file
        if (personnel.m_personnelList.Count > 1)
        {
            m_enabledArrowsGameObject.SetActive(true);
        }
        else
        {
            m_disabledArrowsGameObject.SetActive(true);
        }

        // disable the assign and exit buttons
        m_assignButton.interactable = false;
        m_exitButton.interactable   = false;

        // update the display
        UpdateDisplay();
    }
Пример #4
0
    // this resets our player progress to the new game state
    public void Reset()
    {
        var gameData = DataController.m_instance.m_gameData;

        m_version       = c_currentVersion;
        m_isCurrentGame = false;

        m_general        = new PD_General();
        m_starport       = new PD_Starport();
        m_personnel      = new PD_Personnel();
        m_crewAssignment = new PD_CrewAssignment();
        m_bank           = new PD_Bank();
        m_playerShip     = new PD_PlayerShip();
        m_knownArtifacts = new PD_KnownArtifacts();
        m_encounterList  = new PD_Encounter[gameData.m_encounterList.Length];
        m_terrainVehicle = new PD_TerrainVehicle();
        m_shipsLog       = new PD_ShipsLog();

        m_general.Reset();
        m_starport.Reset();
        m_personnel.Reset();
        m_crewAssignment.Reset();
        m_bank.Reset();
        m_playerShip.Reset();
        m_knownArtifacts.Reset();
        m_shipsLog.Reset();

        for (var i = 0; i < gameData.m_encounterList.Length; i++)
        {
            m_encounterList[i] = new PD_Encounter();

            m_encounterList[i].Reset(i);
        }
    }
Пример #5
0
        public PD_PersonnelFile(PD_Personnel personnel)
        {
            // set the id of this personnel file
            m_fileId = personnel.m_nextFileId;

            // increment the id number
            personnel.m_nextFileId++;
        }
Пример #6
0
    void UpdateDisplay()
    {
        // show the up arrow only if we are not at the first position index
        m_upArrowImage.gameObject.SetActive(m_currentRole != PD_CrewAssignment.Role.First);

        // show the down arrow only if we are not at the last position index
        m_downArrowImage.gameObject.SetActive(m_currentRole != (PD_CrewAssignment.Role.Count - 1));

        // put the position selection box in the right place
        float offset = (int)m_currentRole * m_positionValuesText.renderedHeight / (int)PD_CrewAssignment.Role.Count;

        RectTransform rectTransform = m_selectionXform.GetComponent <RectTransform>();

        rectTransform.offsetMin = m_baseSelectionOffsetMin + new Vector3(0.0f, -offset, 0.0f);
        rectTransform.offsetMax = m_baseSelectionOffsetMax + new Vector3(0.0f, -offset, 0.0f);

        // get access to the personnel player data
        PD_Personnel personnel = DataController.m_instance.m_playerData.m_personnel;

        // get the personnel file
        PD_Personnel.PD_PersonnelFile personnelFile = personnel.m_personnelList[m_currentPersonnelId];

        // update the crewmember name
        if (personnelFile.m_vitality > 0)
        {
            m_nameText.text = personnelFile.m_name + " - " + personnelFile.m_vitality + "% vitality";
        }
        else
        {
            m_nameText.text = personnelFile.m_name + " - DEAD";
        }

        // update the skill values
        m_skillValuesText.text = "";

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

            if (skillIndex < (c_numSkills - 1))
            {
                m_skillValuesText.text += Environment.NewLine;
            }
        }
    }
Пример #7
0
    // this is called when the yes button in the delete panel is clicked
    public void YesClicked()
    {
        InputController.m_instance.Debounce();

        // get to the personnel player data
        PD_Personnel personnel = DataController.m_instance.m_playerData.m_personnel;

        // delete the crewmember
        personnel.m_personnelList.RemoveAt(m_currentFileIndex);

        // change the current file index if necessary
        if (m_currentFileIndex >= personnel.m_personnelList.Count)
        {
            m_currentFileIndex = Math.Max(0, personnel.m_personnelList.Count - 1);
        }

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

        // play a ui sound
        SoundController.m_instance.PlaySound(SoundController.Sound.Deactivate);
    }
Пример #8
0
    // controller updates for when we are currently selecting a race
    public void UpdateControllerForAssignPersonnelState()
    {
        // get access to the personnel player data
        PD_Personnel personnel = DataController.m_instance.m_playerData.m_personnel;

        // keep track if we have centered both x and y
        bool xIsCentered = false;
        bool yIsCentered = false;

        // check if we moved the stick left
        if (InputController.m_instance.m_west)
        {
            if (m_ignoreControllerTimer == 0.0f)
            {
                m_ignoreControllerTimer = 0.3f;

                ChangeCurrentPersonnelId((m_currentPersonnelId + personnel.m_personnelList.Count - 1) % personnel.m_personnelList.Count);

                UpdateDisplay();
            }
        }
        else if (InputController.m_instance.m_east)           // check if we moved the stick right
        {
            if (m_ignoreControllerTimer == 0.0f)
            {
                m_ignoreControllerTimer = 0.3f;

                ChangeCurrentPersonnelId((m_currentPersonnelId + 1) % personnel.m_personnelList.Count);

                UpdateDisplay();
            }
        }
        else         // we have centered the stick
        {
            xIsCentered = true;
        }

        // change position only if x is centered
        if (xIsCentered)
        {
            // check if we moved the stick down
            if (InputController.m_instance.m_south)
            {
                if (m_ignoreControllerTimer == 0.0f)
                {
                    m_ignoreControllerTimer = 0.3f;

                    if (m_currentRole < (PD_CrewAssignment.Role.Count - 1))
                    {
                        ChangeCurrentRole(m_currentRole + 1);

                        UpdateDisplay();
                    }
                }
            }
            else if (InputController.m_instance.m_north)               // check if we have moved the stick up
            {
                if (m_ignoreControllerTimer == 0.0f)
                {
                    m_ignoreControllerTimer = 0.3f;

                    if (m_currentRole > PD_CrewAssignment.Role.First)
                    {
                        ChangeCurrentRole(m_currentRole - 1);

                        UpdateDisplay();
                    }
                }
            }
            else             // we have centered the stick
            {
                yIsCentered = true;
            }
        }

        // check if we have centered the stick
        if (xIsCentered && yIsCentered)
        {
            m_ignoreControllerTimer = 0.0f;
        }

        // check if we have pressed the cancel button
        if (InputController.m_instance.m_cancel)
        {
            InputController.m_instance.Debounce();

            SwitchToMenuBarState();

            SoundController.m_instance.PlaySound(SoundController.Sound.Deactivate);
        }
    }
Пример #9
0
    // call this to switch to the menu bar state
    void SwitchToMenuBarState()
    {
        // change the current state
        m_currentState = State.MenuBar;

        // hide the selection bar
        m_selectionXform.SetActive(false);

        // hide the enabled arrows
        m_enabledArrowsGameObject.SetActive(false);

        // show the disabled arrows
        m_disabledArrowsGameObject.SetActive(false);

        // enable the exit button
        m_exitButton.interactable = true;

        // update the assigned crewmember list
        UpdateAssignedCrewmemberList();

        // get access to the personnel player data
        PD_Personnel personnel = DataController.m_instance.m_playerData.m_personnel;

        // check if we have at least one living crewmember in personnel
        if (personnel.AnyLiving())
        {
            // hide the crewmember panel
            m_bottomPanelGameObject.SetActive(false);

            // show the personnel file
            m_personnelFileXform.SetActive(true);

            // hide the message
            m_messageXform.SetActive(false);

            // activate the assign button
            m_assignButton.interactable = true;

            // select the assign button
            m_assignButton.Select();
        }
        else
        {
            // show the crewmember panel
            m_bottomPanelGameObject.SetActive(true);

            // hide the personnel file
            m_personnelFileXform.SetActive(false);

            // show the message
            m_messageXform.SetActive(true);

            // update the message
            m_messageText.text = "Report to Personnel: There are no living crewmembers on file";

            // inactivate the assign button
            m_assignButton.interactable = false;

            // select the exit button
            m_exitButton.Select();
        }
    }