public void RegisterVariables(BaseGlobalVariables aStorage)
 {
     _VariableStorage = aStorage;
     aStorage.RegisterVariable("m_ArticyGlobalVariables.m_Gold", 0);
     aStorage.RegisterVariable("m_ArticyGlobalVariables.m_Scenario", 0);
     aStorage.RegisterVariable("m_ArticyGlobalVariables.m_CharacterCounter", 0);
 }
 public void RegisterVariables(BaseGlobalVariables aStorage)
 {
     _VariableStorage = aStorage;
     aStorage.RegisterVariable("GameState.awake", false);
     aStorage.RegisterVariable("GameState.looney_bin", false);
     aStorage.RegisterVariable("GameState.memory", false);
     aStorage.RegisterVariable("GameState.therapist_knockedOut", false);
     aStorage.RegisterVariable("GameState.therapist_gone", false);
     aStorage.RegisterVariable("GameState.door_open", false);
     aStorage.RegisterVariable("GameState.therapist_convinced", false);
     aStorage.RegisterVariable("GameState.looted", false);
     aStorage.RegisterVariable("GameState.listenedToVoice", false);
     aStorage.RegisterVariable("GameState.dialogue_beforeLobby", false);
     aStorage.RegisterVariable("GameState.dialogue_beforeCellar", false);
     aStorage.RegisterVariable("GameState.hamster_talkedTo", false);
     aStorage.RegisterVariable("GameState.hamster_saved", false);
     aStorage.RegisterVariable("GameState.overflow_open", false);
     aStorage.RegisterVariable("GameState.book_read", false);
     aStorage.RegisterVariable("GameState.locker_open", false);
     aStorage.RegisterVariable("GameState.lock_number", 0);
     aStorage.RegisterVariable("GameState.lock_correctNumbers", 0);
     aStorage.RegisterVariable("GameState.exit_open", false);
     aStorage.RegisterVariable("GameState.therapist_down", false);
     aStorage.RegisterVariable("GameState.therapist_knockedOut2", false);
     aStorage.RegisterVariable("GameState.guard_met", false);
     aStorage.RegisterVariable("GameState.guard_knockedOut", false);
     aStorage.RegisterVariable("GameState.guard_drugged", false);
 }
