Ejemplo n.º 1
0
        public override void Setup(OfflineRulesProcessor rulesProcessor)
        {
            base.Setup(rulesProcessor);

            if (this.m_RulesProcessor != null)
            {
                m_SinglePlayerRulesProcessor = this.m_RulesProcessor as SinglePlayerRulesProcessor;

                Objective[] objectives = m_SinglePlayerRulesProcessor.objectiveInstances;

                int lengthOfArray = objectives.Length;
                //Display the objectives: Primary first then Secondary
                CreateHeading("PRIMARY");
                for (int i = 0; i < lengthOfArray; i++)
                {
                    if (i == 1)
                    {
                        CreateHeading("SECONDARY");
                    }
                    ObjectiveUI newObjectiveUi = Instantiate <ObjectiveUI>(i == 0 ? m_PrimaryObjectiveUiElement : m_ObjectiveUiElement);
                    newObjectiveUi.transform.SetParent(m_ObjectiveList, false);
                    newObjectiveUi.Setup(objectives[i], false);
                }

                m_LevelName.text = m_SinglePlayerRulesProcessor.GetRoundMessage().ToUpper();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Show this modal.
        /// </summary>
        public override void Show()
        {
            base.Show();
            m_SinglePlayerRulesProcessor = m_RulesProcessor as SinglePlayerRulesProcessor;
            if (m_SinglePlayerRulesProcessor != null)
            {
                SetUp(m_SinglePlayerRulesProcessor.objectiveInstances);
            }


            if (!m_HasBeenSetUp)
            {
                Debug.LogError("SPCompleteModal not set up!");
                return;
            }
            DoAchievement();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Displays this HUD element.
        /// </summary>
        /// <param name="rulesProcessor">The rules processor for the active mission.</param>
        public void ShowHud(RulesProcessor rulesProcessor)
        {
            //If we haven't already, subscribe to all the necessary events.
            Subscribe();
            this.m_RulesProcessor = rulesProcessor as SinglePlayerRulesProcessor;

            if (this.m_RulesProcessor == null)
            {
                Debug.LogError("Tried to show single player HUD in non-singleplayer game!!!");
                return;
            }

            gameObject.SetActive(true);
            m_SecondaryObjectives.Clear();

            //Iterate through objectives for this mission and instantiate the prompts accordingly.
            Objective[] objectives = this.m_RulesProcessor.objectiveInstances;

            int lengthOfArray = objectives.Length;

            for (int i = 0; i < lengthOfArray; i++)
            {
                Objective objective = objectives[i];
                if (objective.isPrimaryObjective)
                {
                    ObjectiveUI newObjectiveUi = Instantiate <ObjectiveUI>(m_ObjectiveUiElement);
                    newObjectiveUi.transform.SetParent(m_ObjectiveParent, false);
                    newObjectiveUi.Setup(objective);
                    newObjectiveUi.transform.SetAsFirstSibling();
                }
                else
                {
                    ObjectiveUI newObjectiveUi = Instantiate <ObjectiveUI>(m_SecondaryUiElement);
                    newObjectiveUi.transform.SetParent(m_ObjectiveParent, false);
                    newObjectiveUi.Setup(objective);
                    m_SecondaryObjectives.Add(newObjectiveUi.gameObject);
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Sets the rules processor.
 /// </summary>
 /// <param name="rulesProcessor">Rules processor.</param>
 public virtual void SetRulesProcessor(SinglePlayerRulesProcessor rulesProcessor)
 {
     this.m_RulesProcessor = rulesProcessor;
 }