Beispiel #1
0
    public void AddTutorialTrigger(TutorialTrigger t, bool checkTriggered = false)
    {
        if (checkTriggered && triggered.Contains(t.GetHash()))
        {
            return;
        }

        if (t.condition != null)
        {
            if (conditionTriggers.Find((TutorialTrigger other) => other.GetHash() == t.GetHash()) != null)
            {
                return;
            }

            conditionTriggers.Add(t);
            conditionTriggers.Sort();
        }
        else
        {
            List <TutorialTrigger> prior = priorTriggers.ToList();
            if (prior.Find((TutorialTrigger other) => other.GetHash() == t.GetHash()) != null)
            {
                return;
            }
            priorTriggers.Add(t);
        }
    }
Beispiel #2
0
    void Update()
    {
        if (FindObjectOfType <WeaponScreen>() == null && !started)
        {
            // Get UI Manager and start dialogue
            ui      = FindObjectOfType <UIManager>();
            started = true;

            ui.Dialouge("Welcome to basic training! Get through this and you'll be cleared for field duty!");

            // Set up triggers
            foreach (TutorialTriggerData triggerData in triggers)
            {
                TutorialTrigger newTrigger = triggerData.trigger.gameObject.AddComponent <TutorialTrigger>();
                newTrigger.ui       = ui;
                newTrigger.dialogue = triggerData.dialogue;
            }
        }

        // Check for win state
        if (!ended)
        {
            foreach (ControlPoint point in FindObjectsOfType <ControlPoint>())
            {
                if (point.ownership != ControlPoint.Ownership.BLUE)
                {
                    return;
                }
            }
            ui.Dialouge("Congrats recruit! You have now been cleared for field duty!");
            StartCoroutine(exit());
            ended = true;
        }
    }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == ("Sickle"))
     {
         if (damageCheck == true)
         {
             --m_hitPoint;
             damageCheck = false;
         }
         if (m_hitPoint == 0)
         {
             TutorialTrigger tutorialToriger = m_tutorialToriger.GetComponent <TutorialTrigger>();
             if (tutorialToriger != null)
             {
                 tutorialToriger.m_returnCheck = true;
             }
             if (damageCheck == false)
             {
                 syoujoController.AddFeelingOfBelieve = m_feelingBelieve;
                 damageCheck = true;
             }
             SoundManager.Instance.PlaySE((int)Common.SEList.EnemyDestroy);
             SoundManager.Instance.PlaySE((int)Common.SEList.DropHeart);
             Destroy(this.gameObject, 0.3f);
             Instantiate(m_heart, transform.position, transform.rotation);
         }
     }
 }
    /// <summary>
    /// Funzione che notifica che è stato chiuso un tutorial
    /// </summary>
    /// <param name="_trigger"></param>
    public void TutorialTriggerClose(TutorialTrigger _trigger)
    {
        checkTriggers = true;
        groupCtrl.Enable(true);

        OnTutorialClose?.Invoke(_trigger);
    }
 public override void Trigger(TutorialTrigger trigger)
 {
     switch (trigger)
     {
         case TutorialTrigger.OpenInventory:
             if (!inventoryOpened)
             {
                 MenuInitializer.LockMenu();
                 inventoryOpened = true;
                 ExplainInventory();
             }
             break;
         case TutorialTrigger.EquipLaserPistol:
             pistolEquipped = true;
             if (inventoryMissionAssigned)
             {
                 MenuInitializer.UnlockMenu();
                 CongratulatePlayer();
             }
             break;
         case TutorialTrigger.CloseInventory:
             if (pistolEquipped)
             {
                 GoToNextState();
             }
             break;
     }
 }
Beispiel #6
0
 private void HandleTutorialTriggerExit(TutorialTrigger _triggerExit)
 {
     tutorialTriggered = null;
     tutorialText.gameObject.SetActive(false);
     player.GetHealthController().SetCanLoseHealth(true);
     enemyMng.SetCanAddTollerance(true);
 }
    /// <summary>
    /// Funzione che notifica che è stato triggerato un tutorial
    /// </summary>
    /// <param name="_trigger"></param>
    public void TutorialTriggerOpen(TutorialTrigger _trigger)
    {
        checkTriggers = false;
        groupCtrl.Enable(false);

        OnTutorialOpen?.Invoke(_trigger);
    }
 public override void Trigger(TutorialTrigger trigger)
 {
     if (trigger.Equals(TutorialTrigger.Walk) && !walkingMissionCompleted)
     {
         walkingMissionCompleted = true;
         Invoke("TeachMouseMovement", 3f);
     }
 }
