Beispiel #1
0
 private void Sync()
 {
     if (dialogueSystemVariable == null || string.IsNullOrEmpty(dialogueSystemVariable.Value))
     {
         LogWarning(DialogueDebug.Prefix + ": Dialogue System Variable isn't assigned or is blank.");
     }
     else if (playMakerVariable == null)
     {
         LogWarning(DialogueDebug.Prefix + ": PlayMaker Variable isn't assigned or is blank.");
     }
     else
     {
         if (toDialogueSystem != null && toDialogueSystem.Value == true)
         {
             var gameObjectName = (playMakerVariable.Value != null) ? playMakerVariable.Value.name : "null-object";
             DialogueLua.SetVariable(dialogueSystemVariable.Value, gameObjectName);
         }
         else
         {
             var gameObjectName = DialogueLua.GetVariable(dialogueSystemVariable.Value).AsString;
             playMakerVariable.Value = DialogueSystemPlayMakerTools.FindOrLoadGameObject(gameObjectName, searchSceneObjects.Value, searchPrefabs.Value);
         }
     }
 }
Beispiel #2
0
 private IEnumerator StartConversationAfterSaveSystem(string title)
 {
     for (int i = 0; i < (SaveSystem.framesToWaitBeforeApplyData + 1); i++)
     {
         yield return(null);
     }
     if (!DialogueManager.isConversationActive)
     {
         DialogueLua.SetVariable("Conversation", title);
         var textlineDialogueUI = FindObjectOfType <TextlineDialogueUI>();
         if (DialogueLua.DoesVariableExist(textlineDialogueUI.currentDialogueEntryRecords))
         {
             var originalDontLoadScenes = textlineDialogueUI.dontLoadConversationInScenes;
             textlineDialogueUI.dontLoadConversationInScenes = new int[0] {
             };                                                                // Make sure we load regardless of scene.
             textlineDialogueUI.OnApplyPersistentData();
             textlineDialogueUI.dontLoadConversationInScenes = originalDontLoadScenes;
         }
         else
         {
             DialogueManager.StartConversation(title);
         }
     }
 }
