Esempio n. 1
0
        private void CreateObjectiveGUI(TutorialSegment segment, int index)
        {
            Point replayButtonSize = new Point((int)(GUI.ObjectiveNameFont.MeasureString(segment.Objective).X *GUI.Scale), (int)(GUI.ObjectiveNameFont.MeasureString(segment.Objective).Y * 1.45f * GUI.Scale));

            segment.ReplayButton = new GUIButton(new RectTransform(replayButtonSize, objectiveFrame.RectTransform, Anchor.TopRight, Pivot.TopRight)
            {
                AbsoluteOffset = new Point(0, (replayButtonSize.Y + (int)(20f * GUI.Scale)) * index)
            }, style: null);
            segment.ReplayButton.OnClicked += (GUIButton btn, object userdata) =>
            {
                ReplaySegmentVideo(segment);
                return(true);
            };

            int yOffset = (int)((GUI.ObjectiveNameFont.MeasureString(objectiveTranslated).Y / 2f + 5) * GUI.Scale);

            segment.LinkedTitle = new GUITextBlock(new RectTransform(new Point(replayButtonSize.X, yOffset), segment.ReplayButton.RectTransform, Anchor.Center, Pivot.BottomCenter)
            {
                AbsoluteOffset = new Point((int)(10 * GUI.Scale), 0)
            }, objectiveTranslated, textColor: Color.White, font: GUI.ObjectiveTitleFont, textAlignment: Alignment.CenterRight);
            segment.LinkedText = new GUITextBlock(new RectTransform(new Point(replayButtonSize.X, yOffset), segment.ReplayButton.RectTransform, Anchor.Center, Pivot.TopCenter)
            {
                AbsoluteOffset = new Point((int)(10 * GUI.Scale), 0)
            }, segment.Objective, textColor: new Color(4, 180, 108), font: GUI.ObjectiveNameFont, textAlignment: Alignment.CenterRight);

            segment.LinkedTitle.TextScale = segment.LinkedText.TextScale = GUI.Scale;

            segment.LinkedTitle.Color  = segment.LinkedTitle.HoverColor = segment.LinkedTitle.PressedColor = segment.LinkedTitle.SelectedColor = Color.Transparent;
            segment.LinkedText.Color   = segment.LinkedText.HoverColor = segment.LinkedText.PressedColor = segment.LinkedText.SelectedColor = Color.Transparent;
            segment.ReplayButton.Color = segment.ReplayButton.HoverColor = segment.ReplayButton.PressedColor = segment.ReplayButton.SelectedColor = Color.Transparent;
        }
        private void TriggerTutorialSegment(int index, params object[] args)
        {
            ContentRunning            = true;
            activeSegment             = segments[index];
            activeSegment.IsTriggered = true;

            switch (activeSegment.ContentType)
            {
            case ContentTypes.None:
                break;

            case ContentTypes.Video:
                spriteSheetPlayer.LoadContent(playableContentPath, activeSegment.Content, activeSegment.Name, true, true, CurrentSegmentStopCallback);
                break;

            case ContentTypes.Text:
                infoBox = CreateInfoFrame(TextManager.Get(activeSegment.Name), TextManager.Get(activeSegment.Content.GetAttributeString("tag", ""), false, args),
                                          activeSegment.Content.GetAttributeInt("width", 300),
                                          activeSegment.Content.GetAttributeInt("height", 80),
                                          activeSegment.Content.GetAttributeString("anchor", "Center"), true, CurrentSegmentStopCallback);
                break;
            }

            for (int i = 0; i < segments.Count; i++)
            {
                if (!segments[i].IsTriggered)
                {
                    return;
                }
            }

            CoroutineManager.StartCoroutine(WaitToStop()); // Completed
        }