Beispiel #9
0
 private void HandleTutorialTriggerEnter(TutorialTrigger _triggerTriggered)
 {
     tutorialTriggered = _triggerTriggered;
     enemyMng.SetCanAddTollerance(false);
     player.GetHealthController().SetCanLoseHealth(false);
     tutorialText.text = tutorialTriggered.GetTextToShow(InputChecker.GetCurrentInputType());
     tutorialText.gameObject.SetActive(true);
 }
Beispiel #10
0
 // Use this for initialization
 void Start()
 {
     gameScript         = FindObjectOfType <GameController>().gameObject.GetComponent <GameController>();
     dTrigger           = GetComponent <TutorialTrigger>();
     currentRecipe      = GetComponent <RecipeTrigger>();
     dScript            = GetComponent <DialogueManager>();
     tvPos              = transform.position;
     transform.position = new Vector3(transform.position.x, transform.position.y - 1, transform.position.z);
 }
Beispiel #11
0
    private void ShowTutorialInfo(TutorialTrigger t)
    {
        if (t == null)
        {
            return;
        }

        if (lastTutorialTrigger != null)
        {
            if (lastTutorialTrigger.destroyOnShowed)
            {
                Destroy(lastTutorialTrigger);
            }
            lastTutorialTrigger = null;
        }

        PopUpData info = t.info;

        if (t.highlightObject)
        {
            popUpManager.Show(info, t.GetRect());
        }
        else
        {
            popUpManager.Show(info);
        }
        if (TemaryManager.Instance != null)
        {
            TemaryManager.Instance.AddTemary(t.info);
        }

        if (t.OnShowed != null)
        {
            t.OnShowed.Invoke();
        }

        if (!triggered.Contains(t.GetHash()))
        {
            triggered.Add(t.GetHash());
        }

        if (!saved.Contains(t.GetHash()))
        {
            savePending.Add(t);
        }

        if (t.isSaveCheckpoint)
        {
            SavePendingTriggers();
        }

        lastTutorialTrigger = t;

        /*if (t.destroyOnShowed)
         *  Destroy(t);*/
    }
Beispiel #12
0
 public override void Trigger(TutorialTrigger trigger)
 {
     switch (trigger)
     {
         case TutorialTrigger.ItemDestroyed:
             RenderText("Nice work. Now head into the next room. Be careful - an enemy is waiting for you.");
             break;
         case TutorialTrigger.CombatTutorialRoomEntered:
             GoToNextState();
             break;
     }
 }
Beispiel #13
0
    private void HandleTutorialBehaviourTriggered(TutorialTrigger _trigger)
    {
        switch (_trigger.GetBehvaiourToTrigger())
        {
        case TutorialTrigger.TriggerBehaviours.HealthBar:
            player.GetHealthController().SetCanLoseHealthDefaultBehaviour(true);
            break;

        case TutorialTrigger.TriggerBehaviours.TolleranceBar:
            enemyMng.SetCanAddTolleranceDefaultBehaviour(true);
            break;
        }
    }
Beispiel #14
0
 public void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == ("sinigami"))
     {
         SoundManager.Instance.PlaySE((int)Common.SEList.EnemyDamage);
         --m_enemyHP;
         if (m_enemyHP == 0)
         {
             TutorialTrigger testMove = m_testmove.GetComponent <TutorialTrigger>();
             testMove.m_returnCheck = true;
             Destroy(this.gameObject, 0.3f);
         }
     }
 }
Beispiel #15
0
 public void CreateTutorialTrigger(string block, GameObject blockPrefab)
 {
     //Add tutorials to blocks
     if (m_BlockTutorialsDictionary.ContainsKey(block))
     {
         TutorialTrigger          trigger     = blockPrefab.AddComponent <TutorialTrigger>();
         BlockTutorialTriggerInfo triggerInfo = m_BlockTutorialsDictionary[block];
         trigger.info             = triggerInfo.Tutorial;
         trigger.priority         = triggerInfo.Priority;
         trigger.highlightObject  = triggerInfo.Highlight;
         trigger.destroyOnShowed  = triggerInfo.DestroyOnShow;
         trigger.isSaveCheckpoint = triggerInfo.IsSaveCheckpoint;
     }
 }
