Beispiel #1
0
    public void Apply()
    {
        TargetStorage = GetComponent <StorageObject>();

        if (TargetStorage.GetType() == typeof(PlayerInventory))
        {
            VariableName = "PlayerInventory";
        }
        else
        {
            VariableName = "Chest " + TargetStorage.Level + " " + transform.position.x.ToString() + "," + transform.position.y.ToString();
        }

        //        print(VariableName);
        int slotAmount = DialogueLua.GetVariable(VariableName + "SlotAmount").asInt;

        TargetStorage.Init = DialogueLua.GetVariable(VariableName + "Init").asBool;


        for (int i = 0; i < slotAmount; i++)
        {
            int    itemAmount         = DialogueLua.GetVariable(VariableName + "StackAmount" + i).asInt;
            string itemName           = DialogueLua.GetVariable(VariableName + "StackItem" + i).asString;
            string itemType           = DialogueLua.GetVariable(VariableName + "StackItemType" + i).asString;
            ItemSystem.ItemTypes type = (ItemSystem.ItemTypes)System.Enum.Parse(typeof(ItemSystem.ItemTypes), itemType);

            ItemBase item        = ItemSystem.Instance.GetItemClone(itemName);
            int      amountAdded = TargetStorage.Add(item, (uint)itemAmount);
            int      amountLeft  = itemAmount - amountAdded;
            if (amountLeft > 0)
            {
                Debug.LogWarning("Saver could not add all items to storage: " + TargetStorage.Name);
            }
        }
    }
    void OnApplyPersistentData()
    {
        VariableName = name + LevelName + transform.position.x.ToString("F2") + transform.position.ToString("F2");

        TargetSpawner.DaysPassed = DialogueLua.GetVariable(VariableName + "DaysPassed").asInt;
        TargetSpawner.GetTarget();
    }
Beispiel #3
0
        public virtual void LoadGameNow(int slotNum)
        {
            var saveData = (LoadSlotHandler == null) ? PlayerPrefs.GetString(GetSlotDataKey(slotNum)) : LoadSlotHandler(slotNum);

            if (useLoadingScene)
            {
                PersistentDataManager.LevelWillBeUnloaded();
                LoadingScene.SetLoadGameData(saveData);
                SceneManager.LoadScene(loadingSceneIndex);
            }
            else
            {
                FindLevelManager();
                if (levelManager != null)
                {
                    levelManager.LoadGame(saveData);
                }
                else
                {
                    Lua.Run(saveData, true);
                    PersistentDataManager.LevelWillBeUnloaded();
                    if (DialogueLua.DoesVariableExist("SavedLevelName"))
                    {
                        Tools.LoadLevel(DialogueLua.GetVariable("SavedLevelName").AsString);
                    }
                    else
                    {
                        RestartGame();
                    }
                    PersistentDataManager.ApplySaveData(saveData, DatabaseResetOptions.KeepAllLoaded);
                }
            }
        }
Beispiel #4
0
    void Update()
    {
        //if (InventoryManager.CheckItemAmount(100) > 0)
        //{
        //    print("You have the spear tip");
        //    hasTip = true;
        //    DialogueLua.SetVariable("hasTip", true);
        //}

        //if (InventoryManager.CheckItemAmount(101) > 0)
        //{
        //    print("You have the spear handle");
        //    hasHandle = true;
        //    DialogueLua.SetVariable("hasHandle", true);
        //}

        if (DialogueLua.GetVariable("hasTip").AsBool)
        {
            if (!hasTip)
            {
                InventoryManager.InventoryAdd(1, 100, true);
                hasTip = true;
            }
        }
    }
 /// <summary>
 /// Start the sequence and its corresponding text field UI.
 /// </summary>
 public void Start()
 {
     Transform textFieldUIObject = FindTextFieldUIObject();
     if (textFieldUIObject != null)
     {
         bool currentlyActive = textFieldUIObject.gameObject.activeSelf;
         if (!currentlyActive) textFieldUIObject.gameObject.SetActive(true);
         textFieldUI = textFieldUIObject.GetComponent(typeof(ITextFieldUI)) as ITextFieldUI;
         if (!currentlyActive) textFieldUIObject.gameObject.SetActive(false);
     }
     string labelText = GetParameter(1);
     variableName = GetParameter(2);
     int maxLength = GetParameterAsInt(3);
     bool clearField = string.Equals(GetParameter(4), "clear");
     if (DialogueDebug.logInfo) Debug.Log(string.Format("{0}: Sequencer: TextInput({1}, {2}, {3}, {4})", new System.Object[] { DialogueDebug.Prefix, Tools.GetObjectName(textFieldUIObject), labelText, variableName, maxLength }));
     if (string.IsNullOrEmpty(variableName))
     {
         if (DialogueDebug.logWarnings) Debug.Log(string.Format("{0}: Sequencer: TextInput({1}): The third parameter must be the name of a Dialogue System variable.", new System.Object[] { DialogueDebug.Prefix, GetParameters() }));
         Stop();
     }
     else if (textFieldUI == null)
     {
         if (DialogueDebug.logWarnings) Debug.Log(string.Format("{0}: Sequencer: TextInput(): Text Field UI not found on a GameObject '{1}'. Did you specify the correct GameObject name?", new System.Object[] { DialogueDebug.Prefix, GetParameter(0) }));
         Stop();
     }
     else
     {
         if (labelText.StartsWith("var="))
         {
             labelText = DialogueLua.GetVariable(labelText.Substring(4)).asString;
         }
         string variableValue = clearField ? string.Empty : DialogueLua.GetVariable(variableName).asString;
         textFieldUI.StartTextInput(labelText, variableValue, maxLength, OnAcceptedText);
     }
 }