Beispiel #3
0
 public static void SavePlayerPosition(Vector3 playerPos)
 {
     DialogueLua.SetVariable(Consts.VariableName.playerPosX, playerPos.x);
     DialogueLua.SetVariable(Consts.VariableName.playerPosY, playerPos.y);
     DialogueLua.SetVariable(Consts.VariableName.playerPosZ, playerPos.z);
 }
        public string CreateStarterBlossom()
        {
            string name       = GetRandomBlossomName();
            string newBlossom = CreateRandomBlossom(name, BlossomData.BlossomGrowth.Baby, 20, 20, 0.5f, 0.5f, 0, 1, 2, string.Empty, new Vector2(0, 0), false);

            Dictionary <string, int> colorPool = new Dictionary <string, int>();
            BlossomColor             blue      = Resources.Load <BlossomColor>("BlossomColors/Blue");

            colorPool.Add(blue.Name, blue.Probability);
            BlossomColor red = Resources.Load <BlossomColor>("BlossomColors/Red");

            colorPool.Add(red.Name, red.Probability);
            BlossomColor yellow = Resources.Load <BlossomColor>("BlossomColors/Yellow");

            colorPool.Add(yellow.Name, yellow.Probability);
            BlossomColor green = Resources.Load <BlossomColor>("BlossomColors/Green");

            colorPool.Add(green.Name, green.Probability);

            string color = WeightedRandomizer.From(colorPool).TakeOne();

            DialogueLua.SetVariable(newBlossom + "Color", color);
            //STAT POTENTIAL BONUS DISTRIBUTION
            for (int potentialBonus = 30; potentialBonus > 0; potentialBonus--)
            {
                List <string> availableStats = new List <string>();
                if (DialogueLua.GetVariable(newBlossom + "AgilityPotential").asFloat < 40)
                {
                    availableStats.Add("AgilityPotential");
                }
                if (DialogueLua.GetVariable(newBlossom + "StrengthPotential").asFloat < 40)
                {
                    availableStats.Add("StrengthPotential");
                }
                if (DialogueLua.GetVariable(newBlossom + "IntellectPotential").asFloat < 40)
                {
                    availableStats.Add("IntellectPotential");
                }
                if (DialogueLua.GetVariable(newBlossom + "CharmPotential").asFloat < 40)
                {
                    availableStats.Add("CharmPotential");
                }
                if (availableStats.Count > 0)
                {
                    int   rand       = Random.Range(0, availableStats.Count);
                    float currentVal = DialogueLua.GetVariable(newBlossom + availableStats[rand]).asFloat;
                    DialogueLua.SetVariable(newBlossom + availableStats[rand], currentVal + 1);
                }
                else
                {
                    break;
                }
            }

            //STAT LEARNING SPEED BONUS DISTRIBUTION
            for (int learningSpeedBonus = 5; learningSpeedBonus > 0; learningSpeedBonus--)
            {
                List <string> availableStats = new List <string>();

                availableStats.Add("AgilityLearningSpeed");
                availableStats.Add("StrengthLearningSpeed");
                availableStats.Add("IntellectLearningSpeed");
                availableStats.Add("CharmLearningSpeed");

                if (availableStats.Count > 0)
                {
                    int   rand       = Random.Range(0, availableStats.Count);
                    float currentVal = DialogueLua.GetVariable(newBlossom + availableStats[rand]).asFloat;
                    DialogueLua.SetVariable(newBlossom + availableStats[rand], currentVal + 0.1f);
                }
                else
                {
                    break;
                }
            }


            return(newBlossom);
        }
        public string CreateChildBlossom(string pParent1, string pParent2)
        {
            //CREATE BLOSSOM

            BlossomData newBlossom = Instantiate(BlossomPrefab, transform);

            newBlossom.ID = "Blossom" + CurrentBlossomID.ToString();
            string ID = newBlossom.ID;

            CurrentBlossomID += 1;
            newBlossom.Age    = 0;
            newBlossom.Name   = GetRandomBlossomName();



            newBlossom.Parent1 = pParent1;
            newBlossom.Parent2 = pParent2;

            newBlossom.Energy = 2;

            //STATS
            //Agility
            newBlossom.Agility.Value         = 0;
            newBlossom.Agility.Potential     = SetChildStat(pParent1, pParent2, "AgilityPotential");
            newBlossom.Agility.LearningSpeed = SetChildStat(pParent1, pParent2, "AgilityLearningSpeed");
            //Strength
            newBlossom.Strength.Value         = 0;
            newBlossom.Strength.Potential     = SetChildStat(pParent1, pParent2, "StrengthPotential");
            newBlossom.Strength.LearningSpeed = SetChildStat(pParent1, pParent2, "StrengthLearningSpeed");
            //Intellect
            newBlossom.Intellect.Value         = 0;
            newBlossom.Intellect.Potential     = SetChildStat(pParent1, pParent2, "IntellectPotential");
            newBlossom.Intellect.LearningSpeed = SetChildStat(pParent1, pParent2, "IntellectLearningSpeed");
            //Charm
            newBlossom.Charm.Value         = 0;
            newBlossom.Charm.Potential     = SetChildStat(pParent1, pParent2, "CharmPotential");
            newBlossom.Charm.LearningSpeed = SetChildStat(pParent1, pParent2, "CharmLearningSpeed");


            //TRAITS
            string dominantParent;
            int    rand = Random.Range(0, 100);

            if (rand <= 50)
            {
                dominantParent = pParent2;
            }
            else
            {
                dominantParent = pParent1;
            }
            Dictionary <Trait, int> parentTraits = new Dictionary <Trait, int>();

            List <Trait> parent1Traits      = new List <Trait>();
            int          parent1TraitAmount = DialogueLua.GetVariable(pParent1 + "TraitAmount").asInt;

            for (int i = 0; i < parent1TraitAmount; i++)
            {
                string traitName = DialogueLua.GetVariable(pParent1 + "Trait" + i).asString;
                parent1Traits.Add(Resources.Load <Trait>("BlossomTraits/" + traitName));
            }

            List <Trait> parent2Traits      = new List <Trait>();
            int          parent2TraitAmount = DialogueLua.GetVariable(pParent2 + "TraitAmount").asInt;

            for (int i = 0; i < parent1TraitAmount; i++)
            {
                string traitName = DialogueLua.GetVariable(pParent2 + "Trait" + i).asString;
                parent1Traits.Add(Resources.Load <Trait>("BlossomTraits/" + traitName));
            }

            List <Trait> dominantTraits    = new List <Trait>();
            List <Trait> nonDominantTraits = new List <Trait>();

            if (dominantParent == pParent1)
            {
                dominantTraits    = parent1Traits;
                nonDominantTraits = parent2Traits;
            }
            else
            {
                dominantTraits    = parent2Traits;
                nonDominantTraits = parent1Traits;
            }

            foreach (Trait trait in dominantTraits)
            {
                if (!parentTraits.ContainsKey(trait))
                {
                    parentTraits.Add(trait, trait.Probabilty * 2);
                }
            }

            foreach (Trait trait in nonDominantTraits)
            {
                if (!parentTraits.ContainsKey(trait))
                {
                    parentTraits.Add(trait, trait.Probabilty);
                }
                else
                {
                    parentTraits[trait] += trait.Probabilty;
                }
            }

            rand = Random.Range(1, 2);
            for (int i = 0; i < rand; i++)
            {
                Trait trait = WeightedRandomizer.From(parentTraits).TakeOne();
                if (!newBlossom.Traits.Contains(trait))
                {
                    newBlossom.Traits.Add(trait);
                }
            }



            //STAT POTENTIAL BONUS DISTRIBUTION
            for (int potentialBonus = 10; potentialBonus > 0; potentialBonus--)
            {
                List <string> availableStats = new List <string>();
                availableStats.Add("AgilityPotential");
                availableStats.Add("StrengthPotential");
                availableStats.Add("IntellectPotential");
                availableStats.Add("CharmPotential");

                if (availableStats.Count > 0)
                {
                    rand = Random.Range(0, availableStats.Count);
                    float currentVal = DialogueLua.GetVariable(newBlossom + availableStats[rand]).asFloat;
                    DialogueLua.SetVariable(newBlossom + availableStats[rand], currentVal + 1);
                }
                else
                {
                    break;
                }
            }

            //STAT LEARNING SPEED BONUS DISTRIBUTION
            for (int learningSpeedBonus = 2; learningSpeedBonus > 0; learningSpeedBonus--)
            {
                List <string> availableStats = new List <string>();

                availableStats.Add("AgilityLearningSpeed");
                availableStats.Add("StrengthLearningSpeed");
                availableStats.Add("IntellectLearningSpeed");
                availableStats.Add("CharmLearningSpeed");

                if (availableStats.Count > 0)
                {
                    rand = Random.Range(0, availableStats.Count);
                    float currentVal = DialogueLua.GetVariable(newBlossom + availableStats[rand]).asFloat;
                    DialogueLua.SetVariable(newBlossom + availableStats[rand], currentVal + 0.1f);
                }
                else
                {
                    break;
                }
            }


            string parent1Color = DialogueLua.GetVariable(pParent1 + "Color").asString;
            string parent2Color = DialogueLua.GetVariable(pParent2 + "Color").asString;

            BlossomColorMix[] allMixes    = Resources.LoadAll <BlossomColorMix>("BlossomColorMixes");
            BlossomColorMix   matchingMix = null;

            foreach (BlossomColorMix mix in allMixes)
            {
                if ((mix.Input1.Name == parent1Color && mix.Input2.Name == parent2Color) || (mix.Input1.Name == parent2Color && mix.Input2.Name == parent1Color))
                {
                    matchingMix = mix;
                }
            }
            if (matchingMix != null)
            {
                Dictionary <string, int> outputs = new Dictionary <string, int>();
                foreach (ColorOutput output in matchingMix.Outputs)
                {
                    outputs.Add(output.Output.Name, output.Output.Probability);
                }
                string color = WeightedRandomizer.From(outputs).TakeOne();
                newBlossom.Color = color;
            }
            else
            {
                Dictionary <string, int> parentColors = new Dictionary <string, int>();
                BlossomColor             color1       = Resources.Load <BlossomColor>("BlossomColors/" + parent1Color);
                BlossomColor             color2       = Resources.Load <BlossomColor>("BlossomColors/" + parent2Color);

                parentColors.Add(color1.Name, color1.Probability);
                if (!parentColors.ContainsKey(color2.Name))
                {
                    parentColors.Add(color2.Name, color2.Probability);
                }
                string color = WeightedRandomizer.From(parentColors).TakeOne();
                newBlossom.Color = color;
            }


            //DESTROY OBJECT
            Destroy(newBlossom.gameObject);
            return(ID);
        }