Beispiel #16
0
    private void Update()
    {
        if (!tutorialsON)
        {
            return;
        }


        if (lastWidth != Screen.width || lastHeight != Screen.height)
        {
            if (lastTutorialTrigger != null && popUpManager.IsShowing())
            {
                StartCoroutine(RecalculateShownTutorial());
            }

            lastWidth  = Screen.width;
            lastHeight = Screen.height;
        }

        if (popUpManager.IsShowing())
        {
            return;
        }

        TutorialTrigger prior = TryPopPriorityTriggers();
        TutorialTrigger cond  = TryPopConditionalTriggers();

        if (prior != null && cond != null)
        {
            if (prior.CompareTo(cond) <= 0)
            {
                ShowTutorialInfo(prior);
                AddTutorialTrigger(cond);
                return;
            }

            ShowTutorialInfo(cond);
            AddTutorialTrigger(prior);
        }
        else if (prior != null)
        {
            ShowTutorialInfo(prior);
        }
        else if (cond != null)
        {
            ShowTutorialInfo(cond);
        }
    }
Beispiel #17
0
        public void SetActiveBlocks(Dictionary <string, CategoryBlocks> activeCategories, Dictionary <string, PopUpData> categoriesTutorials = null)
        {
            this.activeCategories = activeCategories;
            nActiveCategories     = activeCategories.Keys.Count;
            TutorialTrigger trigger = GetComponent <TutorialTrigger>();

            if (trigger != null)
            {
                trigger.enabled = nActiveCategories > 0;
            }

            Block.blocksAvailable = new Dictionary <string, int>();
            int priority = 400;

            //Activate the category if it's not in the active list
            foreach (var category in mConfig.BlockCategoryList)
            {
                bool active = activeCategories.ContainsKey(category.CategoryName.ToLower());
                mMenuList[category.CategoryName].gameObject.SetActive(active);
                if (categoriesTutorials != null && categoriesTutorials.ContainsKey(category.CategoryName))
                {
                    TutorialTrigger categoryTrigger = mMenuList[category.CategoryName].gameObject.AddComponent <TutorialTrigger>();
                    categoryTrigger.isSaveCheckpoint = true;
                    categoryTrigger.priority         = priority++;
                    categoryTrigger.highlightObject  = true;
                    categoryTrigger.info             = categoriesTutorials[category.CategoryName];
                }

                //Set Block Count
                if (active)
                {
                    mMenuList[category.CategoryName].gameObject.SetActive(true);
                    List <string> blockTypes = mConfig.GetBlockCategory(category.CategoryName).BlockList;
                    foreach (string blockType in blockTypes)
                    {
                        CategoryBlocks info = activeCategories[category.CategoryName.ToLower()];
                        if (info.activate == (info.activeBlocks.ContainsKey(blockType)))
                        {
                            int value = (info.activeBlocks.ContainsKey(blockType) ? info.activeBlocks[blockType] : Int16.MaxValue);
                            Block.blocksAvailable[blockType] = value;
                        }
                    }
                }
            }
        }