Beispiel #6
0
    void Apply()
    {
        TargetModel      = GetComponent <CropModel>();
        TargetController = GetComponent <CropController>();


        VariableName = name + LevelName + transform.position.x.ToString("F2") + transform.position.ToString("F2");

        TargetController.Plot = GetPlot(transform.position);

        TargetModel.CurrentStage       = DialogueLua.GetVariable(VariableName + "CurrentStage").asInt;
        TargetModel.CurrentStageGrowth = DialogueLua.GetVariable(VariableName + "CurrentStageGrowth").asInt;
        TargetModel.WateredToday       = DialogueLua.GetVariable(VariableName + "WateredToday").asBool;
        TargetModel.CurrentlyWatered   = DialogueLua.GetVariable(VariableName + "CurrentlyWatered").asBool;
        TargetModel.StageWaterLevel    = DialogueLua.GetVariable(VariableName + "StageWaterLevel").asInt;
        TargetModel.StageSunLevel      = DialogueLua.GetVariable(VariableName + "StageSunLevel").asInt;
        TargetModel.CurrentWilt        = DialogueLua.GetVariable(VariableName + "CurrentWilt").asInt;
        TargetModel.Quality            = DialogueLua.GetVariable(VariableName + "Quality").asFloat;
        TargetModel.TimeSinceWatered   = DialogueLua.GetVariable(VariableName + "TimeSinceWatered").asInt;


        print("Plot: " + TargetController.Plot);

        TargetController.Plot.Crop = TargetController;
        TargetController.Load();
    }
    void OnApplyPersistentData()
    {
        VariableName              = GameManager.Instance.name;
        TargetManager             = GetComponent <GameManager>();
        TargetManager.GameStarted = DialogueLua.GetVariable(VariableName + "GameStarted").asBool;

        if (DialogueLua.DoesVariableExist(VariableName + "NativeTreeID"))
        {
            TargetManager.NativeTree  = TargetManager.PossibleNativeTrees[DialogueLua.GetVariable(VariableName + "NativeTreeID").asInt];
            TargetManager.NativeFruit = TargetManager.NativeTree.ProduceOutputs.Items[0].Item;
        }
        int shippedItemsAmt = DialogueLua.GetVariable(VariableName + "ShippedItemsAmount").AsInt;

        TargetManager.ShippedItems.Clear();
        for (int i = 0; i < shippedItemsAmt; i++)
        {
            string itemID             = DialogueLua.GetVariable(VariableName + "ShippedItemName" + i).AsString;
            string itemType           = DialogueLua.GetVariable(VariableName + "ShippedItemType" + i).AsString;
            ItemSystem.ItemTypes type = (ItemSystem.ItemTypes)System.Enum.Parse(typeof(ItemSystem.ItemTypes), itemType);
            ItemBase             item = ItemSystem.Instance.GetItemClone(itemID);
            print("got item: " + item.Name);
            ShippedItem newShippedItem = new ShippedItem();
            newShippedItem.ContainedItem = item;
            int amount = DialogueLua.GetVariable(VariableName + "ShippedItemAmount" + i).AsInt;
            TargetManager.AddShippedItem(item, amount);
        }
    }
        public void OnApplyPersistentData()
        {
            TargetManager = GetComponent <BlossomManager>();
            VariableName  = "BlossomManager";

            if (DialogueLua.DoesVariableExist(VariableName + "OwnedBlossomAmount") == false)
            {
                return;
            }
            TargetManager.CurrentBlossomID      = DialogueLua.GetVariable(VariableName + "CurrentBlossomID").asInt;
            TargetManager.OwnedBlossomAmount    = DialogueLua.GetVariable(VariableName + "OwnedBlossomAmount").asInt;
            TargetManager.ExistingBlossomAmount = DialogueLua.GetVariable(VariableName + "ExistingBlossomAmount").asInt;

            TargetManager.OwnedBlossoms.Clear();
            for (int i = 0; i < TargetManager.OwnedBlossomAmount; i++)
            {
                TargetManager.OwnedBlossoms.Add(DialogueLua.GetVariable(VariableName + "OwnedBlossom" + i).asString);
            }
            TargetManager.ExistingBlossoms.Clear();
            for (int i = 0; i < TargetManager.ExistingBlossomAmount; i++)
            {
                TargetManager.ExistingBlossoms.Add(DialogueLua.GetVariable(VariableName + "ExistingBlossom" + i).asString);
            }

            // TargetManager.BlossomHuts.Clear();
            // for (int i = 0; i < TargetManager.HutAmount; i++)
            // {
            //     TargetManager.BlossomHuts.Add(DialogueLua.GetVariable(VariableName + "Hut" + i).asString);
            // }

            GetComponent <BlossomCompetitionManager>().CompetitionDone = DialogueLua.GetVariable(VariableName + "CompetitionDone").asBool;
        }