Esempio n. 3
0
        protected virtual void TriggerTutorialSegment(int index, params object[] args)
        {
            Inventory.draggingItem = null;
            ContentRunning         = true;
            activeContentSegment   = segments[index];
            segments[index].Args   = args;

            string tutorialText = TextManager.GetFormatted(activeContentSegment.TextContent.GetAttributeString("tag", ""), true, args);

            tutorialText = TextManager.ParseInputTypes(tutorialText);
            string objectiveText = string.Empty;

            if (!string.IsNullOrEmpty(activeContentSegment.Objective))
            {
                if (args.Length == 0)
                {
                    objectiveText = activeContentSegment.Objective;
                }
                else
                {
                    objectiveText = string.Format(activeContentSegment.Objective, args);
                }
                objectiveText = TextManager.ParseInputTypes(objectiveText);
                activeContentSegment.Objective = objectiveText;
            }
            else
            {
                activeContentSegment.IsTriggered = true; // Complete at this stage only if no related objective
            }


            switch (activeContentSegment.ContentType)
            {
            case TutorialContentTypes.None:
                break;

            case TutorialContentTypes.Video:
                infoBox = CreateInfoFrame(TextManager.Get(activeContentSegment.Id), tutorialText,
                                          activeContentSegment.TextContent.GetAttributeInt("width", 300),
                                          activeContentSegment.TextContent.GetAttributeInt("height", 80),
                                          activeContentSegment.TextContent.GetAttributeString("anchor", "Center"), true, () => LoadVideo(activeContentSegment));
                break;

            case TutorialContentTypes.ManualVideo:
                infoBox = CreateInfoFrame(TextManager.Get(activeContentSegment.Id), tutorialText,
                                          activeContentSegment.TextContent.GetAttributeInt("width", 300),
                                          activeContentSegment.TextContent.GetAttributeInt("height", 80),
                                          activeContentSegment.TextContent.GetAttributeString("anchor", "Center"), true, StopCurrentContentSegment, () => LoadVideo(activeContentSegment));
                break;

            case TutorialContentTypes.TextOnly:
                infoBox = CreateInfoFrame(TextManager.Get(activeContentSegment.Id), tutorialText,
                                          activeContentSegment.TextContent.GetAttributeInt("width", 300),
                                          activeContentSegment.TextContent.GetAttributeInt("height", 80),
                                          activeContentSegment.TextContent.GetAttributeString("anchor", "Center"), true, StopCurrentContentSegment);
                break;
            }
        }
Esempio n. 4
0
 private void ReplaySegmentVideo(TutorialSegment segment)
 {
     if (ContentRunning)
     {
         return;
     }
     ContentRunning = true;
     videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), new VideoPlayer.TextSettings(segment.VideoContent), segment.Id, true, callback: () => ContentRunning = false);
 }
Esempio n. 5
0
        private void TriggerTutorialSegment(int index, params object[] args)
        {
            Inventory.draggingItem = null;
            ContentRunning         = true;
            activeSegment          = segments[index];

            string tutorialText  = TextManager.GetFormatted(activeSegment.TextContent.GetAttributeString("tag", ""), true, args);
            string objectiveText = string.Empty;

            if (!string.IsNullOrEmpty(activeSegment.Objective))
            {
                if (args.Length == 0)
                {
                    objectiveText = activeSegment.Objective;
                }
                else
                {
                    objectiveText = string.Format(activeSegment.Objective, args);
                }

                activeSegment.Objective = objectiveText;
            }
            else
            {
                activeSegment.IsTriggered = true; // Complete at this stage only if no related objective
            }

            switch (activeSegment.ContentType)
            {
            case ContentTypes.None:
                break;

            case ContentTypes.Video:
                infoBox = CreateInfoFrame(TextManager.Get(activeSegment.Id), tutorialText,
                                          activeSegment.TextContent.GetAttributeInt("width", 300),
                                          activeSegment.TextContent.GetAttributeInt("height", 80),
                                          activeSegment.TextContent.GetAttributeString("anchor", "Center"), true, ClosePreTextAndTriggerVideoCallback);
                break;

            case ContentTypes.TextOnly:
                infoBox = CreateInfoFrame(TextManager.Get(activeSegment.Id), tutorialText,
                                          activeSegment.TextContent.GetAttributeInt("width", 300),
                                          activeSegment.TextContent.GetAttributeInt("height", 80),
                                          activeSegment.TextContent.GetAttributeString("anchor", "Center"), true, CurrentSegmentStopCallback);
                break;
            }

            for (int i = 0; i < segments.Count; i++)
            {
                if (!segments[i].IsTriggered)
                {
                    return;
                }
            }

            CoroutineManager.StartCoroutine(WaitToStop()); // Completed
        }