Beispiel #18
0
 public override void Trigger(TutorialTrigger trigger)
 {
     if (trigger == TutorialTrigger.EnemyKilled)
     {
         LoadBlockingSteps(new List<TutFunc>()
         {
             () => RenderText("Nice job! You gained some experience points from killing that enemy. The yellow bar in the upper " +
                 "right hand corner of the screen shows your experience."),
             () => RenderText("Once your experience meter fills up, you will level up."),
             () => {
                 RenderText("You're almost at the next level already! There's one more enemy waiting for you in the next room - destroy " +
                 "the block obstructing your path and go defeat it.");
                 crate.SetInvincibility(false);
                 GoToNextState();
             }
         });
     }
 }
 public override void Trigger(TutorialTrigger trigger)
 {
     switch(trigger)
     {
         case TutorialTrigger.EnemyKilled:
             LoadBlockingSteps(new List<TutFunc>()
                 {
                     () => RenderText("Congratulations. You've leveled up! You can see your current level in the upper right hand display."),
                     () => {
                         RenderText("Press the tab key to open up your skill tree.");
                         skillTreeMissionAssigned = true;
                     }
                 });
             break;
         case TutorialTrigger.SkillTreeOpened:
             if (skillTreeMissionAssigned)
             {
                 MenuInitializer.LockMenu();
                 skillTreeMissionAssigned = false;
                 LoadBlockingSteps(new List<TutFunc>()
                 {
                     () => RenderText("This is your skill tree. Every time you level up, you get one skill point. You can use your skill points to buy new skills."),
                     () => RenderText("Most skills require you to reach a certain level and to have other skills before you can acquire them."),
                     () => RenderText("The greyed-out skills are the ones that you haven't fulfilled the requirements for yet (and therefore cannot purchase)."),
                     () => RenderText("You can hover over a skill to see its description and requirements."),
                     () => {
                         RenderText("Click on the non greyed-out skill in the upper left corner to acquire it.");
                         TutorialEngine.SkillNodesDisabled = false;
                         clickMissionAssigned = true;
                     }
                 });
                 }
             break;
         case TutorialTrigger.MachineGunAcquired:
             if (clickMissionAssigned)
             {
                 MenuInitializer.UnlockMenu();
                 GoToNextState();
             }
             break;
     }
 }
 public override void Trigger(TutorialTrigger trigger)
 {
     switch (trigger)
     {
         case TutorialTrigger.OpenInventory:
             if(openInventoryMissionAssigned)
             {
                 openInventoryMissionAssigned = false;
                 MenuInitializer.LockMenu();
                 RenderText("Notice that each side of the inventory has three slots. Drag the machine gun tile into one of the open " +
                     "left slots.");
                 equipMissionAssigned = true;
             }
             break;
         case TutorialTrigger.SecondLeftWeaponEquipped:
             if (equipMissionAssigned)
             {
                 equipMissionAssigned = false;
                 MenuInitializer.UnlockMenu();
                 RenderText("Both of your weapons are now assigned to the left mouse button. " +
                     "Exit the inventory with the shift key.");
                 closeInventoryMissionAssigned = true;
             }
             break;
         case TutorialTrigger.CloseInventory:
             if (closeInventoryMissionAssigned)
             {
                 closeInventoryMissionAssigned = false;
                 RenderText("To toggle your left weapon, press the q key. Try toggling a few times. Notice that your weapon " +
                     "changes each time.");
                 toggleMissionAssigned = true;
             }
             break;
         case TutorialTrigger.LeftWeaponSwitched:
             if (toggleMissionAssigned)
             {
                 toggleMissionAssigned = false;
                 Invoke("CompleteMission", 4f);
             }
             break;
     }
 }
Beispiel #21
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);

            priorTriggers     = new BinaryHeap <TutorialTrigger>();
            conditionTriggers = new List <TutorialTrigger>();

            triggered = new HashSet <string>();

            savePending = new List <TutorialTrigger>();
            saved       = new HashSet <string>();

            return;
        }
        Instance.tutorialsON = tutorialsON;
        needToBeDestroyed    = true;
        lastTutorialTrigger  = null;
    }
 public override void Trigger(TutorialTrigger trigger)
 {
     switch (trigger)
     {
         case TutorialTrigger.OpenInventory:
             if (openInventoryMissionAssigned)
             {
                 MenuInitializer.LockMenu();
                 openInventoryMissionAssigned = false;
                 LoadBlockingSteps(new List<TutFunc>()
                 {
                     () => RenderText("Notice that your machine gun is in the right slot now. This means you can fire it by " +
                         "clicking your right mouse button."),
                     () => {
                         MenuInitializer.UnlockMenu();
                         RenderText("Exit the inventory with the shift key and try firing your new weapon with the right mouse button.");
                         rightGunFiringMissionAssigned = true;
                     }
                 });
             }
             break;
         case TutorialTrigger.MachineGunFired:
             if (rightGunFiringMissionAssigned)
             {
                 rightGunFiringMissionAssigned = false;
                 Invoke("ExplainEnergy", 2.5f);
             }
             break;
         case TutorialTrigger.BothGunsFired:
             if (doubleFiringMissionAssigned)
             {
                 doubleFiringMissionAssigned = false;
                 Invoke("GoToNextState", 2.5f);
             }
             break;
     }
 }