Beispiel #9
0
    void SpawnHuman()
    {
        //CancelInvoke(); // Stop the timer (I don't think you need it, try without)

        string humanName = humans[currentHuman].GetComponent <HumanBuff>().humanName;
        bool   isDead    = DialogueLua.GetVariable(humanName + "Dead").AsBool;

        if (isDead)
        {
            Debug.Log("well " + humanName + " has dead already");
            return;
        }
        //int randomNum = Random.Range(0, totalNumberOfItemsInAvailableCars);
        //Object objTemp = Resources.Load("cars/" + randomNum);
        float   angle  = Random.Range(0f, 1f) * Mathf.PI * 2f;
        Vector3 newPos = new Vector3(Mathf.Cos(angle) * radius, Mathf.Sin(angle) * radius, 1);

        GameObject human_instance = Instantiate(humans[currentHuman], newPos, Quaternion.identity);

        human_instance.GetComponent <HumanBuff>().buffType = HumanBuff.BuffType.Degree;
        // Start a new timer for the next random spawn
        if (Utils.isGameOver)
        {
            return;
        }
    }
Beispiel #10
0
    public void EndQuest()
    {
        bool _playerChoice = DialogueLua.GetVariable("BossQuestIsActive").asBool;

        // Stuff for boss quest
        if (_playerChoice == true)
        {
            playerHasBossQuest    = false;
            playerHasBossDelivery = false;
            EndBossQuest();
        }
        // Stuff for normal quest
        else if (_playerChoice == false)
        {
            playerHasQuest    = false;
            playerHasDelivery = false;
            // Add XP to player leveling system
            AddXpToPlayerLevelingSystem(currentPlayerDifficulty);
            // Add one completed quest to completed quests
            normalCompletedQuests += 1;
            // Make sure the boss can inquire only after normal quests
            bossCanInquire = true;

            /*jpost audio*/
            //play add xp sound from wwise
            AkSoundEngine.PostEvent("play_bb_sx_game_ui_xp_gained", gameObject);
        }

        // Reset player collisions during quest
        currentPlayerCollisionsPerDelivery = maxPlayerCollisionsPerDelivery;
        // Calculate the players current difficulty based on current level from xp gain
        CalculatePlayersCurrentDifficulty();
        // Enable/Disable gameobjects
        NoQuestActiveGameObjects();
    }