Beispiel #6
0
        void CheckPregnancy()
        {
            if (Data.Growth != BlossomData.BlossomGrowth.Adult)
            {
                return;
            }
            if (Data.Pregnant == true)
            {
                return;
            }
            if (BlossomManager.Instance.HutAmount >= BlossomManager.Instance.MaxHuts)
            {
                return;
            }
            bool pregnantChance = false;

            int rand = Random.Range(0, 101);

            if (rand <= 15)
            {
                pregnantChance = true;
            }

            if (pregnantChance == true)
            {
                //CHECK COMPATIBLE BLOSSOMS
                List <string> compatibleBlossoms = new List <string>();
                string        match = string.Empty;
                foreach (string blossom in BlossomManager.Instance.OwnedBlossoms)
                {
                    if (Data.ID == blossom)
                    {
                        continue;
                    }
                    if (Data.Parent1 == blossom)
                    {
                        continue;
                    }
                    if (Data.Parent2 == blossom)
                    {
                        continue;
                    }
                    BlossomData.BlossomGrowth growth = (BlossomData.BlossomGrowth)System.Enum.Parse(typeof(BlossomData.BlossomGrowth), DialogueLua.GetVariable(blossom + "Growth").asString);
                    print(growth.ToString());
                    if (growth != BlossomData.BlossomGrowth.Adult)
                    {
                        continue;
                    }
                    if (DialogueLua.GetVariable(blossom + "Pregnant").asBool == true)
                    {
                        continue;
                    }
                    compatibleBlossoms.Add(blossom);
                }
                if (compatibleBlossoms.Count > 0)
                {
                    rand  = Random.Range(0, compatibleBlossoms.Count - 1);
                    match = compatibleBlossoms[rand];
                }
                else
                {
                    print("no compat");
                }
                //IF MATCH FOUND
                if (match != string.Empty)
                {
                    Data.BabyID = BlossomManager.Instance.CreateChildBlossom(Data.ID, match);
                    PixelCrushers.MessageSystem.SendMessage(this, "PregnantBlossom", Data.ID);
                    string babyHut = BlossomManager.Instance.GetEmptyHut();
                    DialogueLua.SetVariable(babyHut + "Blossom", Data.BabyID);
                    DialogueLua.SetVariable(Data.BabyID + "HutX", DialogueLua.GetVariable(babyHut + "X").asFloat);
                    DialogueLua.SetVariable(Data.BabyID + "HutY", DialogueLua.GetVariable(babyHut + "Y").asFloat);
                    DialogueLua.SetVariable(Data.BabyID + "HutName", babyHut);
                    Data.Pregnant     = true;
                    Data.DaysPregnant = 0;
                    GetComponent <BlossomDataSaver>().OnRecordPersistentData();
                }
            }
        }