Esempio n. 6
0
        private void CurrentSegmentStopCallback()
        {
            if (!string.IsNullOrEmpty(activeSegment.Objective))
            {
                AddNewObjective(activeSegment);
            }

            activeSegment  = null;
            ContentRunning = false;
        }
Esempio n. 7
0
        protected void StopCurrentContentSegment()
        {
            if (!string.IsNullOrEmpty(activeContentSegment.Objective))
            {
                AddNewObjective(activeContentSegment, activeContentSegment.ContentType);
            }

            activeContentSegment = null;
            ContentRunning       = false;
        }
Esempio n. 8
0
 private void ReplaySegmentVideo(TutorialSegment segment)
 {
     if (ContentRunning)
     {
         return;
     }
     Inventory.draggingItem = null;
     ContentRunning         = true;
     LoadVideo(segment);
     //videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), new VideoPlayer.TextSettings(segment.VideoContent), segment.Id, true, callback: () => ContentRunning = false);
 }
Esempio n. 9
0
        private IEnumerable <object> WaitForObjectiveEnd(TutorialSegment objective)
        {
            yield return(new WaitForSeconds(2.0f));

            objectiveFrame.RemoveChild(objective.ReplayButton);
            activeObjectives.Remove(objective);

            for (int i = 0; i < activeObjectives.Count; i++)
            {
                activeObjectives[i].ReplayButton.RectTransform.AbsoluteOffset = new Point(0, (activeObjectives[i].ReplayButton.Rect.Height + 20) * i);
            }
        }
Esempio n. 10
0
    void Start()
    {
        doNothingTimer      = 2.75f;
        currentSegment      = TutorialSegment.FightOpening;
        attackedEarly       = false;
        swappedEarly        = false;
        playerMoved         = false;
        playerSwappedSkills = 0;
        enemyStatusScript.SetInvulnerability(true);

        AudioManager.GetInstance().StopMusic(Soundtrack.TitleTheme);
        AudioManager.GetInstance().StartMusic(Soundtrack.TutorialTheme);
    }
Esempio n. 11
0
 protected void LoadVideo(TutorialSegment segment)
 {
     if (videoPlayer == null)
     {
         videoPlayer = new VideoPlayer();
     }
     if (segment.ContentType != TutorialContentTypes.ManualVideo)
     {
         videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), new VideoPlayer.TextSettings(segment.VideoContent), segment.Id, true, segment.Objective, StopCurrentContentSegment);
     }
     else
     {
         videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), null, segment.Id, true, string.Empty, null);
     }
 }
Esempio n. 12
0
 protected void LoadVideo(TutorialSegment segment, bool showText = true)
 {
     if (videoPlayer == null)
     {
         videoPlayer = new VideoPlayer();
     }
     if (showText)
     {
         videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), new VideoPlayer.TextSettings(segment.VideoContent), segment.Id, true, segment.Objective, StopCurrentContentSegment);
     }
     else
     {
         videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), null, segment.Id, true, segment.Objective, null);
     }
 }
