Esempio n. 1
0
        public VerbHolder(StemGenerator generator)
        {
            verbs = new Dictionary <string, Verb>
            {
                {
                    "Change color", new Verb("Change color",
                                             (noun, adjective, verb) =>
                    {
                        if (adjective == null)
                        {
                            return(false);
                        }
                        if (noun == null)
                        {
                            return(false);
                        }
                        if (adjective.propertyType == "color" && noun.properties.ContainsKey("color"))
                        {
                            noun.properties["color"] = adjective.englishTerm;
                            return(true);
                        }
                        return(false);
                    }, (noun, adjective) => $"Poof! The {noun.myNoun.englishMeaning.ToLower( )} changes color to {adjective.englishTerm}!", () => "Suddenly vibrant colors splash around the room, but in the end nothing happens."
                                             )
                },
            };
            verbEnding = "ra";
            Debug.WriteLine("Verbs:");

            foreach (var verb in verbs)
            {
                verb.Value.verb = generator.GenerateRoot(verb.Value.englishTerm).stem + verbEnding;
                Debug.WriteLine($">>>{verb.Value.englishTerm} : {verb.Value.verb}");
            }
        }
        public void Start(string[] args)
        {
            Instance           = this;
            _nounEndingHandler = new NounEndingHandler();
            _stemGenerator     = new StemGenerator();
            _nounHolder        = _stemGenerator.GenerateAllStems(true);
            _verbHolder        = new VerbHolder(_stemGenerator);
            _adjectiveHolder   = new AdjectiveHolder(_stemGenerator);
            NounPrefabs.Init(_nounHolder, _verbHolder, _adjectiveHolder, _nounEndingHandler);
            _gameState = new GameState();

            CmdRegistration.RegisterCommands();

            if (args.Length != 0)
            {
                return;
            }
            MainGameLoop();
        }
 public AdjectiveHolder(StemGenerator generator)
 {
     adjectives = new Dictionary <string, Adjective>
     {
         //Colors
         { "red", new Adjective("color", "red", generator) },
         { "green", new Adjective("color", "green", generator) },
         { "blue", new Adjective("color", "blue", generator) },
         { "orange", new Adjective("color", "orange", generator) },
         { "white", new Adjective("color", "white", generator) },
         { "pink", new Adjective("color", "pink", generator) },
         { "yellow", new Adjective("color", "yellow", generator) },
         { "teal", new Adjective("color", "teal", generator) },
         { "black", new Adjective("color", "black", generator) },
         { "purple", new Adjective("color", "purple", generator) }
     };
     Debug.WriteLine("Adjectives:");
     foreach (var adjective in adjectives)
     {
         Debug.WriteLine($">>>{adjective.Key} : {adjective.Value.word}");
     }
 }
 public Adjective(string propertyType, string englishTerm, StemGenerator generator)
 {
     this.propertyType = propertyType;
     this.englishTerm  = englishTerm;
     word = generator.GenerateRoot(englishTerm).stem;
 }