Beispiel #7
0
 public void ShowResultConversation(int pRank)
 {
     DialogueLua.SetVariable("CompetitionRank", pRank);
     DialogueManager.StartConversation("Competition Result", CompetitionPresenter);
     CompetitionDone = true;
 }
Beispiel #8
0
        private void DrawVariableWatch(Watch watch)
        {
            if (watch == null)
            {
                return;
            }
            CatalogueWatchableVariableNames();
            var needToEvaluate = false;

            EditorGUI.BeginChangeCheck();
            watch.variableIndex = EditorGUILayout.Popup(watch.variableIndex, watchableVariableNames);
            if (EditorGUI.EndChangeCheck())
            {
                watch.variable = FindVariableInDatabase(watch.variableIndex);
                EvaluateVariableWatch(watch);
            }
            var variableName = GetWatchedVariableName(watch.variableIndex);

            if (string.IsNullOrEmpty(variableName))
            {
                EditorGUI.BeginDisabledGroup(true);
                EditorGUILayout.TextField(string.Empty);
                EditorGUI.EndDisabledGroup();
            }
            else if (watch.variable != null && watch.variable.Type == FieldType.Actor)
            {
                EditorGUI.BeginChangeCheck();
                var actorIndex = DrawAssetPopup <Actor>(watch.variableValue.asString, database.actors, GUIContent.none);
                if (EditorGUI.EndChangeCheck())
                {
                    DialogueLua.SetVariable(variableName, Tools.StringToInt(actorIndex));
                    needToEvaluate = true;
                }
            }
            else if (watch.variable != null && watch.variable.Type == FieldType.Location)
            {
                EditorGUI.BeginChangeCheck();
                var locationIndex = DrawAssetPopup <Location>(watch.variableValue.asString, database.locations, GUIContent.none);
                if (EditorGUI.EndChangeCheck())
                {
                    DialogueLua.SetVariable(variableName, Tools.StringToInt(locationIndex));
                    needToEvaluate = true;
                }
            }
            else if (watch.variableValue.isTable)
            {
                EditorGUI.BeginDisabledGroup(true);
                EditorGUILayout.TextField("(table)");
                EditorGUI.EndDisabledGroup();
            }
            else if (watch.variableValue.isBool)
            {
                EditorGUI.BeginChangeCheck();
                var booleanTypeValue = (BooleanType)EditorGUILayout.EnumPopup(watch.variableValue.asBool ? BooleanType.True : BooleanType.False);
                if (EditorGUI.EndChangeCheck())
                {
                    DialogueLua.SetVariable(variableName, booleanTypeValue == BooleanType.True);
                    needToEvaluate = true;
                }
            }
            else if (watch.variableValue.isNumber)
            {
                EditorGUI.BeginChangeCheck();
                var floatValue = EditorGUILayout.FloatField(watch.variableValue.asFloat);
                if (EditorGUI.EndChangeCheck())
                {
                    DialogueLua.SetVariable(variableName, floatValue);
                    needToEvaluate = true;
                }
            }
            else
            {
                EditorGUI.BeginChangeCheck();
                var stringValue = EditorGUILayout.TextField(watch.variableValue.asString);
                if (EditorGUI.EndChangeCheck())
                {
                    DialogueLua.SetVariable(variableName, stringValue);
                    needToEvaluate = true;
                }
            }
            if (needToEvaluate)
            {
                EvaluateVariableWatch(watch);
            }
        }
Beispiel #9
0
 void OnRecordPersistentData()
 {
     DialogueLua.SetVariable(VariableName + "CurrentGrowth", TargetProp.CurrentGrowth);
 }