Esempio n. 13
0
        protected void RemoveCompletedObjective(TutorialSegment segment)
        {
            if (!HasObjective(segment))
            {
                return;
            }
            segment.IsTriggered            = true;
            segment.ReplayButton.OnClicked = null;

            int checkMarkHeight = (int)(segment.ReplayButton.Rect.Height * 1.2f);
            int checkMarkWidth  = (int)(checkMarkHeight * 0.93f);

            Color color = new Color(4, 180, 108);

            int objectiveTextWidth  = segment.LinkedText.Rect.Width;
            int objectiveTitleWidth = segment.LinkedTitle.Rect.Width;

            RectTransform rectTA;

            if (objectiveTextWidth > objectiveTitleWidth)
            {
                rectTA = new RectTransform(new Point(checkMarkWidth, checkMarkHeight), segment.ReplayButton.RectTransform, Anchor.BottomLeft, Pivot.BottomLeft);
                rectTA.AbsoluteOffset = new Point(-rectTA.Rect.Width - (int)(10 * GUI.Scale), 0);
            }
            else
            {
                rectTA = new RectTransform(new Point(checkMarkWidth, checkMarkHeight), segment.ReplayButton.RectTransform, Anchor.BottomLeft, Pivot.BottomLeft);
                rectTA.AbsoluteOffset = new Point(-rectTA.Rect.Width - (int)(10 * GUI.Scale) - (objectiveTitleWidth - objectiveTextWidth), 0);
            }

            GUIImage checkmark = new GUIImage(rectTA, "CheckMark");

            checkmark.Color = checkmark.SelectedColor = checkmark.HoverColor = checkmark.PressedColor = color;

            RectTransform rectTB = new RectTransform(new Vector2(1.1f, .8f), segment.LinkedText.RectTransform, Anchor.Center, Pivot.Center);
            GUIImage      stroke = new GUIImage(rectTB, "Stroke");

            stroke.Color = stroke.SelectedColor = stroke.HoverColor = stroke.PressedColor = color;

            CoroutineManager.StartCoroutine(WaitForObjectiveEnd(segment));
        }
Esempio n. 14
0
        private void RemoveCompletedObjective(TutorialSegment objective)
        {
            objective.IsTriggered = true;

            int checkMarkHeight = (int)(objective.ReplayButton.Rect.Height * 1.2f);
            int checkMarkWidth  = (int)(checkMarkHeight * 0.93f);

            Color         color  = new Color(4, 180, 108);
            RectTransform rectTA = new RectTransform(new Point(checkMarkWidth, checkMarkHeight), objective.ReplayButton.RectTransform, Anchor.BottomLeft, Pivot.BottomLeft);

            rectTA.AbsoluteOffset = new Point(-rectTA.Rect.Width - 5, 0);
            GUIImage checkmark = new GUIImage(rectTA, "CheckMark");

            checkmark.Color = color;

            RectTransform rectTB = new RectTransform(new Vector2(1.1f, .8f), objective.LinkedText.RectTransform, Anchor.Center, Pivot.Center);
            GUIImage      stroke = new GUIImage(rectTB, "Stroke");

            stroke.Color = color;

            CoroutineManager.StartCoroutine(WaitForObjectiveEnd(objective));
        }
