Example #1
0
    // Use this for initialization
    void Start()
    {
        var sample = new SampleAdventure();

        adventure = new TextAdventure(sample.Locations);

        ChangeUI();
    }
Example #2
0
 public NoxApp(
     IJSRuntime jsRuntime,
     string containerId,
     TextAdventure <string> adventure
     ) : base(jsRuntime, containerId)
 {
     _adventure = adventure;
 }
Example #3
0
 // Update is called once per frame
 void Update()
 {
     if (game == null)
     {
         this.gameObject.AddComponent<TextAdventure>();
         game = GetComponent<TextAdventure>();
     }
 }
Example #4
0
        protected override async Task OnInitializedAsync()
        {
            AppState.IsSideNavHidden = true;

            _adventure = await TextAdventure.LoadFromJsonAsync(_http, "data/jorson/games/nox/adventure.json");

            _adventure.Initialize();

            _application = new NoxApp(_jsRuntime, "nox-container", _adventure);
            _application.Start();
        }
Example #5
0
    static void Main()
    {
        Console.WriteLine("Which level you wanna play? Easy or Medium");
        string InputLevel = Console.ReadLine();

        Console.WriteLine("What's your name?");
        string        name    = Console.ReadLine();
        TextAdventure newGame = new TextAdventure(name, InputLevel, "");

        newGame.StartGame();
        newGame.DifficultylevelEasy();
    }
Example #6
0
 public override void OnNotify(object entity, TextAdventure.Observers.EventList eventType)
 {
     if (eventType != TextAdventure.Observers.EventList.OnPlayerCommand)
     {
         return;
     }
     string currentAction = (string)entity;
     currentAction = currentAction.ToLower ().Trim ();
     if (action != currentAction)
     {
         return;
     }
     string currentParam = Language.Processor.GetCommandParameters (currentAction);
     currentParam = currentParam.ToLower ().Trim (); // Probably not needed but I'm being pedantic
     if (currentParam == param)
     {
         actionPerformed = true;
         Player.player.RemoveObserver (this);
     }
 }
Example #7
0
 // Use this for initialization
 void Start()
 {
     game = GetComponent<TextAdventure>();
 }
Example #8
0
    private void Start()
    {
        // Dialog played when adventure is finished.
        string finishedDialog = "The game is now completed. All the trials of friendship and endurance are now over,\nand the team faces the age-old question.\nWHAT DO WE DO NOW? (hint: press Enter)";

        // Responses sent upon invalid answer.
        string[] wrongAnswerDialogs = new string[]
        {
            "Wrong answer!",
            "Try that again, please!"
        };

        // Adventure nodes.
        List <TextNode> nodes = new List <TextNode>()
        {
            new TextNode(
                "A group of four engineer students, Pidgin, Siquel, Bab and Eeneku have arrived at the game jam site in Kajaani.\nA mighty task lies ahead of them, for they must be able to complete a video game in mere 48 hours!\nAfter a while of planning, the group gets to work on their game. Hours pass, and the team is making good progress.\nSoon however, a wild bug appears in the code!\nThe error is not critical, but it could hamper their progress later.\nWhat should the team do?\n\n- solve\n- ignore\n",
                new string[] { "The engineers decide that their time is too important to waste on something so small, and ignore the problem.\n", "The clever engineers realise how this small issue might bite their asses later, and they decide to spend a few hours working on the problem.\n" },
                AdventureBuilder.CreateAnswers()
                .AddAnswer("ignore", 1)
                .AddAnswer("solve", 2)),

            new TextNode(
                "Several hours later everyone on the team is happily coding away, when suddenly all the computers crash simultaneously!\nThe poor engineers are shocked. They wonder if all their hard earned progress is now lost.\nThe situation looks dire, what should the team do?\n\n- give up\n- try to save data\n",
                new string[] { "Their morale has been crushed, and the team decides to give up on the game jam. However, some of the members disagree on the matter.\n", "Even though it seems hopeless, Siquel proves himself as the hero, and restores all of their data from the hard drives.\n" },
                AdventureBuilder.CreateAnswers()
                .AddAnswer("give up", 3)
                .AddAnswer("try to save data", 4)),

            new TextNode(
                "The bug is crushed and development of the game is going smoothly. The team is sure that their game will absolutely be game of the year material.\nIt's late at night, and the classroom is getting quiet. One of the engineers, Siquel, decides to go get a cup of water.\nOn the way back however, he trips on a bag and the water splashes all over a nearby computer!\nThe computer short circuits, and soon smoke is filling the classroom!\nA fire alarm is activated, and everyone is racing to evacuate the building.\nWill the team risk losing the data, or risk themselves trying to save it from destruction?\n\n- try to save data\n- get out safely\n",
                new string[] { "The data is too important to lose, and Pidgin heroically puts out the flames with a fire extinguisher.\n", "The engineers decide that since their life is more important than a simple jam game, it's better to just escape from the potential danger while they can.\n " },
                AdventureBuilder.CreateAnswers()
                .AddAnswer("try to save data", 5)
                .AddAnswer("get out safely", 3)),

            new TextNode(
                "A while later the team is sitting in the lounge, trying to figure out how to continue their project.\nAfter the data was lost, some arguments started to rise between the members. Especially Pidgin and Siquel.\nThis argument soon grew into loud bickering and name-calling, and the others had to step in before things got out of hand. It's obvious that the team needs a new direction, but who will be the one to win the argument?\n\n- Siquel\n- Pidgin\n",
                new string[] { "Siquel wins the argument, and the team gets back to work on their game.\n", "Pidgin wins the argument, and the team gets back to work on their game.\n" },
                AdventureBuilder.CreateAnswers()
                .AddAnswer("Siquel", 4)
                .AddAnswer("Pidgin", 5)),

            new TextNode(
                "With Siquel's ideas the team finally gets back on track with their game.\nEverything is working great, and the team is happy to get along with each other again.\nSoon, the final lines of code are written, and the team is happy with their achievement.\n\n- finish game",
                new string[] { "" },
                AdventureBuilder.CreateAnswers()
                .AddAnswer("finish game", 10)),

            new TextNode(
                "With Pidgin's clever ideas, the team is soon back on track with their jam game.\nThe game looks incredible, with next gen graphics and several hundreds of hours worth of content.\nEverything is working great, but the team is still angry with each other.\nEven after all of their accomplishments, there is still some tension left in the air.\n\n- finish game",
                new string[] { "" },
                AdventureBuilder.CreateAnswers()
                .AddAnswer("finish game", 10)),
        };

        adventure = new TextAdventure(nodes, wrongAnswerDialogs, finishedDialog);

        // Terminal lines.
        adventure = new TextAdventure(nodes, wrongAnswerDialogs, finishedDialog);

        lines = new List <string>()
        {
            "AT THE GLOBAL GAME JAM 2015, FINLAND, KAJAANI...",
            adventure.CurrentNode.EnterDialog
        };

        // Input style.
        inputTextStyle = new GUIStyle();
        inputTextStyle.normal.textColor = Color.green;
        inputTextStyle.fontSize         = 20;

        // Output style.
        outputTextStyle = new GUIStyle();
        outputTextStyle.normal.textColor = Color.white;
        outputTextStyle.fontSize         = 20;

        inputTimer = Stopwatch.StartNew();

        maxLines = (int)(Screen.height / inputTextStyle.CalcSize(new GUIContent(" ")).y) - 2;

        currentLine = string.Empty;
    }
Example #9
0
 public override void OnNotify(object entity, TextAdventure.Observers.EventList eventType)
 {
     /* EMPTY */
 }