Beispiel #11
0
 private void GetAndStore()
 {
     if ((variableName == null) || string.IsNullOrEmpty(variableName.Value))
     {
         LogWarning(string.Format("{0}: Variable Name isn't assigned or is blank.", DialogueDebug.Prefix));
     }
     else
     {
         Lua.Result luaResult = DialogueLua.GetVariable(variableName.Value);
         if (storeStringResult != null)
         {
             storeStringResult.Value = luaResult.AsString;
         }
         if (storeFloatResult != null)
         {
             storeFloatResult.Value = luaResult.AsFloat;
         }
         if (storeIntResult != null)
         {
             storeIntResult.Value = luaResult.AsInt;
         }
         if (storeBoolResult != null)
         {
             storeBoolResult.Value = luaResult.AsBool;
         }
         //if (storeVector3Result != null) storeVector3Result.Value = DialogueSystemPlayMakerTools.StringToVector3(luaResult.AsString);
         //if (storeStringArrayResult != null) storeStringArrayResult.Values = DialogueSystemPlayMakerTools.StringToArray(luaResult.AsString, VariableType.String);
         //if (storeIntArrayResult != null) storeIntArrayResult.Values = DialogueSystemPlayMakerTools.StringToArray(luaResult.AsString, VariableType.Int);
     }
 }
        float SetChildStat(string pParent1, string pParent2, string pStat)
        {
            float parent1Value = DialogueLua.GetVariable(pParent1 + pStat).asFloat;
            float parent2Value = DialogueLua.GetVariable(pParent2 + pStat).asFloat;

            int   rand  = Random.Range(0, 100);
            float value = 0;

            if (rand <= 50)
            {
                value = (parent1Value + parent2Value) / 2;
            }
            else
            {
                rand = Random.Range(0, 100);

                if (rand <= 50)
                {
                    value = parent1Value;
                }
                else
                {
                    value = parent2Value;
                }
            }
            return(value);
        }
Beispiel #13
0
    // Update is called once per frame
    void Update()
    {
        if (tutorialController == null)
        {
            return;
        }
        if (tutorialIsActive)
        {
            // Disable the tutorial and allow the player full reign of the game world
            if (DialogueLua.GetVariable("endTutorial").asBool == true)
            {
                // Disable the tutorial
                tutorialController.enabled = false;
                // Enable the quest controller objects
                questController.NoQuestActiveGameObjects();
                tutorialIsActive = false;
                dsc.displaySettings.subtitleSettings.continueButton = DisplaySettings.SubtitleSettings.ContinueButtonMode.Optional;
                GameObject.FindObjectOfType <PlayerController>().GetComponentInChildren <TargetIndicator>().tutorial = false;
            }
        }

        // Check for tutorial end
        if (tutorialController.enabled == false && tutorialEnded == false)
        {
            // Enable the quest controller objects
            questController.NoQuestActiveGameObjects();
            tutorialIsActive = false;
            tutorialEnded    = true;
            dsc.displaySettings.subtitleSettings.continueButton = DisplaySettings.SubtitleSettings.ContinueButtonMode.Optional;
            GameObject.FindObjectOfType <PlayerController>().GetComponentInChildren <TargetIndicator>().tutorial = false;
            questController.AddTutorialXpToPlayerLevelingSystem(5);
        }
    }