Esempio n. 15
0
        private void CreateObjectiveGUI(TutorialSegment segment, int index, TutorialContentTypes type)
        {
            string objectiveText    = TextManager.ParseInputTypes(segment.Objective);
            Point  replayButtonSize = new Point((int)(GUI.LargeFont.MeasureString(objectiveText).X), (int)(GUI.LargeFont.MeasureString(objectiveText).Y * 1.45f));

            segment.ReplayButton = new GUIButton(new RectTransform(replayButtonSize, objectiveFrame.RectTransform, Anchor.TopLeft, Pivot.TopLeft)
            {
                AbsoluteOffset = new Point(0, (replayButtonSize.Y + (int)(20f * GUI.Scale)) * index)
            }, style: null);
            segment.ReplayButton.OnClicked += (GUIButton btn, object userdata) =>
            {
                if (type == TutorialContentTypes.Video)
                {
                    ReplaySegmentVideo(segment);
                }
                else
                {
                    ShowSegmentText(segment);
                }
                return(true);
            };

            string objectiveTitleText = TextManager.ParseInputTypes(objectiveTranslated);
            int    yOffset            = (int)((GUI.SubHeadingFont.MeasureString(objectiveTitleText).Y + 5));

            segment.LinkedTitle = new GUITextBlock(new RectTransform(new Point((int)GUI.SubHeadingFont.MeasureString(objectiveTitleText).X, yOffset), segment.ReplayButton.RectTransform, Anchor.CenterLeft, Pivot.BottomLeft) /*{ AbsoluteOffset = new Point((int)(-10 * GUI.Scale), 0) }*/,
                                                   objectiveTitleText, textColor: Color.White, font: GUI.SubHeadingFont, textAlignment: Alignment.CenterLeft)
            {
                ForceUpperCase = true
            };

            segment.LinkedText = new GUITextBlock(new RectTransform(new Point((int)GUI.LargeFont.MeasureString(objectiveText).X, yOffset), segment.ReplayButton.RectTransform, Anchor.CenterLeft, Pivot.TopLeft) /*{ AbsoluteOffset = new Point((int)(10 * GUI.Scale), 0) }*/,
                                                  objectiveText, textColor: new Color(4, 180, 108), font: GUI.LargeFont, textAlignment: Alignment.CenterLeft);

            segment.LinkedTitle.Color  = segment.LinkedTitle.HoverColor = segment.LinkedTitle.PressedColor = segment.LinkedTitle.SelectedColor = Color.Transparent;
            segment.LinkedText.Color   = segment.LinkedText.HoverColor = segment.LinkedText.PressedColor = segment.LinkedText.SelectedColor = Color.Transparent;
            segment.ReplayButton.Color = segment.ReplayButton.HoverColor = segment.ReplayButton.PressedColor = segment.ReplayButton.SelectedColor = Color.Transparent;
        }
Esempio n. 16
0
        private void ShowSegmentText(TutorialSegment segment)
        {
            if (ContentRunning)
            {
                return;
            }
            Inventory.draggingItem = null;
            ContentRunning         = true;

            string tutorialText = TextManager.GetFormatted(segment.TextContent.GetAttributeString("tag", ""), true, segment.Args);

            Action videoAction = null;

            if (segment.ContentType != TutorialContentTypes.TextOnly)
            {
                videoAction = () => LoadVideo(segment);
            }

            infoBox = CreateInfoFrame(TextManager.Get(segment.Id), tutorialText,
                                      segment.TextContent.GetAttributeInt("width", 300),
                                      segment.TextContent.GetAttributeInt("height", 80),
                                      segment.TextContent.GetAttributeString("anchor", "Center"), true, () => ContentRunning = false, videoAction);
        }
Esempio n. 17
0
 private void CurrentSegmentStopCallback()
 {
     activeSegment  = null;
     ContentRunning = false;
 }