Beispiel #23
0
    private TutorialTrigger TryPopConditionalTriggers()
    {
        if (conditionTriggers.Count == 0)
        {
            return(null);
        }
        if (popUpManager == null)
        {
            return(null);
        }
        if (popUpManager.IsShowing())
        {
            return(null);
        }

        TutorialTrigger trigger = conditionTriggers[0];

        if (trigger.condition.Invoke())
        {
            return(trigger);
        }

        return(null);
    }
Beispiel #24
0
 public void Trigger(TutorialTrigger trigger)
 {
     currentState.Trigger(trigger);
 }
Beispiel #25
0
 public abstract void Trigger(TutorialTrigger trigger);
 public TutorialProgressEvent(TutorialTrigger trigger, int level) : this(trigger)
 {
     this.level = level;
 }
 public TutorialProgressEvent(TutorialTrigger trigger, string identifier) : this(trigger)
 {
     this.identifier = identifier;
 }
Beispiel #28
0
 private void DispatchTrigger(TutorialTrigger trigger)
 {
     GlobalState.EventService.Dispatch(new TutorialProgressEvent(trigger, (int)GlobalState.User.currentLevel));
 }
Beispiel #29
0
        private void RegisterMapping(string eventName, TutorialTrigger trigger)
        {
            var eventType = Type.GetType(eventName);

            GlobalState.EventService.Persistent.AddEventHandler(eventType, () => { DispatchTrigger(trigger); });
        }
Beispiel #30
0
    void CheckTaskIsFinished(TaskInfo info)
    {
        switch (info.id)
        {
        case 7:
            if (SettingManager.Instance.WeaponUpgrade >= int.Parse(info.value))
            {
                btnReward.GetComponent <Collider>().enabled = true;
                progress.value = 1;
                TutorialTrigger tt = btnReward.AddComponent <TutorialTrigger>();
                tt.index           = 10;
                tt.needIncreaseSeq = true;
                StartCoroutine(FireTrigger());
            }
            else
            {
                btnReward.GetComponent <Collider>().enabled = false;
                progress.value = (float)SettingManager.Instance.WeaponUpgrade / float.Parse(info.value);
            }
            break;

        case 8:
            if (SettingManager.Instance.AdvantageModeTime >= int.Parse(info.value))
            {
                btnReward.GetComponent <Collider>().enabled = true;
                progress.value = 1;
            }
            else
            {
                btnReward.GetComponent <Collider>().enabled = false;
                progress.value = (float)SettingManager.Instance.AdvantageModeTime / float.Parse(info.value);
            }
            break;

        case 9:
            if (SettingManager.Instance.ChallegeModeTime >= int.Parse(info.value))
            {
                btnReward.GetComponent <Collider>().enabled = true;
                progress.value = 1;
            }
            else
            {
                btnReward.GetComponent <Collider>().enabled = false;
                progress.value = (float)SettingManager.Instance.ChallegeModeTime / float.Parse(info.value);
            }
            break;

        case 10:
            if (SettingManager.Instance.UseDaojuTime >= int.Parse(info.value))
            {
                btnReward.GetComponent <Collider>().enabled = true;
                progress.value = 1;
            }
            else
            {
                btnReward.GetComponent <Collider>().enabled = false;
                progress.value = (float)SettingManager.Instance.UseDaojuTime / float.Parse(info.value);
            }
            break;

        case 11:
            if (SettingManager.Instance.KillBossTime >= int.Parse(info.value))
            {
                btnReward.GetComponent <Collider>().enabled = true;
                progress.value = 1;
            }
            else
            {
                btnReward.GetComponent <Collider>().enabled = false;
                progress.value = (float)SettingManager.Instance.KillBossTime / float.Parse(info.value);
            }
            break;

        case 12:
            if (SettingManager.Instance.UseTiliNum >= int.Parse(info.value))
            {
                btnReward.GetComponent <Collider>().enabled = true;
                progress.value = 1;
            }
            else
            {
                btnReward.GetComponent <Collider>().enabled = false;
                progress.value = (float)SettingManager.Instance.UseTiliNum / float.Parse(info.value);
            }
            break;
        }
    }
 public TutorialProgressEvent(TutorialTrigger trigger)
 {
     this.trigger = trigger;
 }
