Beispiel #1
0
    /// <summary>
    /// This method writes what's on the inventory's bag to a .txt
    /// </summary>
    /// <param name="sender">The object that raised the event</param>
    /// <param name="e">Information about the event</param>
    private void WriteTXT(object sender = null,
                          NotifyCollectionChangedEventArgs e = null)
    {
        FileWriter fw = new FileWriter(FilePath.inventoryPath);

        fw.AddToTxt(Bag);
    }
Beispiel #2
0
    /// <summary>
    /// Abstract method to execute a certain action
    /// Plays victory or gives a certain objet to the player
    /// Adds a puzzle done to PlayerGeneralInfo and writes to txt
    /// </summary>
    public override void Execute()
    {
        // Adds puzzle to player's puzzles done
        PlayerGeneralInfo playerInfo = FindObjectOfType <PlayerGeneralInfo>();

        playerInfo.PuzzlesDone |= puzzleName;

        // Writes puzzles done to a txt
        FileWriter writer = new FileWriter(FilePath.puzzlePath);

        writer.AddToTxt(playerInfo);

        // Does an action to complete the puzzle
        switch (assistModeType)
        {
        case AssistModeType.PlayVictory:
            if (puzzleVariable != null)
            {
                base.ExecuteVictory(puzzleVariable);
            }
            break;

        case AssistModeType.AddPrizeToInventory:
            base.AddPrizeToInventory();
            break;
        }
    }
Beispiel #3
0
    /// <summary>
    /// Does an action when the puzzle is solved.
    /// </summary>
    public virtual void Victory()
    {
        // Adds mypuzzle to player's puzzles done
        player.PuzzlesDone |= myPuzzle;

        // Save puzzle to txt, so the txt will know which puzzles the player
        // has alreayd done
        FileWriter fw = new FileWriter(FilePath.puzzlePath);

        fw.AddToTxt(player);
    }
Beispiel #4
0
    /// <summary>
    /// Coroutine used to get next line from DialogText.
    /// This Coroutine also checks NPC's conditions to know if it can
    /// give items, or open a locked door
    /// </summary>
    /// <returns>Returns null</returns>
    private IEnumerator GetNextAction()
    {
        StartCoroutine(dialog.GetNextLine());
        yield return(waitForSecs);

        // If player has a not rewound audio tape
        if (dialog.OpenDoor)
        {
            doorToOpen.SetTrigger("Open Door");

            PlayerGeneralInfo player = FindObjectOfType <PlayerGeneralInfo>();
            // Adds mypuzzle to player's puzzles done
            player.PuzzlesDone |= PuzzlesEnum.Puzzle2;

            // Save puzzle to txt, so the txt will know which puzzles the player
            // has alreayd done
            FileWriter fw = new FileWriter(FilePath.puzzlePath);
            fw.AddToTxt(player);
        }

        // Give a map on the first time speaking
        else if (speakCounter == 0)
        {
            Inventory inventory = FindObjectOfType <Inventory>();
            inventory.Bag.Add(itemComparer.Map);
            speakCounter++;
        }

        else
        {
            speakCounter++;
        }

        // If speakcounter reaches max number of texts, resets the text
        // to a certain value
        if (speakCounter == dialog.LinesOfText.Length)
        {
            speakCounter = 1;
        }

        // Sets the coroutine to false so it can be called again
        ThisCoroutine = default;
        // Changes type of input
        input.ChangeTypeOfControl(TypeOfControl.InGameplay);
        yield break;
    }