Esempio n. 18
0
 public void ConsumeEvent(IEvent e)
 {
     if (e.GetType() == typeof(ConversationEndEvent))
     {
         if (currentSegment == TutorialSegment.WelcomeDialog)
         {
             StartNextSegment();
         }
         else if (currentSegment == TutorialSegment.AttackDialog ||
                  currentSegment == TutorialSegment.AttackDialogAlt)
         {
             StartNextSegment();
         }
         else if (currentSegment == TutorialSegment.SkillSwap)
         {
             StartNextSegment();
         }
         else if (currentSegment == TutorialSegment.SkillSwapAlt)
         {
             StartNextSegment();
         }
         else if (currentSegment == TutorialSegment.SkillExplaination)
         {
             StartNextSegment();
         }
         else if (currentSegment == TutorialSegment.AimDialog)
         {
             StartNextSegment();
         }
         else if (currentSegment == TutorialSegment.DodgeDialog)
         {
             StartNextSegment();
         }
         else if (currentSegment == TutorialSegment.PhaseTutorial)
         {
             StartNextSegment();
         }
         else if (currentSegment == TutorialSegment.PhaseTutorialTwo)
         {
             StartNextSegment();
         }
         else if (currentSegment == TutorialSegment.HealthTutorial)
         {
             StartNextSegment();
         }
         else if (currentSegment == TutorialSegment.PauseDialog)
         {
             StartNextSegment();
         }
         else if (currentSegment == TutorialSegment.Closing)
         {
             StartNextSegment();
         }
     }
     else if (e.GetType() == typeof(EnemyCurrentHealthEvent))
     {
         if (currentSegment == TutorialSegment.MovementControls)
         {
             attackedEarly = true;
             StartNextSegment();
         }
         else if (currentSegment == TutorialSegment.AttackControls)
         {
             StartNextSegment();
         }
     }
     else if (e.GetType() == typeof(PhaseTransitionEvent))
     {
         DeleteAttacksAsync();
         currentSegment = TutorialSegment.PhaseTutorialDemo;
         StartNextSegment();
     }
     else if (e.GetType() == typeof(TutorialPlayerMovedEvent))
     {
         playerMoved = true;
     }
     else if (e.GetType() == typeof(TutorialSkillSwapEvent))
     {
         if (currentSegment == TutorialSegment.AttackControls ||
             currentSegment == TutorialSegment.AttackDialogAlt ||
             currentSegment == TutorialSegment.WelcomeDialog ||
             currentSegment == TutorialSegment.MovementControls)
         {
             swappedEarly = true;
         }
         playerSwappedSkills++;
     }
 }