Beispiel #14
0
    void OnApplyPersistentData()
    {
        GetVariableName();
        TargetTree = GetComponent <TreeBase>();


        if (TargetTree.YieldsProduce && DialogueLua.DoesVariableExist(VariableName + "CurrentProduceGrowth"))
        {
            int seasonAmount = DialogueLua.GetVariable(VariableName + "SeasonAmount").asInt;
            TargetTree.ProduceSeasons = new List <TimeManager.MonthNames>();

            for (int i = 0; i < seasonAmount; i++)
            {
                TargetTree.ProduceSeasons.Add((TimeManager.MonthNames)System.Enum.Parse(typeof(TimeManager.MonthNames), DialogueLua.GetVariable(VariableName + "Season" + i).asString));
            }
            //            print(DialogueLua.GetVariable(VariableName + "CurrentProduceGrowth").asInt);
            TargetTree.CurrentProduceGrowth = DialogueLua.GetVariable(VariableName + "CurrentProduceGrowth").asInt;


            TargetTree.ProduceReady = DialogueLua.GetVariable(VariableName + "ProduceReady").asBool;
            TargetTree.SetProduceSprite();
            if (TargetTree.ProduceSeasons.Contains(TimeManager.Instance.CurrentMonth.Name))
            {
                if (TargetTree.FloweringSprite != null)
                {
                    TargetTree.GetComponent <SpriteRenderer>().sprite = TargetTree.FloweringSprite;
                }
            }
        }
        TargetTree.DroppedItems  = DialogueLua.GetVariable(VariableName + "DroppedItems").asInt;
        TargetTree.CurrentGrowth = DialogueLua.GetVariable(VariableName + "CurrentGrowth").asInt;
        TargetTree.NativeTree    = DialogueLua.GetVariable(VariableName + "Native").asBool;
    }
    void OnEnable()
    {
        string val            = DialogueLua.GetVariable("UserChoice").asString;
        var    graphReference = GraphReference.New(_TargetFlowMachine, true);

        Variables.Graph(graphReference).Set(_TargetGraphVariableName, val);
    }
        public override void OnEnter()
        {
            var isActive = DialogueManager.isConversationActive;
            var state    = isActive ? DialogueManager.currentConversationState : null;

            if (conversationTitle != null)
            {
                var conversation = isActive ? DialogueManager.MasterDatabase.GetConversation(state.subtitle.dialogueEntry.conversationID) : null;
                conversationTitle.Value = (conversation != null) ? conversation.Title : string.Empty;
            }
            if (conversationID != null)
            {
                conversationID.Value = isActive ? state.subtitle.dialogueEntry.conversationID : 0;
            }
            if (entryID != null)
            {
                entryID.Value = isActive ? state.subtitle.dialogueEntry.id : 0;
            }
            if (actorName != null)
            {
                actorName.Value = DialogueLua.GetVariable("Actor").AsString;
            }
            if (conversantName != null)
            {
                conversantName.Value = DialogueLua.GetVariable("Conversant").AsString;
            }
            Finish();
        }
        /// <summary>
        /// Run actions when the object receives the "Die" message.
        /// - Increment variableToIncrement
        /// - Record death in variableToRecordDeath
        /// - Destroy the object if specified
        /// </summary>
        public virtual void Die()
        {
            // Run Lua code:
            if (!string.IsNullOrEmpty(luaCode))
            {
                Lua.Run(luaCode, DialogueDebug.LogInfo);
            }

            // Play sequence:
            if (!string.IsNullOrEmpty(sequence))
            {
                DialogueManager.PlaySequence(sequence, DialogueManager.Instance.transform, transform);
            }

            // Increment the variableToIncrement:
            if (!string.IsNullOrEmpty(variableToIncrement))
            {
                int oldValue = DialogueLua.GetVariable(variableToIncrement).AsInt;
                int newValue = Mathf.Clamp(oldValue + increment, min, max);
                DialogueLua.SetVariable(variableToIncrement, newValue);
                DialogueManager.Instance.BroadcastMessage("UpdateTracker", SendMessageOptions.DontRequireReceiver);
            }

            // Record that the object is dead in variableToRecordDeath:
            if (!string.IsNullOrEmpty(variableToRecordDeath))
            {
                DialogueLua.SetVariable(variableToRecordDeath, true);
            }

            // Destroy the object if specified:
            if (destroy)
            {
                Destroy(gameObject);
            }
        }
        public void SpawnLevelBlossoms()
        {
            SpawnedBlossoms.Clear();

            foreach (string blossom in ExistingBlossoms)
            {
                string blossomCurrentLevel = DialogueLua.GetVariable(blossom + "CurrentLevel").asString;
                // print(blossomCurrentLevel);
                float   blossomCurrentX = DialogueLua.GetVariable(blossom + "CurrentX").asFloat;
                float   blossomCurrentY = DialogueLua.GetVariable(blossom + "CurrentY").asFloat;
                Vector2 blossomPosition = new Vector2(blossomCurrentX, blossomCurrentY);
                if (SceneManager.GetActiveScene().name == blossomCurrentLevel)
                {
                    if (DialogueLua.GetVariable(blossom + "ForSale").asBool == true)
                    {
                        BlossomData newBlossom = Instantiate(BlossomStoreDummy, blossomPosition, transform.rotation);
                        newBlossom.GetComponent <BlossomDataSaver>().ApplyPersistentData(blossom);
                        SpawnedBlossoms.Add(blossom, newBlossom);
                    }
                    else
                    {
                        BlossomData newBlossom = Instantiate(BlossomPrefab, blossomPosition, transform.rotation);
                        newBlossom.GetComponent <BlossomDataSaver>().ApplyPersistentData(blossom);
                        SpawnedBlossoms.Add(blossom, newBlossom);
                    }
                }
            }
        }