Beispiel #10
0
    /**
     * Sets DialogueManager variable based on item given to an NPC
     */
    private void SetDialogueVariable(string item, string npc)
    {
        //*************************
        // Equip Quest
        //*************************
        if (item == "knightsword" && npc == "ian")
        {
            DialogueLua.SetVariable("QUARTER_MASTER_HAS_SWORD", true);
            DialogueManager.StartConversation("Equip Quest");
        }
        else if (item == "knightshield" && npc == "ian")
        {
            DialogueLua.SetVariable("QUARTER_MASTER_HAS_SHIELD", true);
            DialogueManager.StartConversation("Equip Quest");
        }
        else if (npc == "ian")
        {
            DialogueLua.SetVariable("QUARTER_MASTER_GIVEN_NONQUEST_ITEM", true);
        }

        //*************************
        // Pilgrimage Quest
        //*************************
        else if (item == "tastycupcake" && npc == "alli")
        {
            DialogueLua.SetVariable("TROLL_GIVEN_FOOD", true);
            DialogueManager.StartConversation("Pilgrimage Quest");
        }
        else if (npc == "alli")
        {
            DialogueLua.SetVariable("TROLL_GIVEN_NONQUEST_ITEM", true);
        }

        //*************************
        // Wisdom Quest
        //*************************
        else if (item == "coin" && npc == "james")
        {
            DialogueLua.SetVariable("RIDDLER_GIVEN_COINS", true);
            DialogueManager.StartConversation("Wisdom Quest");
        }
        else if (item == "humanskull" && npc == "james")
        {
            DialogueLua.SetVariable("RIDDLER_GIVEN_SKULL", true);
            DialogueManager.StartConversation("Wisdom Quest");
        }
        else if (item == "candle" && npc == "james")
        {
            DialogueLua.SetVariable("RIDDLER_GIVEN_CANDLE", true);
            DialogueManager.StartConversation("Wisdom Quest");
        }
        else if (npc == "james")
        {
            DialogueLua.SetVariable("RIDDLER_GIVEN_NONQUEST_ITEM", true);
        }

        //*************************
        // Love Quest
        //*************************
        else if (item == "loveletter" && npc == "jordan")
        {
            DialogueLua.SetVariable("LOVER_B_GIVEN_LETTER", true);
            DialogueManager.StartConversation("Love Quest B");
        }
        else if (item == "rubyring" && npc == "dorian")
        {
            DialogueLua.SetVariable("LOVER_A_GIVEN_RING", true);
            DialogueManager.StartConversation("Love Quest A");
        }
        else if (item == "bouquet" && npc == "dorian")
        {
            DialogueLua.SetVariable("LOVER_A_GIVEN_FLOWERS", true);
            DialogueManager.StartConversation("Love Quest A");
        }
//		else if (npc == "dorian")
//		{
//			DialogueLua.SetVariable("LOVER_A_GIVEN_NONQUEST_ITEM", true);
//		}
        else if (item == "lovecontract" && npc == "jordan")
        {
            DialogueLua.SetVariable("LOVER_B_GIVEN_CONTRACT", true);
            DialogueManager.StartConversation("Love Quest B");
        }

        //*************************
        // Fetch Quest
        //*************************
        else if (npc == "giovanna")
        {
            // sets variable that is shown inside dialogue
            DialogueLua.SetVariable("fetchQuestItem", item);

            // determine if quest or non-quest item is given
            if (item == "hairtonic")
            {
                DialogueLua.SetVariable("APPRAISER_GIVEN_QUEST_ITEM", true);
                DialogueManager.StartConversation("Fetch Quest");
            }
            else
            {
                DialogueLua.SetVariable("APPRAISER_GIVEN_NONQUEST_ITEM", true);
            }
        }
        else if (item == "ash" && npc == "frank")
        {
            DialogueLua.SetVariable("BANKER_GIVEN_ASH", true);
            DialogueManager.StartConversation("Banker");
        }
    }