Esempio n. 19
0
    private void StartNextSegment()
    {
        switch (this.currentSegment)
        {
        case TutorialSegment.FightOpening:
            // Go to Welcome dialog
            this.currentSegment = TutorialSegment.WelcomeDialog;
            DialogueManager.Instance.NextConversation();
            break;

        case TutorialSegment.WelcomeDialog:
            // Go to movement demo
            this.currentSegment = TutorialSegment.MovementControls;
            this.doNothingTimer = 4f;
            break;

        case TutorialSegment.MovementControls:
            // Go to normal attack dialog
            if (!attackedEarly)
            {
                this.currentSegment = TutorialSegment.AttackDialog;
                DialogueManager.Instance.NextConversation();
            }
            else
            {
                // Go to alt attack dialog
                this.currentSegment = TutorialSegment.AttackDialogAlt;
                DialogueManager.Instance.SelectConversation(11);
            }
            break;

        case TutorialSegment.AttackDialog:
            // Wait for an attack
            this.currentSegment = TutorialSegment.AttackControls;
            break;

        case TutorialSegment.AttackDialogAlt:
            // Wait for an attack
            this.currentSegment = TutorialSegment.AttackControls;
            break;

        case TutorialSegment.AttackControls:
            // Go to first skill dialog
            if (!(attackedEarly && swappedEarly))
            {
                this.currentSegment = TutorialSegment.SkillSwap;
                DialogueManager.Instance.SelectConversation(2);
                DialogueManager.Instance.SetConversationCount(3);
            }
            else
            {
                // Go to alt route
                this.currentSegment = TutorialSegment.SkillSwapAlt;
                DialogueManager.Instance.SelectConversation(12);
            }
            break;

        case TutorialSegment.SkillSwap:
            // Wait for them to mess around
            this.currentSegment = TutorialSegment.SkillSwapControls;
            doNothingTimer      = 3f;
            break;

        case TutorialSegment.SkillSwapControls:
            // Go to skill explainations
            this.currentSegment = TutorialSegment.SkillExplaination;
            DialogueManager.Instance.NextConversation();
            break;

        case TutorialSegment.SkillSwapAlt:
            // Just go to the 2nd phase now.
            this.currentSegment = TutorialSegment.PhaseTutorialDemo;
            enemyStatusScript.SetInvulnerability(false);
            knifeDummyScript.KnifeTossDemo();
            break;

        case TutorialSegment.SkillExplaination:
            // Slight break between dialog
            this.currentSegment = TutorialSegment.AfterSkillExplaination;
            doNothingTimer      = 0.01f;
            break;

        case TutorialSegment.AfterSkillExplaination:
            // Go to aim dialog
            this.currentSegment = TutorialSegment.AimDialog;
            DialogueManager.Instance.NextConversation();
            break;

        case TutorialSegment.AimDialog:
            // Let them test it
            this.currentSegment = TutorialSegment.AimControls;
            doNothingTimer      = 3f;
            break;

        case TutorialSegment.AimControls:
            // Go to dodge dialog
            this.currentSegment = TutorialSegment.DodgeDialog;
            DialogueManager.Instance.NextConversation();
            break;

        case TutorialSegment.DodgeDialog:
            // Let them dodge the attack
            this.currentSegment = TutorialSegment.DodgeDemo;
            knifeDummyScript.KnifeTossDemo();
            doNothingTimer = 6f;
            break;

        case TutorialSegment.DodgeDemo:
            // Go to phase tutorial
            this.currentSegment = TutorialSegment.PhaseTutorial;
            DialogueManager.Instance.NextConversation();
            break;

        case TutorialSegment.PhaseTutorial:
            // Wait to be hit
            this.currentSegment = TutorialSegment.PhaseTutorialDemo;
            enemyStatusScript.SetInvulnerability(false);
            break;

        case TutorialSegment.PhaseTutorialDemo:
            // After being hit to 2nd phase, scream
            this.currentSegment = TutorialSegment.PhaseTutorialTwo;
            DialogueManager.Instance.SelectConversation(7);
            DialogueManager.Instance.SetConversationCount(8);
            break;

        case TutorialSegment.PhaseTutorialTwo:
            // Use the Stronger attack
            this.currentSegment = TutorialSegment.StrongAttackDemo;
            knifeDummyScript.JackTheRipperDemo();
            doNothingTimer = 10f;
            break;

        case TutorialSegment.StrongAttackDemo:
            this.currentSegment = TutorialSegment.HealthTutorial;
            DialogueManager.Instance.NextConversation();
            break;

        case TutorialSegment.HealthTutorial:
            // Separation between two dialogs
            this.currentSegment = TutorialSegment.AfterHealthTutorial;
            doNothingTimer      = 0.01f;
            break;

        case TutorialSegment.AfterHealthTutorial:
            // Goto pause tutorial
            this.currentSegment = TutorialSegment.PauseDialog;
            DialogueManager.Instance.NextConversation();
            break;

        case TutorialSegment.PauseDialog:
            // Separation between two dialogs
            this.currentSegment = TutorialSegment.AfterPauseTutorial;
            doNothingTimer      = 0.01f;
            break;

        case TutorialSegment.AfterPauseTutorial:
            // Goto closing
            this.currentSegment = TutorialSegment.Closing;
            DialogueManager.Instance.NextConversation();
            break;

        case TutorialSegment.Closing:
            SelfDestruct();
            break;
        }
    }
Esempio n. 20
0
 protected void AddNewObjective(TutorialSegment segment, TutorialContentTypes type)
 {
     activeObjectives.Add(segment);
     CreateObjectiveGUI(segment, activeObjectives.Count - 1, type);
 }
Esempio n. 21
0
 protected bool HasObjective(TutorialSegment segment)
 {
     return(activeObjectives.Contains(segment));
 }
Esempio n. 22
0
 protected virtual void CheckActiveObjectives(TutorialSegment objective, float deltaTime)
 {
 }