Beispiel #19
0
        public void ShowResultsScreen()
        {
            float maxScore = GetCompetitionMaxScore();
            int   i        = 0;
            int   place    = -1;

            List <string> results  = new List <string>();
            List <string> blossoms = new List <string>();

            foreach (KeyValuePair <string, float> result in CurrentResults)
            {
                float score = result.Value;
                score = (score * 10) / maxScore;
                string name = DialogueLua.GetVariable(result.Key + "Name").AsString;
                blossoms.Add(result.Key);
                if (result.Key == Blossom)
                {
                    results.Add("<b>" + name + ": " + score.ToString("F2") + "/10" + "</b>");
                    place = i;
                }
                else
                {
                    results.Add(name + ": " + score.ToString("F2") + "/10");
                }
                i++;
            }

            FindObjectOfType <BlossomCompetitionResultsUI>().Open(results, blossoms, place, CurrentCompetition.Name + " Rankings");
        }
Beispiel #20
0
    public void OnApplyPersistentData()
    {
        Target       = GetComponent <GrassPatch>();
        VariableName = "Grass" + transform.position.x + transform.position.y;

        if (DialogueLua.DoesVariableExist(VariableName + "Pregrow") == false)
        {
            return;
        }
        Target.Pregrow       = DialogueLua.GetVariable(VariableName + "Pregrow").asBool;
        Target.AwakeChildren = DialogueLua.GetVariable(VariableName + "AwakeChildren").AsInt;
        GrassTuft[] children = GetComponentsInChildren <GrassTuft>(true);
        int         i        = 0;

        foreach (GrassTuft child in children)
        {
            if (DialogueLua.GetVariable(VariableName + "Tuft" + i).asBool == true)
            {
                child.gameObject.SetActive(true);
            }
            else
            {
                child.gameObject.SetActive(false);
            }
            i++;
        }
    }
Beispiel #21
0
 private void GetAndStore()
 {
     if ((variableName == null) || string.IsNullOrEmpty(variableName.Value))
     {
         LogWarning(string.Format("{0}: Variable Name isn't assigned or is blank.", DialogueDebug.Prefix));
     }
     else
     {
         Lua.Result luaResult = DialogueLua.GetVariable(variableName.Value);
         if (storeStringResult != null)
         {
             storeStringResult.Value = luaResult.AsString;
         }
         if (storeFloatResult != null)
         {
             storeFloatResult.Value = luaResult.AsFloat;
         }
         if (storeIntResult != null)
         {
             storeIntResult.Value = luaResult.AsInt;
         }
         if (storeBoolResult != null)
         {
             storeBoolResult.Value = luaResult.AsBool;
         }
     }
 }
        public void OnConversationPoint()
        {
            int DSfood = DialogueLua.GetVariable(currentActor + "FriendPoint").asInt;

            Debug.Log(DSfood);
            GameEvents.ReportCharacterTalkingChange(DSfood);
        }
Beispiel #23
0
        public void ProceedCompetition()
        {
            List <float> sortedScores  = new List <float>();
            float        blossomResult = GetBlossomResult(Blossom);

            CurrentResults.Add(Blossom, blossomResult);
            BlossomResult = blossomResult;
            sortedScores.Add(blossomResult);
            foreach (string competitor in CurrentCompetitors)
            {
                float result = GetBlossomResult(competitor);

                if (sortedScores.Contains(result))
                {
                    result = result - 0.0001f;
                }
                sortedScores.Add(result);
                CurrentResults.Add(competitor, result);
            }

            sortedScores.Sort(CompareScores);
            sortedScores.Reverse();

            Dictionary <string, float> newScores = new Dictionary <string, float>();

            foreach (float score in sortedScores)
            {
                foreach (KeyValuePair <string, float> result in CurrentResults)
                {
                    if (result.Value == score)
                    {
                        newScores.Add(result.Key, result.Value);
                    }
                }
            }

            CurrentResults = newScores;
            float maxScore = GetCompetitionMaxScore();

            print("MaxScore: " + maxScore);
            int i     = 0;
            int place = -1;

            foreach (KeyValuePair <string, float> result in CurrentResults)
            {
                float score = result.Value;
                score = (score * 10) / maxScore;
                string name = DialogueLua.GetVariable(result.Key + "Name").AsString;
                print(name + ": " + score.ToString("F2") + "/10");
                if (result.Key == Blossom)
                {
                    place = i;
                }
                i++;
            }
            CompetitionText = (GenerateText(place));

            GameManager.Instance.StartCompetitionCutscene("Blossom" + CurrentCompetition.Name);
        }
        public void UpdateClue()
        {
            int DSClue = DialogueLua.GetVariable("Clues").asInt;

            masterClue = DSClue;
            Debug.Log("I have Clue " + masterClue);
            UIManager.instance.UpdateClueText(masterClue);
        }
        public void UpdateFood()
        {
            int DSfood = DialogueLua.GetVariable("Food").asInt;

            masterFood = DSfood;
            Debug.Log("I have Food " + masterFood);
            UIManager.instance.UpdateFoodText(masterFood);
        }
