// Use this for initialization void Start() { flchart.SetIntegerVariable("movimientos", SKGameControl.instance.characterMoves); flchart.SetIntegerVariable("bloqueactual", SKGameControl.instance.currentBlock); SKGameControl.instance.characterMoves = 0; flchart.ExecuteBlock("Main"); }
void Awake() { introFlowchart = GameObject.Find("IntroFlowchart").GetComponent <Flowchart>(); talkFlowchart = GameObject.Find("TalksFlowchart").GetComponent <Flowchart>(); //infoDump.firstTime = true; if (infoDump.firstTime) { introFlowchart.enabled = true; infoDump.firstTime = false; } else { talkFlowchart.enabled = true; talkFlowchart.SetIntegerVariable("DroneSpeed", infoDump.droneSpeed); talkFlowchart.SetIntegerVariable("PhobosPower", infoDump.phobosPower); talkFlowchart.SetIntegerVariable("DeimosPower", infoDump.deimosPower); talkFlowchart.SetIntegerVariable("FuelRegen", infoDump.fuelRegen); talkFlowchart.SetBooleanVariable("HasQInfo", infoDump.hasQInfo); talkFlowchart.SetBooleanVariable("HasQAdvice", infoDump.hasQAdvice); talkFlowchart.SetStringVariable("WeaponsStatus", infoDump.weaponSystemStatus); talkFlowchart.SetBooleanVariable("TalkedToQ", infoDump.talkedToQ); talkFlowchart.SetBooleanVariable("TalkedToAresa", infoDump.talkedToAresa); talkFlowchart.SetBooleanVariable("TalkedToPD", infoDump.talkedToPD); } }
// Sets Up Initial the current values for the player private void setInitialPlayerAttributes() { // Sets up the current attributres for the player variableFlowchart.SetIntegerVariable("happiness", happiness); if (happiness <= 99) { curMood = 0; } else if (happiness >= 100 && happiness <= 199) { curMood = 1; } else if (happiness >= 200 && happiness <= 299) { curMood = 2; } else if (happiness >= 300 && happiness <= 399) { curMood = 3; } //moodValue = happiness % 100; variableFlowchart.SetIntegerVariable("curMood", curMood); variableFlowchart.SetIntegerVariable("weather", weather); variableFlowchart.SetStringVariable("currentDay", currentDay); variableFlowchart.SetStringVariable("nextDay", nextDay); variableFlowchart.SetBooleanVariable("isOnBreak", isOnBreak); variableFlowchart.SetBooleanVariable("dadWorkingToday", dadWorkingToday); }
void OnCollisionEnter(UnityEngine.Collision collision) { if (collision.transform.name == "IncinerationPlant4") { Destroy(gameObject); } if (collision.transform.name == "IncinerationPlant5") { Destroy(gameObject); } if (collision.transform.name == "IncinerationPlant6") { Destroy(gameObject); } if (collision.transform.name == "DestroyBox(stop)") { Destroy(gameObject); if (Main.GetIntegerVariable("BoxDestory") == 0) { Main.SetIntegerVariable("BoxDestory", 1); } else if (Main.GetIntegerVariable("BoxDestory") == 1) { Main.SetIntegerVariable("BoxDestory", 2); } } }
public void AddAffinityandMentalState(int aff, int ment) { flowchart.SetIntegerVariable("affinity", flowchart.GetIntegerVariable("affinity") + aff); flowchart.SetIntegerVariable("mental", flowchart.GetIntegerVariable("mental") + ment); DOTween.To(() => affinityDisplay, x => affinityDisplay = x, flowchart.GetIntegerVariable("affinity"), 1f); DOTween.To(() => mentalDisplay, x => mentalDisplay = x, flowchart.GetIntegerVariable("mental"), 1f); }
void Start() { dialogWindow = (GameObject)Instantiate(prefabDialogWindow, new Vector3(transform.position.x, transform.position.y + 2, 0), Quaternion.identity); dialogWindow.transform.SetParent(gameObject.transform); dialogWindow.SetActive(false); dialogWindowRotation = dialogWindow.transform.rotation; flowChart.SetIntegerVariable("money", GameState.Instance.money); updateMoney(); }
public void OnLanguageChange(Toggle toggle) { if (toggle.isOn) { string toggleName = toggle.gameObject.name; switch (toggleName) { case "LanguageToggle_C": GameData.currentLanguage = 0; startGame = true; break; case "LanguageToggle_E": GameData.currentLanguage = 1; startGame = true; break; case "LanguageToggle_P": GameData.currentLanguage = 2; startGame = true; break; default: break; } flowChart.SetIntegerVariable("LanguageType", GameData.currentLanguage); Debug.Log("GameData.currentLanguage:" + GameData.currentLanguage); } }
void setFBNum() { flowchart.SetIntegerVariable("FBNum", feedbackNum); int FBNumNow = flowchart.GetIntegerVariable("FBNum"); Debug.Log("FBNumNow = " + FBNumNow); }
void addEyeUse() { getCurrentMap(); eyeUsedCounter++; fc.SetIntegerVariable("eyeUsedCounter", eyeUsedCounter); Debug.Log("called!"); }
/// <summary> /// Unity trigger for onLevelLoad events. /// </summary> /// <param name="level"></param> private void OnLevelWasLoaded(int level) { if (_saveGame == null) { return; } Flowchart characFlowchart = null; Flowchart itemFlowchart = null; GameObject c1 = GameObject.Find("Char-Flowcharts"); GameObject c2 = GameObject.Find("Item-Flowchart"); characFlowchart = c1.GetComponent <Flowchart>(); itemFlowchart = c2.GetComponent <Flowchart>(); Debug.LogWarning("TAKE ON UNITY"); itemFlowchart.SetBooleanVariable("IsPluggedIn", _saveGame.IsPluggedIn); Debug.LogWarning("TAKE ON UNITY"); itemFlowchart.SetBooleanVariable("IsBelt", _saveGame.IsBelt); Debug.LogWarning("TAKE ON UNITY"); itemFlowchart.SetBooleanVariable("IsMachine", _saveGame.IsMachine); Debug.LogWarning("TAKE ON UNITY"); characFlowchart.SetStringVariable("CURRENT_STATE", _saveGame.CURRENT_STATE); Debug.LogWarning("TAKE ON UNITY"); characFlowchart.SetIntegerVariable("RNG", _saveGame.RNG); Debug.LogWarning("TAKE ON UNITY"); ScoreManager = _saveGame.ScoreManager; Debug.LogWarning("TAKE ON UNITY"); ScoreManager._stopwatch = new Stopwatch(); Debug.LogWarning("TAKE ON UNITY"); ScoreManager.resume(); Debug.LogWarning("TAKE ON UNITY"); }
public void Dialogue(string character)//character tag name being passed through here { for (int x = 0; x < characterlist.characters.Count; x++) { if (characterlist.characters[x].CharacterName == character) { TempHeart = characterlist.characters[x].HeartValue; BlockToExecute = character + "_" + timer.CurrentDay + "_" + daynight.currentTime; // + "_" + TempHeart;//this is setting up the flowchart block to call. Gathers all intel that dialogue is dependent on. //characterlist.characters[x].characterflowchart.ExecuteBlock(BlockToExecute); charflowchart = GameObject.Find(characterlist.characters[x].characterflowchart).GetComponent <Flowchart>(); //grabbing the flowchart of the character class form characterlist charflowchart.SetIntegerVariable("FungusHeartValue", TempHeart); if (characterlist.characters[x].greeting == true) { charflowchart.ExecuteBlock(character + "_intro"); } else { charflowchart.ExecuteBlock(BlockToExecute); } currentcharacter = character; } else { //Debug.LogError("Can't match character name"); } } }
public void AddCorrectCount() { if (flowchart == null) { return; } flowchart.SetIntegerVariable("CorrectCount", (flowchart.GetIntegerVariable("CorrectCount") + 1)); }
public void Enitio(GameObject EnitioObject) { Destroy(EnitioObject); EnitioCount += 1; Thread.Sleep(200); ShowinventoryImage(); myFlowchart.SetIntegerVariable("EnitioCount", EnitioCount); }
public void GetInput(string guess) { Debug.Log("Should Work... x : " + guess); GlobalFungus.playerName = guess; flowchart.SetStringVariable("playerName", guess); flowchart.SetIntegerVariable("waitPlayerName", 0); GlobalVariables.buttonFlag = true; }
void Start() { loadData = LoadJson.LoadJsonFromFile("dongxi"); count = loadData.guo1_1 + loadData.guo1_2 + loadData.guo1_3 + loadData.guo1_4; count += loadData.guo2_1 + loadData.guo2_2 + loadData.guo2_3 + loadData.guo2_4; count += loadData.guo3_1 + loadData.guo3_2 + loadData.guo3_3 + loadData.guo3_4; fc.SetIntegerVariable("point", count); }
// Update is called once per frame void Update() { if (CurrentHealth <= 0) { Destroy(gameObject); thePlayerStats.AddExperience(expToGive); flowchart.SetIntegerVariable("Enemies", flowchart.GetIntegerVariable("Enemies") - 1); } }
// Start is called before the first frame update void Start() { flowchart = GameObject.Find("Flowchart").GetComponent <Flowchart>(); //Test: //int index = EventCenter.Boardcast<int>(GameEventType.GetCurrentQueIndex); //Debug.Log("index:" + index); flowchart.SetIntegerVariable("LanguageType", GameData.currentLanguage); Say(); }
public void HandleContinue(Command sayCommand, BaseContinue bc) { string nextBlock = flowChart.GetStringVariable("NextBlock"); if (!"Empty".Equals(nextBlock)) { flowChart.StopAllBlocks(); flowChart.ExecuteBlock(nextBlock); flowChart.SetStringVariable("NextBlock", "Empty"); if (flowChart.GetStringVariable("ConvoStage").Equals("MidConvo")) { flowChart.SetBooleanVariable("BadTransition", true); } else if (flowChart.GetStringVariable("ConvoStage").Equals("ConfessionApproach")) { // good transition flowChart.SetStringVariable("ConvoStage", "MidConvo"); flowChart.SetIntegerVariable("CommandIndex", 0); flowChart.SetStringVariable("CurrentBlock", nextBlock); TopicManager.instance.RegisterTopic(nextBlock); TopicManager.instance.ClearTopicRoll(); TopicManager.instance.ActivateTopicRoll(); } } else { if (flowChart.GetBooleanVariable("BadTransition")) { flowChart.StopAllBlocks(); flowChart.ExecuteBlock("AbruptTopicChange"); flowChart.SetBooleanVariable("BadTransition", false); } else { if (!sayCommand.ParentBlock.BlockName.Equals("AbruptTopicChange")) { // Normal flow flowChart.SetIntegerVariable("CommandIndex", (sayCommand.CommandIndex + 1)); } bc(); } } }
public void itemUse() { //使用道具的分歧編號,0代表找不到相應的使用地點 int useItemRole = (SurveyJudge.ItemUseMap.ContainsKey(transform.name)) ? SurveyJudge.ItemUseMap[transform.name] : 0; itemUseFlowchart.SetIntegerVariable("useItemRole", useItemRole);//設置分歧編號 //進入統一使用道具的入口 Block enterBlock = itemUseFlowchart.FindBlock("UseItem_Enter"); itemUseFlowchart.ExecuteBlock(enterBlock); }
public void StartUsingInteractable() { if (CheckActiveResource()) { UnLocked(); } else { Locked(); } flowchart.SetIntegerVariable("choice", sayInt); Flowchart.BroadcastFungusMessage("WaterHeater"); }
/// <summary> /// Enters vis novel /// </summary> public void enterVN() { //_isInVN = true; //_isInTA = false; VN.SetActive(true); TA.SetActive(false); // Iterates day by 1 sleepTree.SetIntegerVariable("DayCount", sleepTree.GetIntegerVariable("DayCount") + 1); // Calls the block that starts the VN sleepTree.ExecuteBlock(blockToExecute); }
private void Start() { ProgressObservable .Where(_ => isTutorial) .Distinct() .DelayFrame(1) .Subscribe(async x => { flowchart.SetIntegerVariable(key, x); await UniTask.WaitUntil(() => !flowchart.GetExecutingBlocks().Any(b => b.BlockName == "Tutorial")); flowchart.ExecuteBlock("Tutorial"); }).AddTo(gameObject); flowchart.ObserveEveryValueChanged(f => f.GetIntegerVariable(key)) .Subscribe(v => ProgressObservable.Value = v).AddTo(gameObject); }
public void StartUsingInteractable() { flowchart.SetBooleanVariable("inProgress", true); if (CheckActiveResource()) { UnLocked(); } else { Locked(); } flowchart.SetIntegerVariable("choice", sayInt); Flowchart.BroadcastFungusMessage("TaskBox"); }
public void CheckLevelComplete() { //Debug.Log(cc.Count); if (cc.Count == 5) { // TODO: call fungus block, narrative dialog, return to level flowchart.ExecuteBlock("PuzzleFinish"); } else if (pc.Count == 5) { flowchart.ExecuteBlock("PuzzleIncorrect"); } flowchart.SetIntegerVariable("placedIncorrect", pc.Count - cc.Count); }
public void FakeBtnCicked() { var rm = flowChart.GetIntegerVariable("HeadRemain"); rm--; if (rm > 0) { } else { rm = 3; flowChart.SetBooleanVariable("BennettDead", true); } flowChart.SetIntegerVariable("HeadRemain", rm); }
//public GameObject lookLight; void Update() { hit = flowchart.GetBooleanVariable("hit"); falls = PlayerPrefs.GetInt("level1falls"); flowchart.SetIntegerVariable("falls", falls); Debug.Log("hit = " + hit); if (Input.GetButtonDown("Cancel")) { Debug.Log("cancel1"); if (hit == true) { Debug.Log("cancel2"); dialog.SetActive(false); hit = false; flowchart.SetBooleanVariable("hit", false); } } }
void Load() //Loads and assigns data from a serialzed save file. { if (File.Exists(Application.persistentDataPath + "/playerInfo.dat")) //If it exists. { BinaryFormatter bf = new BinaryFormatter(); //Creates a new binary formatter for serializing and deserializing data. FileStream file = File.Open(Application.persistentDataPath + "/playerInfo.dat", FileMode.Open); //Opens the save file. PlayerData data = (PlayerData)bf.Deserialize(file); //Creates a new PlayerData class and populates it with the deserialized data from the save file. file.Close(); //Closes the save file. level = data.level; //Holds the current level from the saved file. health = data.health; //Holds the player's health value from the save file. playerX = data.playerX; //Holds the player's X position from the save file. playerY = data.playerY; //Holds the player's Y position from the save file. playerZ = data.playerZ; //Holds the player's Z position from the save file. playerPos = new Vector3(playerX, playerY, playerZ); //Creates a new Vector3 based on the previous three values. Vector3's aren't serializable so this is how the player's positions is stored and recreated. Application.LoadLevel(level); //Loads the level assigned by the save file. PlayerChart.SetIntegerVariable("Health", health); //Sets the player health variable in the player's Fungus Flowchart. player.transform.position = new Vector3(playerX, playerY, playerZ); //Sets the player's position to the new Vector3 constructed from saved float values. } }
//If a block is activated by the user, then this is not needed in the flowchart //Copies the variables in the list from the GM flowcharts to the activated flowchart public void CopyGameMasterToFlowchart() { gm = GameObject.Find("GameMaster").GetComponent <GameMaster>(); Flowchart gmQuest = gm.GetQuestFlowchart(); Flowchart target = this.GetComponent <Flowchart>(); Variable sourceVar = null; for (int i = 0; i < varNames.Length; i++) { sourceVar = gmQuest.GetVariable(varNames[i]); StringVariable tempstr = sourceVar as StringVariable; if (tempstr != null) { target.SetStringVariable(varNames[i], tempstr.Value); continue; } BooleanVariable tempBool = sourceVar as BooleanVariable; if (tempBool != null) { target.SetBooleanVariable(varNames[i], tempBool.Value); continue; } IntegerVariable tempInt = sourceVar as IntegerVariable; if (tempInt != null) { target.SetIntegerVariable(varNames[i], tempInt.Value); continue; } FloatVariable tempFloat = sourceVar as FloatVariable; if (tempFloat != null) { target.SetFloatVariable(varNames[i], tempFloat.Value); continue; } } }
public void Load() { if (File.Exists(Application.persistentDataPath + "/playerInfo.dat")) //Checks to see if playerInfo.dat exists, if it does: { BinaryFormatter bf = new BinaryFormatter(); //Creates a new binary formatter to deserialize data. FileStream file = File.Open(Application.persistentDataPath + "/playerInfo.dat", FileMode.Open); //Opens the playerInfo.dat file PlayerData data = (PlayerData)bf.Deserialize(file); //Creates a new PlayerData class populated with data deserialized from playerInfo.dat. file.Close(); //Closes the file. level = data.level; //Assigns the level variable the value stored in the PlayerData class. health = data.health; //Assigns the health variable the value stored in the PlayerData class. playerX = data.playerX; //Assigns the X position the value stored in the PlayerData class. playerY = data.playerY; //Assigns the Y position the value stored in the PlayerData class. playerZ = data.playerZ; //Assigns the Z position the value stored in the PlayerData class. playerPos = new Vector3(playerX, playerY, playerZ); //Creates a new Vector3 from the previous three variables. Application.LoadLevel(level); //Loads the level stored in the level variable. PlayerChart.SetIntegerVariable("Health", health); //Sets the health value in the player flowchart to the loaded health value. player.transform.position = new Vector3(playerX, playerY, playerZ); //Sets the players position to the Vector3 created from saved values. PlayerChart.ExecuteBlock("LoadPauseOff"); //Executes a fungus block which resets booleans used to control the pause menu. } }
void OnTriggerStay2D(Collider2D other) { if (other.gameObject.name == "Player") { if (CrossPlatformInputManager.GetButton("Interact")) { if (pause == null) { pause = GameObject.FindGameObjectWithTag("Pause").GetComponent <Button> (); } flowchart.SetIntegerVariable("NPC", NPCnum); flowchart.ExecuteBlock("Start"); pause.enabled = false; pause.gameObject.SetActive(false); if (transform.parent.GetComponent <VillagerMovement> () != null) { transform.parent.GetComponent <VillagerMovement> ().canMove = false; pc.canMove = false; } } } }