Esempio n. 23
0
        public override void Start()
        {
            if (!Initialized)
            {
                return;
            }

            base.Start();
            injuredMember = null;
            activeObjectives.Clear();
            objectiveTranslated = TextManager.Get("Objective");
            CreateObjectiveFrame();
            activeSegment       = null;
            tutorialTimer       = floodTutorialTimer = medicalTutorialTimer = 0.0f;
            subStartingPosition = Vector2.Zero;
            characterTimeOnSonar.Clear();

            subStartingPosition = Submarine.MainSub.WorldPosition;
            navConsole          = Item.ItemList.Find(i => i.HasTag("command"))?.GetComponent <Steering>();
            sonar   = navConsole?.Item.GetComponent <Sonar>();
            reactor = Item.ItemList.Find(i => i.HasTag("reactor"))?.GetComponent <Reactor>();

#if DEBUG
            if (reactor == null || navConsole == null || sonar == null)
            {
                infoBox = CreateInfoFrame("Submarine not compatible with the tutorial:"
                                          + "\nReactor - " + (reactor != null ? "OK" : "Tag 'reactor' not found")
                                          + "\nNavigation Console - " + (navConsole != null ? "OK" : "Tag 'command' not found")
                                          + "\nSonar - " + (sonar != null ? "OK" : "Not found under Navigation Console"), true);
                CoroutineManager.StartCoroutine(WaitForErrorClosed());
                return;
            }
#endif
            if (disableTutorialOnDeficiencyFound)
            {
                if (reactor == null || navConsole == null || sonar == null)
                {
                    Stop();
                    return;
                }
            }
            else
            {
                if (navConsole == null)
                {
                    segments[2].IsTriggered = true;                     // Disable navigation console usage tutorial
                }
                if (reactor == null)
                {
                    segments[5].IsTriggered = true;                  // Disable reactor usage tutorial
                }
                if (sonar == null)
                {
                    segments[6].IsTriggered = true;                // Disable enemy on sonar tutorial
                }
            }

            crew     = GameMain.GameSession.CrewManager.GetCharacters().ToList();
            mechanic = CrewMemberWithJob("mechanic");
            engineer = CrewMemberWithJob("engineer");

            Completed = true; // Trigger completed at start to prevent the contextual tutorial from automatically activating on starting new campaigns after this one
            started   = true;
        }
Esempio n. 24
0
 private void AddNewObjective(TutorialSegment segment)
 {
     activeObjectives.Add(segment);
     CreateObjectiveGUI(segment, activeObjectives.Count - 1);
 }
Esempio n. 25
0
        private void CheckActiveObjectives(TutorialSegment objective, float deltaTime)
        {
            switch (objective.Id)
            {
            case "ReactorCommand":     // Reactor commanded
                if (!IsReactorPoweredUp())
                {
                    if (!HasOrder("operatereactor"))
                    {
                        return;
                    }
                }
                break;

            case "NavConsole":     // traveled 50 meters
                if (Vector2.Distance(subStartingPosition, Submarine.MainSub.WorldPosition) < 4000f)
                {
                    return;
                }
                break;

            case "Flood":     // Hull breaches repaired
                if (IsFlooding())
                {
                    return;
                }
                break;

            case "Medical":
                if (injuredMember != null && !injuredMember.IsDead)
                {
                    if (injuredMember.CharacterHealth.DroppedItem == null)
                    {
                        return;
                    }
                }
                break;

            case "EnemyOnSonar":     // Enemy dispatched
                if (HasEnemyOnSonarForDuration(deltaTime))
                {
                    return;
                }
                break;

            case "Degrading":     // Fixed
                if (mechanic != null && !mechanic.IsDead)
                {
                    HumanAIController humanAI = mechanic.AIController as HumanAIController;
                    if (mechanic.CurrentOrder?.AITag != "repairsystems" || humanAI.CurrentOrderOption != "jobspecific")
                    {
                        return;
                    }
                }

                if (engineer != null && !engineer.IsDead)
                {
                    HumanAIController humanAI = engineer.AIController as HumanAIController;
                    if (engineer.CurrentOrder?.AITag != "repairsystems" || humanAI.CurrentOrderOption != "jobspecific")
                    {
                        return;
                    }
                }

                break;

            case "Approach1":     // Wait until docked
                if (!Submarine.MainSub.AtEndPosition || Submarine.MainSub.DockedTo.Count == 0)
                {
                    return;
                }
                break;
            }

            RemoveCompletedObjective(objective);
        }