Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        // Start out open, and set open and closed positions
        isClosed       = false;
        transformRect  = GetComponent <RectTransform>();
        openPosition   = transformRect.anchoredPosition;
        closedPosition = new Vector2(openPosition.x - 200, openPosition.y);

        CreateQuestList();
        DrawQuest(QuestManager.currentQuest);

        // Event stuff
        setExploreHouseEvent = new EnterHouseSetNextQuestEvent();
        setExploreHouseEvent.AddListener(SetQuest);
        EventManager.EnterHouseListener(MarkQuestAsComplete);
        EventManager.PickupKeyListener(SetQuest);
        EventManager.EnemyListener(SetQuest);
        EventManager.DoorListener(MarkQuestAsComplete);
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        useKeyEvent     = new UseKeyEvent();
        enterHouseEvent = new EnterHouseEvent();
        setNextQuest    = new EnterHouseSetNextQuestEvent();
        keyEvent        = new KeyEvent();
        EventManager.EnterHouseInvoker(this);
        EventManager.PickupKeyInvoker(this);
        EventManager.DoorInvoker(this);

        // Find tutorial text UI
        try
        {
            tutorialText = GameObject.Find("TutorialText").GetComponent <TutorialBehavior>();
        }
        catch (NullReferenceException)
        {
            {
                Debug.Log("Can't find tutorial text, moving on");
            }
        }

        // Mark Entering the house as complete
        if (SceneData.currentScene == "InteriorHouse" && SceneData.previousScene == "GameScene1")
        {
            enterHouseEvent.Invoke("Enter the house", "You have just arrived at the address, and there is only a house. Enter through the front door.");

            if (SceneData.numDeaths >= 2)
            {
                tutorialText.SetText("HINT: follow the enemy, hide in the closet, and wait for the enemy to pass by. But, don't get too close!");
            }
        }

        if (SceneData.currentScene == "InteriorHouse")
        {
            Debug.Log("did I get closet");
            closet = GameObject.Find("tempcloset").GetComponent <ClosetSounds>();
        }

        if (SceneData.currentScene == "Room2" && !hasBeenHere)
        {
            Debug.Log("Event being invoked?");
            useKeyEvent.Invoke("Find out where the key goes", "You have found a key. This probably opens a door somewhere");
        }

        // Get the audio component and clip attached to audio source
        audioSource      = GetComponent <AudioSource>();
        outsideFootsteps = audioSource.clip;

        // Set timer for footsteps
        timeFootsteps = 0f;

        // Get audio file for inside from Resources Folder
        insideFootsteps = Resources.Load("Sounds/indoorfootstep") as AudioClip;

        // Get the current scene, and set if footsteps are indoors or outdoors appropriately
        currentScene = SceneManager.GetActiveScene();
        if (currentScene.name == "GameScene1")
        {
            currentFootsteps = outsideFootsteps;
        }
        else
        {
            currentFootsteps = insideFootsteps;
        }

        // Set the audio source's clip to the correct footstep clip
        audioSource.clip = currentFootsteps;

        isMoving = false;
        StartPosition();

        // Find sanity bar
        try
        {
            terrorBar = GameObject.Find("TerrorBar").GetComponent <Image>();
        }
        catch (NullReferenceException e)
        {
            Debug.Log("Couldn't find terrorBar, moving on");
        }

        // Find inventory UI
        if (inventory == null)
        {
            try
            {
                inventory = GameObject.Find("Inventory").GetComponent <Inventory>();
            }
            catch (NullReferenceException)
            {
                Debug.Log("Can't find inventory, moving on");
            }
        }



        hiding = false;
        rb     = GetComponent <Rigidbody2D>();
    }