Beispiel #11
0
    // Called by the mediator when the player successfully executes an action.
    public void UpdateTutorialState(string playerAction)
    {
        // When the player first talks to the wizard, the talk to action has been completed.
        if (playerAction.Equals("(talk-to arthur mel storage)") &&
            DialogueLua.GetVariable("WIZARD_TUTORIAL_TALK_TO_ACTION_COMPLETED").AsBool == false)
        {
            DialogueLua.SetVariable("WIZARD_TUTORIAL_TALK_TO_ACTION_COMPLETED", true);
            DialogueManager.StartConversation("Wizard");
        }

        // This condition happens when the player has picked up the bucket before talking to Mel.
        else if (playerAction.Equals("(pickup arthur basementbucket storage)") &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_PICK_UP_ACTION_STARTED").AsBool == false)
        {
            DialogueLua.SetVariable("WIZARD_TUTORIAL_PICK_UP_ACTION_COMPLETED", true);
        }

        // When the player picks up the bucket next to the wizard, the pickup action has been completed.
        else if (playerAction.Equals("(pickup arthur basementbucket storage)") &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_PICK_UP_ACTION_STARTED").AsBool == true &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_PICK_UP_ACTION_COMPLETED").AsBool == false)
        {
            DialogueLua.SetVariable("WIZARD_TUTORIAL_PICK_UP_ACTION_COMPLETED", true);
            DialogueManager.StartConversation("Wizard");
        }

        // When the player drops the bucket in the world, the drop action has been completed.
        else if (playerAction.Equals("(drop arthur basementbucket storage)") &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_DROP_ACTION_STARTED").AsBool == true &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_DROP_ACTION_COMPLETED").AsBool == false)
        {
            DialogueLua.SetVariable("WIZARD_TUTORIAL_DROP_ACTION_COMPLETED", true);
            DialogueLua.SetVariable("WIZARD_TUTORIAL_GIVE_ACTION_STARTED", true);

            // At this point we can add that the wizard wants the bucket to the initial state.
            // Create the literal: (wants-item mel basementbucket)
            IPredicate wants_basementbucket = Predicate.BuildPositiveGroundLiteral("wants-item", "mel", "basementbucket");

            // Update the problem.
            mediator.ExpandInitialState(wants_basementbucket);
            DialogueManager.StartConversation("Wizard");
        }

        // When the player gives the bucket to the wizard, the give action has been completed.
        else if (playerAction.Equals("(give arthur basementbucket mel storage)") &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_GIVE_ACTION_STARTED").AsBool == true &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_GIVE_ACTION_COMPLETED").AsBool == false)
        {
            DialogueLua.SetVariable("WIZARD_TUTORIAL_GIVE_ACTION_COMPLETED", true);
            DialogueManager.StartConversation("Wizard");
        }

        // When the player moves through the doorway toward the basement, the go to action has been completed.
        else if (playerAction.Equals("(move-through-doorway arthur storage basement)") &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_GOTO_ACTION_STARTED").AsBool == true &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_GOTO_ACTION_COMPLETED").AsBool == false)
        {
            DialogueLua.SetVariable("WIZARD_TUTORIAL_GOTO_ACTION_COMPLETED", true);
            DialogueLua.SetVariable("WIZARD_TUTORIAL_LOOKAT_ACTION_STARTED", true);

            // Now we have to move merlin over to the other room.
            // Swap two literals in the initial state to make that happen:
            // (at mel storage) for (at mel basement)

            IPredicate at_storage  = Predicate.BuildPositiveGroundLiteral("at", "mel", "storage");
            IPredicate at_basement = Predicate.BuildPositiveGroundLiteral("at", "mel", "basement");

            // Update the planning problem,
            mediator.SwapProblemInitialStateLiterals(at_storage, at_basement);

            // Start the wizard dialogue - which should be at the point the player has entered the room.
            DialogueManager.StartConversation("Wizard");
        }

        // When the player looks at the locked entrance, the look at action has been completed.
        else if (playerAction.Equals("(look-at arthur basementexit basement)") &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_LOOKAT_ACTION_STARTED").AsBool == true &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_LOOKAT_ACTION_COMPLETED").AsBool == false)
        {
            DialogueLua.SetVariable("WIZARD_TUTORIAL_LOOKAT_ACTION_COMPLETED", true);
            DialogueLua.SetVariable("WIZARD_TUTORIAL_USE_ACTION_STARTED", true);
            DialogueManager.StartConversation("Wizard");
        }

        // When the player uses the key on the entrance, the use action has been completed.
        else if (playerAction.Equals("(unlock-entrance arthur basementexitkey basementexit basement)") &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_USE_ACTION_STARTED").AsBool == true &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_USE_ACTION_COMPLETED").AsBool == false)
        {
            DialogueLua.SetVariable("WIZARD_TUTORIAL_USE_ACTION_COMPLETED", true);
            DialogueLua.SetVariable("WIZARD_TUTORIAL_OPEN_ACTION_STARTED", true);
            DialogueManager.StartConversation("Wizard");
        }

        // When the player opens the entrance, the open action has been completed.
        else if (playerAction.Equals("(open arthur basementexit basement)") &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_OPEN_ACTION_STARTED").AsBool == true &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_OPEN_ACTION_COMPLETED").AsBool == false)
        {
            DialogueLua.SetVariable("WIZARD_TUTORIAL_OPEN_ACTION_COMPLETED", true);
            DialogueLua.SetVariable("WIZARD_TUTORIAL_GOTOENTRANCE_ACTION_STARTED", true);
            DialogueManager.StartConversation("Wizard");
        }

        // When the player goes to the entrance, the go to action has been completed.
        else if (playerAction.Equals("(move-through-entrance arthur basement basementexit bar)") &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_GOTOENTRANCE_ACTION_STARTED").AsBool == true &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_GOTOENTRANCE_ACTION_COMPLETED").AsBool == false)
        {
            DialogueLua.SetVariable("WIZARD_TUTORIAL_GOTOENTRANCE_ACTION_COMPLETED", true);


            // Now we have to move merlin over to the bar room.
            // Swap two literals in the initial state to make that happen:
            // (at mel storage) for (at mel basement)

            IPredicate at_storage  = Predicate.BuildPositiveGroundLiteral("at", "mel", "basement");
            IPredicate at_basement = Predicate.BuildPositiveGroundLiteral("at", "mel", "bar");

            // Update the planning problem,
            mediator.SwapProblemInitialStateLiterals(at_storage, at_basement);


            DialogueManager.StartConversation("Wizard");
        }

        // When the player closes the entrance, the close action has been completed.
        else if (playerAction.Equals("(close arthur basemententrance bar)") &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_CLOSE_ACTION_STARTED").AsBool == true &&
                 DialogueLua.GetVariable("WIZARD_TUTORIAL_CLOSE_ACTION_COMPLETED").AsBool == false)
        {
            DialogueLua.SetVariable("WIZARD_TUTORIAL_CLOSE_ACTION_COMPLETED", true);
            DialogueLua.SetVariable("TUTORIAL_FINISHED", true);

            // Here, we need to remove the literal from the goal that was artificially added to disallow the player
            // from leaving the bar.  Create the literal: (at arthur bar)
            IPredicate at_bar = Predicate.BuildPositiveGroundLiteral("at", "arthur", "bar");

            // Update the problem.
            mediator.ContractGoalState(at_bar);

            // Begin game dialogue!
            DialogueManager.StartConversation("Wizard");
        }
    }