Beispiel #3
0
 public void RegisterVariables(BaseGlobalVariables aStorage)
 {
     _VariableStorage = aStorage;
     aStorage.RegisterVariable("GlobalVariables.EmiliaKids", false);
     aStorage.RegisterVariable("GlobalVariables.EmiliaPartner", false);
     aStorage.RegisterVariable("GlobalVariables.EmiliaHometown", false);
     aStorage.RegisterVariable("GlobalVariables.EmiliaLeaving", false);
     aStorage.RegisterVariable("GlobalVariables.EmiliaPlatform1", false);
     aStorage.RegisterVariable("GlobalVariables.screenshake", false);
     aStorage.RegisterVariable("GlobalVariables.AngerFrustration", 1);
     aStorage.RegisterVariable("GlobalVariables.AngerHurt", 1);
     aStorage.RegisterVariable("GlobalVariables.AngerPassive", 1);
     aStorage.RegisterVariable("GlobalVariables.AngerFurious", 1);
     aStorage.RegisterVariable("GlobalVariables.RaphaelYouCanSeeThat", false);
     aStorage.RegisterVariable("GlobalVariables.RaphaelArentYouScared", false);
     aStorage.RegisterVariable("GlobalVariables.RaphaelWhyAreYouHere", false);
     aStorage.RegisterVariable("GlobalVariables.Platform1", false);
     aStorage.RegisterVariable("GlobalVariables.Platform2", false);
     aStorage.RegisterVariable("GlobalVariables.Platform3", false);
     aStorage.RegisterVariable("GlobalVariables.Excitement", 1);
     aStorage.RegisterVariable("GlobalVariables.Optimism", 1);
     aStorage.RegisterVariable("GlobalVariables.Peacefulness", 1);
     aStorage.RegisterVariable("GlobalVariables.Thankfulness", 1);
     aStorage.RegisterVariable("GlobalVariables.Platform4", false);
     aStorage.RegisterVariable("GlobalVariables.Platform5", false);
     aStorage.RegisterVariable("GlobalVariables.Platform6", false);
     aStorage.RegisterVariable("GlobalVariables.EvenJob", false);
     aStorage.RegisterVariable("GlobalVariables.EvenFamily", false);
     aStorage.RegisterVariable("GlobalVariables.EvenFiancee", false);
     aStorage.RegisterVariable("GlobalVariables.EvenLife", false);
 }
 public void RegisterVariables(BaseGlobalVariables aStorage)
 {
     _VariableStorage = aStorage;
     aStorage.RegisterVariable("Game.side", 0);
     aStorage.RegisterVariable("Game.likes", false);
     aStorage.RegisterVariable("Game.intro", false);
     aStorage.RegisterVariable("Game.answer", false);
 }
 public void RegisterVariables(BaseGlobalVariables aStorage)
 {
     _VariableStorage = aStorage;
     aStorage.RegisterVariable("Inventory.crowbar", false);
     aStorage.RegisterVariable("Inventory.key", false);
     aStorage.RegisterVariable("Inventory.opener", false);
     aStorage.RegisterVariable("Inventory.hamster", false);
     aStorage.RegisterVariable("Inventory.aluminium", false);
     aStorage.RegisterVariable("Inventory.bomb", false);
     aStorage.RegisterVariable("Inventory.plutonium", false);
     aStorage.RegisterVariable("Inventory.detonator", false);
     aStorage.RegisterVariable("Inventory.enrichedPlutonium", false);
     aStorage.RegisterVariable("Inventory.cable", false);
     aStorage.RegisterVariable("Inventory.broom", false);
     aStorage.RegisterVariable("Inventory.constructionKit", false);
     aStorage.RegisterVariable("Inventory.bananaPill", false);
     aStorage.RegisterVariable("Inventory.banana", false);
     aStorage.RegisterVariable("Inventory.sleepingPills", false);
 }
 public static void SetVariableByGameState(this BaseGlobalVariables variables, GameState state)
 {
     variables.SetVariableByString(state.Id, state.Value);
 }
 public void RegisterVariables(BaseGlobalVariables aStorage)
 {
     _VariableStorage = aStorage;
     aStorage.RegisterVariable("Technical.TextSet", 0);
 }
 public void RegisterVariables(BaseGlobalVariables aStorage)
 {
     _VariableStorage = aStorage;
     aStorage.RegisterVariable("StoryEvents.Chp2_SpokeToFriend", false);
     aStorage.RegisterVariable("StoryEvents.Chp4_HelpedVillager", false);
 }
 public void RegisterVariables(BaseGlobalVariables aStorage)
 {
     _VariableStorage = aStorage;
     aStorage.RegisterVariable("Items.HasLantern", false);
 }
        public void SimpleCondition()
        {
            var globals = new BaseGlobalVariables()
            {
                World = new Contracts.World(),
            };

            Random rdm = new Random(5);

            ConditionCompiler <BaseGlobalVariables> processor = new ConditionCompiler <BaseGlobalVariables>(globals);

            Site site = new Site(new SiteDefinition());

            site.BaseAttributes["Health"]   = 5;
            site.BaseAttributes["Fear"]     = 23;
            site.BaseAttributes["Strength"] = 1;
            site.BaseAspects["Gender"]      = "Male";
            site.BaseAspects["IsInsane"]    = "true";
            site.BaseAspects["IsMoral"]     = "false";
            site.FinalizeConstruction(rdm);

            IDictionary <string, BaseThing> paramList = new Dictionary <string, BaseThing>()
            {
                { "Subject", site },
            };

            var variables = paramList.Select(x => new CompiledVariable(x.Key, x.Value.GetType())).ToList();

            // int conditions
            new[]
            {
                new { condition = "(Subject->Health + Subject->Fear) / 2", output = 14 },
                new { condition = "Subject->Health * Subject->Strength", output = 5 },
            }.ToList().ForEach(a =>
            {
                var condition = processor.AsSimple <int>(a.condition, variables);
                Assert.AreEqual(a.output, condition.Evaluate(rdm, paramList), a.condition);
            });

            // bool conditions
            new[]
            {
                new { condition = "Subject->Health <= 0", output = false },
                new { condition = "Subject-<bool>IsInsane", output = true },
                new { condition = "Subject-<bool>IsMoral", output = false },
            }.ToList().ForEach(a =>
            {
                var condition = processor.AsSimple <bool>(a.condition, variables);
                Assert.AreEqual(a.output, condition.Evaluate(rdm, paramList), a.condition);
            });

            // string conditions
            new[]
            {
                new { condition = "Subject-<>Gender", output = "Male" },
            }.ToList().ForEach(a =>
            {
                var condition = processor.AsSimple <string>(a.condition, variables);
                Assert.AreEqual(a.output, condition.Evaluate(rdm, paramList), a.condition);
            });

            var       conditions = new List <ICompiledCondition <bool> >();
            Stopwatch watch      = new Stopwatch();

            for (int i = 0; i < 500; i++)
            {
                watch = Stopwatch.StartNew();
                conditions.Add(processor.AsSimple <bool>("Subject->Health <= 0", variables));
                watch.Stop();
                Console.WriteLine($"Compiling took {watch.Elapsed} cached.");
            }
        }