Beispiel #1
0
    ////////////////////////////////////////////////////////////////
    // Public Methods
    ////////////////////////////////////////////////////////////////

    /// <summary>
    /// Registers when the player completes a certain task
    /// </summary>
    /// <param name="task">The task which the player completed</param>
    public static void RegisterTask(TutorialTask task)
    {
        if (instance != null && task == instance.curEvent.Task)
        {
            instance.taskCount++;

            // Clear jump help text if they sucessfully jumped
            if (task == TutorialTask.Jump)
            {
                HUD.UpdateTutorialHelpText("");
            }

            // If this was the last time they needed to repeat this task, load the next one
            if (instance.taskCount >= instance.curEvent.TaskNum)
            {
                instance.LoadNextEvent();
            }

            // Otherwise update the HUD task counter with the number of remaining repetitions
            else if (instance.curEvent.TaskCountText != null)
            {
                HUD.UpdateTutorialTaskCountText(instance.curEvent.TaskCountText, instance.curEvent.TaskNum - instance.taskCount);
            }
        }
    }
    protected override void SetTask(TutorialTask task)
    {
        if (activeTask != null)
        {
            switch (activeTask.eventIndex)
            {
            case 0:
                laserPointer.OnLaserShow -= TaskNeedsVerification;
                break;

            case 1:
                laserPointer.OnTeleport -= TaskNeedsVerification;
                break;
            }
        }

        activeTask = task;
        switch (activeTask.eventIndex)
        {
        case 0:
            laserPointer.OnLaserShow += TaskNeedsVerification;
            break;

        case 1:
            laserPointer.OnTeleport += TaskNeedsVerification;
            break;
        }

        base.UpdateDisplay();
    }
Beispiel #3
0
 /// <summary>
 /// Registers when the player completes a certain task
 /// </summary>
 /// <param name="task">The task which the player completed</param>
 /// <param name="consumable">The consumable which the player collected</param>
 public static void RegisterTask(TutorialTask task, Consumables consumable)
 {
     // Only register the task if the player collected the correct consumable
     if (instance != null && instance.curEvent.RequiredConsumable.HasValue && consumable == instance.curEvent.RequiredConsumable.Value)
     {
         RegisterTask(task);
     }
 }
Beispiel #4
0
    public void ReportBackwardProgress(TutorialTask tutorialTask)
    {
        if (subTasks.ContainsKey(tutorialTask))
        {
            subTasks[tutorialTask] = false;
            subtasksCompleted--;

            isAreaCleared = false;
            AreaCleared(false);
        }
    }
Beispiel #5
0
    // Gets report from the task
    public void ReportForwardProgress(TutorialTask tutorialTask)
    {
        if (subTasks.ContainsKey(tutorialTask))
        {
            subTasks[tutorialTask] = true;
            subtasksCompleted++;

            if (subtasksCompleted >= numberOfSubtasks)
            {
                isAreaCleared = true;
                AreaCleared(true);
            }
        }
    }
    private void StartTutorial()
    {
        activeTask = allTasks[0];

        //object instantiation
        GameObject go;

        if (!NoObjectToTeach)
        {
            go = Instantiate(objectToTeachPrefab);
            go.transform.SetParent(transform, true);
            go.transform.position = objectSpawnPoint.position;
            go.transform.rotation = objectSpawnPoint.rotation;
            instanceOfObject      = go.GetComponent <TutorialInteractable>();
            objectToTeach         = go;
            if (instanceOfObject == null)
            {
                instanceOfObject = go.GetComponentInChildren <TutorialInteractable>();
                if (instanceOfObject == null)
                {
                    throw new System.Exception("ObjectToTeach does not have the TutorialIntertactable Interface");
                }
            }
            if (ObjectToTeachHover)
            {
                objectHover = go.GetComponentInChildren <ScreenHoverBehaviour>();
            }
        }


        //screen instantiation

        go = Instantiate(screenPrefab);
        go.transform.SetParent(transform, true);
        go.transform.position = screenSpawnPoint.position;
        go.transform.rotation = screenSpawnPoint.rotation;
        screenHover           = go.GetComponentInChildren <ScreenHoverBehaviour>();

        image       = GameObject.Find("TutorialImage").GetComponent <RawImage>();
        description = GameObject.Find("description").GetComponent <Text>(); //very awful (:
        title       = GameObject.Find("Title").GetComponent <Text>();

        UpdateDisplay();

        SetTask(activeTask); //meh
    }
    protected virtual void SetTask(TutorialTask task)
    {
        if (NoObjectToTeach)
        {
            throw new Exception("The SetTask Methods needs to be overwritten if you dont have a object to teach.");
        }
        if (activeTask != null)
        {
            if (instanceOfObject.taskCompleted[activeTask.eventIndex] != null)
            {
                instanceOfObject.taskCompleted[activeTask.eventIndex] -= TaskNeedsVerification;
            }
        }

        activeTask = task;
        instanceOfObject.taskCompleted[activeTask.eventIndex] += TaskNeedsVerification;

        UpdateDisplay();
    }
Beispiel #8
0
 private void Awake()
 {
     reported     = false;
     tutorialTask = GetComponentInParent <TutorialTask>();
 }
 public TutorialAction(TutorialTask action, int parameters)
 {
     Action = action;
     Params = parameters;
 }
 public void StartTutorialTask()
 {
     if (this.nextStartFromId != 10)
     {
         if ((this.nextStartFromId > 0) && (this.nextStartFromId < 10))
         {
             this.onGoingTutorial = this.GetTutorialOfId(this.nextStartFromId);
             if (this.onGoingTutorial == null)
             {
                 return;
             }
             this.onGoingStepIndex = 0;
             this.onGoingStep = this.onGoingTutorial.steps[this.onGoingStepIndex];
         }
         this.CheckStepAppealAction(string.Empty);
     }
 }
Beispiel #11
0
 public void SetCurrentTask(TutorialTask desiredTask)
 {
     currentTask = desiredTask;
 }