Beispiel #12
0
 private void Start()
 {
     cg = GetComponentInChildren <CanvasGroup>();
     at = GetComponent <AlertTrigger>();
     DialogueLua.SetVariable("End", false);
 }
 void BeforeSceneChange()
 {
     DialogueLua.SetVariable(VariableName + "CompetitionDone", GetComponent <BlossomCompetitionManager>().CompetitionDone);
 }
 void OnRecordPersistentData()
 {
     DialogueLua.SetVariable(VariableName + "Object Amount", TargetSpawner.SpawnedObjects.Count);
 }
Beispiel #15
0
 public void OnRecordPersistentData()
 {
     TargetSlot   = GetComponent <BlossomSaleSlot>();
     VariableName = "BlossomSaleSlot" + gameObject.name;
     DialogueLua.SetVariable(VariableName + "ContainedBlossom", TargetSlot.ContainedBlossom);
 }
        public void OnRecordPersistentData()
        {
            TargetData   = GetComponent <BlossomData>();
            VariableName = TargetData.ID;

            DialogueLua.SetVariable(VariableName + "ID", TargetData.ID);
            //STATS
            DialogueLua.SetVariable(VariableName + "AgilityValue", TargetData.Agility.Value);
            DialogueLua.SetVariable(VariableName + "AgilityPotential", TargetData.Agility.Potential);
            DialogueLua.SetVariable(VariableName + "AgilityLearningSpeed", TargetData.Agility.LearningSpeed);

            DialogueLua.SetVariable(VariableName + "StrengthValue", TargetData.Strength.Value);
            DialogueLua.SetVariable(VariableName + "StrengthPotential", TargetData.Strength.Potential);
            DialogueLua.SetVariable(VariableName + "StrengthLearningSpeed", TargetData.Strength.LearningSpeed);

            DialogueLua.SetVariable(VariableName + "IntellectValue", TargetData.Intellect.Value);
            DialogueLua.SetVariable(VariableName + "IntellectPotential", TargetData.Intellect.Potential);
            DialogueLua.SetVariable(VariableName + "IntellectLearningSpeed", TargetData.Intellect.LearningSpeed);

            DialogueLua.SetVariable(VariableName + "CharmValue", TargetData.Charm.Value);
            DialogueLua.SetVariable(VariableName + "CharmPotential", TargetData.Charm.Potential);
            DialogueLua.SetVariable(VariableName + "CharmLearningSpeed", TargetData.Charm.LearningSpeed);


            //FAMILY
            if (TargetData.Parent1 != string.Empty)
            {
                DialogueLua.SetVariable(VariableName + "Parent1", TargetData.Parent1);
            }
            if (TargetData.Parent2 != string.Empty)
            {
                DialogueLua.SetVariable(VariableName + "Parent2", TargetData.Parent2);
            }

            DialogueLua.SetVariable(VariableName + "ChildAmount", TargetData.Children.Count);
            int i = 0;

            foreach (string child in TargetData.Children)
            {
                DialogueLua.SetVariable(VariableName + "Child" + i, child);
                i++;
            }

            DialogueLua.SetVariable(VariableName + "Name", TargetData.Name);
            DialogueLua.SetVariable(VariableName + "Age", TargetData.Age);

            DialogueLua.SetVariable(VariableName + "Growth", TargetData.Growth.ToString());
            DialogueLua.SetVariable(VariableName + "Affection", TargetData.Affection);
            DialogueLua.SetVariable(VariableName + "Energy", TargetData.Energy);
            DialogueLua.SetVariable(VariableName + "Pregnant", TargetData.Pregnant);
            DialogueLua.SetVariable(VariableName + "DaysPregnant", TargetData.DaysPregnant);
            DialogueLua.SetVariable(VariableName + "BabyID", TargetData.BabyID);
            DialogueLua.SetVariable(VariableName + "PetToday", TargetData.PetToday);
            DialogueLua.SetVariable(VariableName + "TalkedToday", TargetData.TalkedToday);
            DialogueLua.SetVariable(VariableName + "FedToday", TargetData.FedToday);
            DialogueLua.SetVariable(VariableName + "Hungry", TargetData.Hungry);
            DialogueLua.SetVariable(VariableName + "Happiness", TargetData.Happiness);

            DialogueLua.SetVariable(VariableName + "TraitAmount", TargetData.Traits.Count);
            i = 0;
            foreach (Trait trait in TargetData.Traits)
            {
                DialogueLua.SetVariable(VariableName + "Trait" + i, trait.Name);
                i++;
            }

            DialogueLua.SetVariable(VariableName + "CurrentLevel", TargetData.CurrentLevel);
            DialogueLua.SetVariable(VariableName + "CurrentX", TargetData.transform.position.x);
            DialogueLua.SetVariable(VariableName + "CurrentY", TargetData.transform.position.y);

            DialogueLua.SetVariable(VariableName + "Color", TargetData.Color);

            DialogueLua.SetVariable(VariableName + "ForSale", TargetData.ForSale);
        }
 //Set player gender to choose correct audio files for player dialogue
 public void setPlayerGender(bool gender)
 {
     DialogueLua.SetVariable("QuestVariables.IsPlayerMale", gender);
 }
 /// <summary>
 /// sets the internal variable that dictates the given audio clip was already played
 /// </summary>
 /// <param name="audioClipName"></param>
 private void markAsPlayedAlready(string audioClipName)
 {
     DialogueLua.SetVariable(this.buildOnceVarName(audioClipName), true);
 }