Beispiel #32
0
    private void Awake()
    {
        instance = this;

        GameGlobals.Instance.messageBoxPanel.SetActive(true);
        GameGlobals.Instance.tutorialPanel.SetActive(true);


        handIcon = GameObject.Find("sprHand");
        handIcon.SetActive(false);



        GameGlobals.Instance.achievements.scoresLock = true;

        tutorialTriggers = this.transform.Find("tutorialTriggers").gameObject;

        // Message
        messageBoardTween = GameObject.Find("MessageBoxPanel").GetComponent <TweenPosition>();
        messageBoardTween.ResetToBeginning();
        lblMessage = GameObject.Find("lblMessage").GetComponent <Text>();
        GameGlobals.Instance.messageBoxPanel.SetActive(false);

        // Anims


        handIconSwipeLRAnim                 = handIcon.AddComponent <TweenPosition>();
        handIconSwipeLRAnim.enabled         = false;
        handIconSwipeLRAnim.from            = new Vector3(120, 0, 0);
        handIconSwipeLRAnim.to              = new Vector3(-120, 0, 0);
        handIconSwipeLRAnim.duration        = 1.0f;
        handIconSwipeLRAnim.ignoreTimeScale = true;

        handIconRollAnim                 = handIcon.AddComponent <TweenPosition>();
        handIconRollAnim.enabled         = false;
        handIconRollAnim.from            = new Vector3(0, 120, 0);
        handIconRollAnim.to              = new Vector3(0, -120, 0);
        handIconRollAnim.duration        = 1.0f;
        handIconRollAnim.ignoreTimeScale = true;

        handIconJumpAnim                 = handIcon.AddComponent <TweenPosition>();
        handIconJumpAnim.enabled         = false;
        handIconJumpAnim.from            = new Vector3(0, 0, 0);
        handIconJumpAnim.to              = new Vector3(0, 90, 0);
        handIconJumpAnim.duration        = 1.0f;
        handIconJumpAnim.ignoreTimeScale = true;

        handIconTapAnim         = handIcon.AddComponent <TweenPosition>();
        handIconTapAnim.enabled = false;
        //handIconTapAnim.delay = 0.7f;
        handIconTapAnim.from            = new Vector3(0, 0, 0);
        handIconTapAnim.to              = new Vector3(0, -50, 0);
        handIconTapAnim.duration        = 0.3f;
        handIconTapAnim.ignoreTimeScale = true;

        if (tutorialTriggers != null)
        {
            foreach (Transform trigger in tutorialTriggers.transform)
            {
                TutorialTrigger onTriggerObject = trigger.GetComponent <TutorialTrigger>();
                if (onTriggerObject != null)
                {
                    onTriggerObject.OnEnter = (TutorialTrigger.OnEnterDelegate)Delegate.Combine(onTriggerObject.OnEnter, new TutorialTrigger.OnEnterDelegate(this.OnPlayerEnter));
                    onTriggerObject.OnExit  = (TutorialTrigger.OnExitDelegate)Delegate.Combine(onTriggerObject.OnExit, new TutorialTrigger.OnExitDelegate(this.OnPlayerExit));
                }
            }
        }
    }
Beispiel #33
0
 /// <summary>
 /// Funzione che gestisce l'evento di apertura del pannello tutorial
 /// </summary>
 /// <param name="_trigger"></param>
 private void HandleOnTutorialPanelOpen(TutorialTrigger _trigger)
 {
     tutorialPanel.SetupTutorialPanel(_trigger.GetTutorialSprite(), _trigger.GetTutorialText());
     ToggleTutorialPanel(true);
 }
Beispiel #34
0
 /// <summary>
 /// Funzione che gestisce l'evento di chiusura del pannello tutorial
 /// </summary>
 /// <param name="_trigger"></param>
 private void HandleOnTutorialPanelClosed(TutorialTrigger _trigger)
 {
     ToggleTutorialPanel(false);
 }