Beispiel #26
0
    // Delegate for the "unlock-door" variant of the "use" command.
    private void HandleUnlockEntrance(string agent, string key, string entrance)
    {
        // Build the action.
        string location = stateManager.At(agent);

        action = "(unlock-entrance " + agent + " " + key + " " + entrance + " " + location + ")";

        // Test if the action is possible.
        bool actionIsPossible = mediator.IsApplicable(action);

        if (actionIsPossible)
        {
            // FIXME: This is a hack.  I need to be able to stop the player from using the key in the basement
            // before the player has looked at the exit, so if we get a legal "use" action come in (i.e. the player
            // is trying to unlock the basement exit), deny the action.
            if (DialogueLua.GetVariable("WIZARD_TUTORIAL_LOOKAT_ACTION_STARTED").AsBool == true &&
                DialogueLua.GetVariable("WIZARD_TUTORIAL_LOOKAT_ACTION_COMPLETED").AsBool == false &&
                location.Equals("basement"))
            {
                command.text = CommandBuilder.TUTORIAL_ERROR;
                return;
            }

            // Great! Check the physics of the world to see if I can actually do that.
            // Assume we can't do it.
            command.text = CommandBuilder.PROXIMITY_ERROR;

            // If the player is colliding with the Entrance that they want to use the key on,
            GameObject collided = CollidingWithTagged(entrance, "Entrance");

            if (collided != null)
            {
                // Attempt to execute the logical action!
                bool actionSucceeded = mediator.PlayerUpdate(action);

                if (actionSucceeded)
                {
                    // Clear the command.
                    command.text = "";

                    // Play unlock sound!
                    GetComponent <AudioSource>().PlayOneShot(unlockDoor);
                }

                else
                {
                    command.text = CommandBuilder.MEDIATION_ERROR;
                }
            }
        }

        else
        {
            // I don't think I'm able to do that.
            command.text = CommandBuilder.ACTION_ERROR;
        }
    }
Beispiel #27
0
 private void InitializeResetDatabase()
 {
     DialogueManager.Instance.initialDatabase.variables.ForEach(hVar =>
     {
         string name = hVar.Name;
         int value   = DialogueLua.GetVariable(hVar.Name).AsInt;
         resetDatabase.Add(name, value);
     });
 }
Beispiel #28
0
    /// <summary>
    /// Check the quests completeed variable from dialogue system and update it locally
    /// </summary>
    private void CheckQuestsCompleted()
    {
        int dialogueQuests = DialogueLua.GetVariable(completedQuestsName).AsInt;

        if (dialogueQuests > QuestsCompleted)
        {
            QuestsCompleted = dialogueQuests;
        }
    }
        public void OnConversationStart(Transform actor)
        {
            currentActor = actor.name;
            Debug.Log(string.Format("Starting conversation with {0}", actor.name));
            int DSfood = DialogueLua.GetVariable(currentActor + "FriendPoint").asInt;

            Debug.Log(DSfood);
            GameEvents.ReportCharacterTalkingChange(DSfood);
        }
Beispiel #30
0
    void OnApplyPersistentData()
    {
        VariableName = name + transform.position.x.ToString("F2") + transform.position.ToString("F2");

        print(VariableName);
        TargetProp.CurrentGrowth = DialogueLua.GetVariable(VariableName + "CurrentGrowth").asInt;
        print(TargetProp.CurrentGrowth);
        TargetProp.CheckStage();
    }