Beispiel #19
0
    }    //End of Start

    // Update is called once per frame
    void Update()
    {
        //Toggles DebugPanel onscreen
        if (Input.GetKeyDown(KeyCode.F11))
        {
            debugActive = !debugActive;
            debugScreen.GetComponent <Image>().enabled = !this.GetComponent <Image>().enabled;
            konduktööri1DebugText.enabled       = !konduktööri1DebugText.enabled;
            myyjä1DebugText.enabled             = !myyjä1DebugText.enabled;
            myyjä2DebugText.enabled             = !myyjä2DebugText.enabled;
            mummo1DebugText.enabled             = !mummo1DebugText.enabled;
            nuoriNainen1DebugText.enabled       = !nuoriNainen1DebugText.enabled;
            conversationActiveDebugText.enabled = !conversationActiveDebugText.enabled;
        }

        //Sets quest status to innitial.
        if (Input.GetKeyDown(KeyCode.F5) && debugActive)
        {
            DialogueLua.SetVariable("QuestVariables.LipunTarkastus1Done", true);
            DialogueLua.SetVariable("QuestVariables.Tarjoilija1Done", false);
            DialogueLua.SetVariable("QuestVariables.Tarjoilija2Done", false);
            DialogueLua.SetVariable("QuestVariables.Mummo1Done", false);
            DialogueLua.SetVariable("QuestVariables.NuoriNainen1Done", false);
        }

        //Sets quest status to after first talk with myyjä
        if (Input.GetKeyDown(KeyCode.F6) && debugActive)
        {
            DialogueLua.SetVariable("QuestVariables.LipunTarkastus1Done", true);
            DialogueLua.SetVariable("QuestVariables.Tarjoilija1Done", true);
            DialogueLua.SetVariable("QuestVariables.Tarjoilija2Done", false);
            DialogueLua.SetVariable("QuestVariables.Mummo1Done", false);
            DialogueLua.SetVariable("QuestVariables.NuoriNainen1Done", false);
        }

        //Sets quest status to after second talk with myyjä
        if (Input.GetKeyDown(KeyCode.F7) && debugActive)
        {
            DialogueLua.SetVariable("QuestVariables.LipunTarkastus1Done", true);
            DialogueLua.SetVariable("QuestVariables.Tarjoilija1Done", true);
            DialogueLua.SetVariable("QuestVariables.Tarjoilija2Done", true);
            DialogueLua.SetVariable("QuestVariables.Mummo1Done", false);
            DialogueLua.SetVariable("QuestVariables.NuoriNainen1Done", false);
        }

        //Sets quest status adter mummo keskustelu
        if (Input.GetKeyDown(KeyCode.F8) && debugActive)
        {
            DialogueLua.SetVariable("QuestVariables.LipunTarkastus1Done", true);
            DialogueLua.SetVariable("QuestVariables.Tarjoilija1Done", true);
            DialogueLua.SetVariable("QuestVariables.Tarjoilija2Done", true);
            DialogueLua.SetVariable("QuestVariables.Mummo1Done", true);
            DialogueLua.SetVariable("QuestVariables.NuoriNainen1Done", false);
        }

        //Updates debug text fields
        konduktööri1DebugText.text       = "LipunTarkastus1Done: " + DialogueLua.GetVariable("QuestVariables.LipunTarkastus1Done").AsBool;
        myyjä1DebugText.text             = "Myyjä1Done: " + DialogueLua.GetVariable("QuestVariables.Tarjoilija1Done").AsBool;
        myyjä2DebugText.text             = "Myyjä2Done: " + DialogueLua.GetVariable("QuestVariables.Tarjoilija2Done").AsBool;
        mummo1DebugText.text             = "Mummo1Done: " + DialogueLua.GetVariable("QuestVariables.Mummo1Done").AsBool;
        nuoriNainen1DebugText.text       = "NuoriNainen1Done: " + DialogueLua.GetVariable("QuestVariables.NuoriNainen1Done").AsBool;
        conversationActiveDebugText.text = "ConversationActive: " + DialogueLua.GetVariable("QuestVariables.ConversationActive").AsBool;
    }    //End of update