Exemple #1
0
    //[PROGRAMMER] nQ's Script [PROGRAMMER] Finish

    //[PROGRAMMER] nQ's Script [PROGRAMMER] Start
    private IEnumerator firstMnQ(Action <bool> Accomplished)
    {
        Debug.Log("MnQuest #1 Initiated");

        //Detects when player enters cellar via doorBehaviour.cs message broadcast
        yield return(new WaitUntil(() => inCellar));

        Debug.Log("Entered cellar -ManagerAI");
        //Activates blackout screen
        ftTimer.SetActive(true);
        cellarLight.areLightsOn = true;
        cellarLight.BackgroundLightIntensity = 0;

        //Detects when player acquires wine keg
        Debug.Log("Gate reached");
        reachedObjectiveI = false;
        yield return(new WaitUntil(() => reachedObjectiveI));

        //Unlocks cellar exit
        Debug.Log("Objective Reached");
        Messenger <bool, int> .Broadcast("(un)lockCellar", true, 2);

        //Detects when player leaves cellar via doorBehaviour.cs message broadcast
        yield return(new WaitUntil(() => !inCellar));

        //Deactivates blackout screen
        //ftTimer.SetActive(false);
        cellarLight.areLightsOn = false;
        //Dropping held items:
        //Dropping carried barrel
        GameObject qObjective = movementRef.carriedObject;

        Sprite[] objOrientation = movementRef.ObjSprites;
        qObjective.GetComponent <SpriteRenderer> ().sprite = objOrientation [2];
        qObjective.transform.position = new Vector3(5, 1, 0);
        qObjective.transform.parent   = null;
        movementRef.isCarryingObj     = false;
        //Dropping held torch
        GameObject torchRef = movementRef.Torch.gameObject;

        torchRef.transform.position = new Vector3(5, 2, 0);
        torchRef.transform.parent   = null;
        movementRef.isCarryingTorch = false;

        barrelBehaviour brlComponent = qObjective.AddComponent <barrelBehaviour> ();

        brlComponent.isInteractable = true;

        Debug.Log("Quest Completed; Left the cellar");
        qStatus.qPhase [2] = 2;

        yield return(new WaitForSeconds(2.0f));

        Accomplished(true);
        yield break;
    }
Exemple #2
0
    //[PROGRAMMER] nQ's Script [PROGRAMMER] Finish

    //[PROGRAMMER] nQ's Script [PROGRAMMER] Start
    private IEnumerator firstMnQ(Action <bool> Accomplished)
    {
        Debug.Log("MnQuest #1 Initiated");

        //Detects when player enters cellar via doorBehaviour.cs message broadcast
        yield return(new WaitUntil(() => inCellar));

        Debug.Log("Entered cellar -ManagerAI");
        //Activates blackout screen
        ftTimer.SetActive(true);
        cellarLight.areLightsOn = true;
        cellarLight.BackgroundLightIntensity = 0;

        //Detects when player acquires wine keg
        Debug.Log("Gate reached");
        reachedObjectiveI = false;
        yield return(new WaitUntil(() => reachedObjectiveI));

        //Unlocks cellar exit
        Debug.Log("Objective Reached");
        Messenger <bool, int> .Broadcast("(un)lockCellar", true, 2);

        //Detects when player leaves cellar via doorBehaviour.cs message broadcast
        yield return(new WaitUntil(() => !inCellar));

        //Deactivates blackout screen
        //ftTimer.SetActive(false);
        cellarLight.areLightsOn = false;
        //Dropping held items:
        //Dropping carried barrel
        movementRef.isCarryingObj = false;
        GameObject qObjective = movementRef.carriedObject;

        Destroy(qObjective);
        GameObject NonobjectiveBrl = Resources.Load("Prefabs/defaultBarrel", typeof(GameObject)) as GameObject;
        Vector3    loadPos         = new Vector3(5, 1, 0);
        GameObject NonObjBrlRef    = Instantiate(NonobjectiveBrl, loadPos, Quaternion.identity);
        //Dropping held torch
        GameObject torchRef = movementRef.Torch.gameObject;

        torchRef.transform.position = new Vector3(5, 2, 0);
        torchRef.transform.parent   = null;
        movementRef.isCarryingTorch = false;

        barrelBehaviour brlComponent = qObjective.AddComponent <barrelBehaviour> ();

        brlComponent.isInteractable = true;

        Debug.Log("Quest Completed; Left the cellar");
        qStatus.qPhase [2] = 2;

        yield return(new WaitForSeconds(2.0f));

        Accomplished(true);
        yield break;
    }