예제 #1
0
    // Chest has been opened
    public void ChestOpened(GameObject chest)
    {
        Debug.Log("Chest opened!");

        // Count the open chest
        questManager.ChestOpened(chest.GetComponent <Chest>().Index());

        // Set the screen ui and destroy the key
        hud.SetQuestProgressText(questManager.ChestsOpened() + "/" + questManager.TotalChests());

        // Remove the key from the hud and destroy
        hud.RemoveKey(chest.GetComponent <Chest>().GetKey().GetHUDItemKey(), chest.GetComponent <Chest>().GetKey().GetHUDItemArtefact());
        chest.GetComponent <Chest>().GetKey().DestroyKey();

        // If the chests have all been opened
        if (questManager.AllChestsOpened())
        {
            questComplete = true;
            Debug.Log("Open chests quest complete");
        }
    }