public void SaveInSlot(string saveName) { #if UNITY_ANDROID && !UNITY_EDITOR path = Path.Combine(Application.persistentDataPath, saveName + ".json"); #else Directory.CreateDirectory(Application.dataPath + "/saves"); path = Path.Combine(Application.dataPath + "/saves/", saveName + ".json"); #endif sv.sceneName = SceneManager.GetActiveScene().name; sv.playerName = myFlowchart.GetStringVariable("Name"); sv.prologEnd = myFlowchart.GetBooleanVariable("PrologEnd"); sv.dayTime = myFlowchart.GetIntegerVariable("Time"); sv.money = myFlowchart.GetIntegerVariable("Money"); sv.kateAlpha = myFlowchart.GetIntegerVariable("KateAlpha"); sv.katePretty = myFlowchart.GetIntegerVariable("KatePretty"); sv.klaraAlpha = myFlowchart.GetIntegerVariable("KlaraAlpha"); sv.klaraPretty = myFlowchart.GetIntegerVariable("KlaraPretty"); sv.lizzyAlpha = myFlowchart.GetIntegerVariable("LizzyAlpha"); sv.lizzyPretty = myFlowchart.GetIntegerVariable("LizzyPretty"); sv.saraAlpha = myFlowchart.GetIntegerVariable("SaraAlpha"); sv.saraPretty = myFlowchart.GetIntegerVariable("SaraPretty"); sv.saveDateTime = System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); #if UNITY_ANDROID && !UNITY_EDITOR File.WriteAllText(path, JsonUtility.ToJson(sv)); #endif File.WriteAllText(path, JsonUtility.ToJson(sv)); }
public Room[] StoryRooms; // Stores rooms for the story // Private variables //private bool _isInVN; //private bool _isInTA; #region public func /// <summary> /// Enters text adventure /// </summary> public void enterTA() { //_isInTA = true; //_isInVN = false; // Disable the VN stuff, enable TA stuff VN.SetActive(false); TA.SetActive(true); // Enter next room for dream world, ensure that it prints next room and everything _roomNav.currentRoom = StoryRooms[sleepTree.GetIntegerVariable("DayCount")]; // Prints out tons of blank space _controller.LogStringWithReturn("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); // Prints new room text _controller.DisplayRoomText(); _controller.DisplayLoggedText(); // Reactivates the input field when enter/return is pressed _inputField.ActivateInputField(); // Empties inputfield for the player _inputField.text = null; }
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); } } }
void getFlowchartNums() { skillsNum = flowchart.GetIntegerVariable("SkillsNum"); firstProblem = flowchart.GetBooleanVariable("FirstProblem"); inExam = flowchart.GetBooleanVariable("InExam"); currentProblem = flowchart.GetIntegerVariable("CurrentProblem"); }
// Update is called once per frame void Update() { if (lightCheckpoint != (CurrentLight)mainFlowchart.GetIntegerVariable("light")) { lightCheckpoint = (CurrentLight)mainFlowchart.GetIntegerVariable("light"); } }
void getFlowchartNums() { firstProblem = flowchart.GetBooleanVariable("FirstProblem"); currentProblem = flowchart.GetIntegerVariable("CurrentProblem"); inExam = flowchart.GetBooleanVariable("InExam"); examLast = flowchart.GetBooleanVariable("ExamLast"); examScore = flowchart.GetFloatVariable("ExamScore"); }
// Update is called once per frame void Update() { if (flowchart.GetIntegerVariable("InvestigatedNum") == 4 && OS_Invastigated_avialible == true) { Flowchart.BroadcastFungusMessage("OS_Invastigated"); OS_Invastigated_avialible = false; } }
void Start() { seconds = myFlowchart.GetIntegerVariable("TimeTaken"); minutes = (int)(seconds / 60); seconds -= minutes * 60; text2c.text = "Time taken: " + minutes.ToString() + " min " + seconds.ToString() + " s"; text2w.text = "Time taken: " + minutes.ToString() + " min " + seconds.ToString() + " s"; enitiocount = myFlowchart.GetIntegerVariable("EnitioCount"); text3c.text = "Enitio collectibles: " + enitiocount.ToString() + "/6"; text3w.text = "Enitio collectibles: " + enitiocount.ToString() + "/6"; }
// Start is called before the first frame update // Update is called once per frame void Update() { if (flowchart.GetBooleanVariable("showMoral")) { moralBG.DOFade(1, 5f); if (moralBG.color.a >= 0.9) { moralText.gameObject.SetActive(true); moralText.text = "Ending " + flowchart.GetIntegerVariable("ending") + ":\n" + flowchart.GetStringVariable("moral"); moralText.DOFade(1, 8f); restartButton.SetActive(true); } Image[] buttonImages = restartButton.GetComponentsInChildren <Image>(); Text buttonText = restartButton.GetComponentInChildren <Text>(); foreach (Image ima in buttonImages) { ima.DOFade(1, 5f); } buttonText.DOFade(1, 5); } else { moralBG.DOFade(0, 2); moralText.gameObject.SetActive(false); moralText.alpha = 0; restartButton.SetActive(false); } }
public void LeaveScene() { infoDump.droneSpeed = talkFlowchart.GetIntegerVariable("DroneSpeed"); infoDump.phobosPower = talkFlowchart.GetIntegerVariable("PhobosPower"); infoDump.deimosPower = talkFlowchart.GetIntegerVariable("DeimosPower"); infoDump.fuelRegen = talkFlowchart.GetIntegerVariable("FuelRegen"); infoDump.hasQInfo = talkFlowchart.GetBooleanVariable("HasQInfo"); infoDump.hasQAdvice = talkFlowchart.GetBooleanVariable("HasQAdvice"); infoDump.weaponSystemStatus = talkFlowchart.GetStringVariable("WeaponsStatus"); infoDump.talkedToQ = talkFlowchart.GetBooleanVariable("TalkedToQ"); infoDump.talkedToAresa = talkFlowchart.GetBooleanVariable("TalkedToAresa"); infoDump.talkedToPD = talkFlowchart.GetBooleanVariable("TalkedToPD"); SceneManager.LoadScene("PaulScene", LoadSceneMode.Single); }
public void Save() { BinaryFormatter bf = new BinaryFormatter(); //creates a new binary formatter for serializing data. FileStream file = File.Create(Application.persistentDataPath + "/playerInfo.dat"); //Creates a file named playerInfo.dat at the projects persistent data path. health = PlayerChart.GetIntegerVariable("Health"); //Extracts the player health value from the player flowchart. level = Application.loadedLevel; //Stores the currently loaded level. playerX = player.transform.position.x; //Stores the player's X value as a float. playerY = player.transform.position.y; //Stores the player's Y value as a float. playerZ = player.transform.position.z; //Stores the player's Z value as a float. PlayerData data = new PlayerData(); //Creates a new PlayerData class to store the information to be saved. data.health = health; //Stores the health value inside the PlayerData's health value. data.level = level; //Stores the current level inside the PlayerData's level value. data.playerX = playerX; //Stores the player's X position inside the PlayerData's X position value. data.playerY = playerY; //Stores the player's Y position inside the PlayerData's Y position value. data.playerZ = playerZ; //Stores the player's Z position inside the PlayerData's Z position value. bf.Serialize(file, data); //Serializes and saves the PlayerData class in the playerInfo.dat file. file.Close(); //Closes the playerInfo.dat file. PlayerChart.ExecuteBlock("Saved"); //Executes a fungus block which writes "saved" to a text object in the player HUD }
public void AddCorrectCount() { if (flowchart == null) { return; } flowchart.SetIntegerVariable("CorrectCount", (flowchart.GetIntegerVariable("CorrectCount") + 1)); }
// Update is called once per frame void Update() { if (CurrentHealth <= 0) { Destroy(gameObject); thePlayerStats.AddExperience(expToGive); flowchart.SetIntegerVariable("Enemies", flowchart.GetIntegerVariable("Enemies") - 1); } }
void Update() { shuttingDownChecker = flowchart.GetIntegerVariable("shuttingDown"); playerNameChecker = flowchart.GetIntegerVariable("waitPlayerName"); if (shuttingDownChecker == 1) { Texto.SetActive(true); } if (playerNameChecker == 1) { Input.SetActive(true); trigger = true; } if (GlobalVariables.buttonFlag == true && trigger == true) { Input.SetActive(false); } }
void Start() { if (pcontrol != null) { if (pcontrol.GetIntegerVariable("keyPress") != 0) { if (pcontrol.FindBlock("UpdatePress") != null) { safe = true; } } } }
void Start() { if (GameObject.Find("VariablesSaveSlot")) { SaveVaribleObject = GameObject.Find("VariablesSaveSlot"); if (!SaveVaribleObject.GetComponent <LoadSave>().imLoaded) { myFlowchart.SetIntegerVariable("Time", SaveVaribleObject.GetComponent <LoadSave>().dayTime); myFlowchart.SetIntegerVariable("Money", SaveVaribleObject.GetComponent <LoadSave>().money); myFlowchart.SetStringVariable("Name", SaveVaribleObject.GetComponent <LoadSave>().playerName); myFlowchart.SetBooleanVariable("PrologEnd", SaveVaribleObject.GetComponent <LoadSave>().prologEnd); myFlowchart.SetIntegerVariable("KateAlpha", SaveVaribleObject.GetComponent <LoadSave>().kateAlpha); myFlowchart.SetIntegerVariable("KatePretty", SaveVaribleObject.GetComponent <LoadSave>().katePretty); myFlowchart.SetIntegerVariable("KlaraAlpha", SaveVaribleObject.GetComponent <LoadSave>().klaraAlpha); myFlowchart.SetIntegerVariable("KlaraPretty", SaveVaribleObject.GetComponent <LoadSave>().klaraPretty); myFlowchart.SetIntegerVariable("LizzyAlpha", SaveVaribleObject.GetComponent <LoadSave>().lizzyAlpha); myFlowchart.SetIntegerVariable("LizzyPretty", SaveVaribleObject.GetComponent <LoadSave>().lizzyPretty); myFlowchart.SetIntegerVariable("SaraAlpha", SaveVaribleObject.GetComponent <LoadSave>().saraAlpha); myFlowchart.SetIntegerVariable("SaraPretty", SaveVaribleObject.GetComponent <LoadSave>().saraPretty); SaveVaribleObject.GetComponent <LoadSave>().imLoaded = true; } } money = myFlowchart.GetIntegerVariable("Money"); dayTime = myFlowchart.GetIntegerVariable("Time"); LoadAndSaveInterface.SetActive(false); SettingsInterface.SetActive(false); MapInterface.SetActive(false); PhoneInterface.SetActive(false); InventoryInterface.SetActive(false); TimeCheck(dayTime); MoneyText.SetText(money.ToString()); PlaceText.SetText(SceneManager.GetActiveScene().name); DayText.SetText("Friday"); }
////////////////////////////////////////////////////////////////// // Updates script variables with the variableFlowchart variables if changed ////////////////////////////////////////////////////////////////// private void Update() { // Updates Sets the happiness and it's slider slider happiness = variableFlowchart.GetIntegerVariable("happiness"); happinessSlider.value = happiness; // Updates the player mood curMood = variableFlowchart.GetIntegerVariable("curMood"); // Updates the weather weather = variableFlowchart.GetIntegerVariable("weather"); // It's Impossible for your happiness level to be less than 0. // IF it is, TODO: "kill" player. if (happiness <= 50)// || Input.GetKeyDown(KeyCode.K)) { happiness = 0; updatePlayerAttributes(); kill(); } }
// Start is called before the first frame update void Start() { DOTween.SetTweensCapacity(20000, 50); gameState = GameState.menu; _instance = this; mentalDisplay = flowchart.GetIntegerVariable("mental"); affinityDisplay = flowchart.GetIntegerVariable("affinity"); }
void getFlowchartNums() { firstProblem = flowchart.GetBooleanVariable("FirstProblem"); currentProblem = flowchart.GetIntegerVariable("CurrentProblem"); if (firstProblem && (currentProblem != 2)) { currentText = 0; } else if (firstProblem && (currentProblem == 2)) { currentText = 4; } }
public void FakeBtnCicked() { var rm = flowChart.GetIntegerVariable("HeadRemain"); rm--; if (rm > 0) { } else { rm = 3; flowChart.SetBooleanVariable("BennettDead", true); } flowChart.SetIntegerVariable("HeadRemain", rm); }
private bool hasPlayer, finishedTask, hasTalked; // is the player in a collider? yes or no private void Awake() { hasTalked = false; timerText.enabled = false; questType = flowchart.GetIntegerVariable("questType"); playerReference = FindObjectOfType <PlayerController_Alex>(); pauseMenuReference = FindObjectOfType <PauseMenuController_Khoa>(); uiControllerReference = FindObjectOfType <UIController_Khoa>(); foreach (GameObject tempGameObjects in taskRelatedGameObjects) { tempGameObjects.SetActive(false); tempGameObjects.transform.SetParent(this.transform, true); } objectsNumber = taskRelatedGameObjects.Length; }
public void saveGame() { _gameManager.ScoreManager.pause(); _gameManager.ScoreManager.offset += _gameManager.ScoreManager.timeSinceStart(); SaveGame saveGame; Flowchart characFlowchart = GameObject.Find("/Char-Flowcharts").GetComponent <Flowchart>(); Flowchart itemFlowchart = GameObject.Find("/Item-Flowchart").GetComponent <Flowchart>(); saveGame = new SaveGame(itemFlowchart.GetBooleanVariable("IsPluggedIn"), itemFlowchart.GetBooleanVariable("IsBelt"), itemFlowchart.GetBooleanVariable("IsMachine"), characFlowchart.GetStringVariable("CURRENT_STATE"), characFlowchart.GetIntegerVariable("RNG"), _gameManager.ScoreManager); Stream serialiseStream = File.Create(filename); BinaryFormatter serializer = new BinaryFormatter(); serializer.Serialize(serialiseStream, saveGame); serialiseStream.Close(); }
// Update is called once per frame void Update() { EndSceneVar = myFlowchart.GetBooleanVariable("EndSceneVar"); BackgroundImgNo = myFlowchart.GetIntegerVariable("BackgroundImgNo"); if (EndSceneVar && RunOnce) { RunInstructions1(); } if (alpha < 255 && !RunOnce) { RunInstructions2(); } // Black background if (BackgroundImgNo == 0) { BackgroundImage.sprite = Resources.Load <Sprite>("UIVisualNovel/Sprites/intro-background-6"); } else { BackgroundImage.sprite = Resources.Load <Sprite>("UIVisualNovel/Sprites/intro-background-" + BackgroundImgNo.ToString()); } }
public void ReturnToCurrentBlock() { flowChart.ExecuteBlock(flowChart.FindBlock(flowChart.GetStringVariable("CurrentBlock")), flowChart.GetIntegerVariable("CommandIndex")); }
public IEnumerator updateOwnUnits() { // Clone the list! m_playerNotInteractGOList = new List <GameObject>(m_playerGOList); yield return(new WaitForSeconds(1.0f)); // If there is a previous unit, move the camera towards there! if (m_lastActionUnitTile) { CameraMovement.Instance.MoveTowardsPosition(m_lastActionUnitTile.transform.position); } else if (m_playerGOList.Count > 0) { // Randomly move the camera to any of the objects! CameraMovement.Instance.MoveTowardsPosition(m_playerGOList[0].transform.position); } while (m_playerNotInteractGOList.Count > 0) { CameraMovement.Instance.BeginCamFreeMovement(); playerMouseInput.enabled = true; // Will wait every frame for the player to click on the tile which belongs to the player! Also making sure that the player has not interact with the tile before! while (playerMouseInput.playerClickedTile == null || playerMouseInput.playerClickedTile.tag != "Player" || (!m_playerNotInteractGOList.Contains(playerMouseInput.playerClickedTile.gameObject) && playerMouseInput.playerClickedTile.tag == "Player")) { yield return(null); } CameraMovement.Instance.StopCamUpdateMovement(); TileScript firstTileClicked = playerMouseInput.playerClickedTile; // then set the green indicator! playerMouseInput.SetUnitIndicatorPermanent(firstTileClicked.transform); // Set it to null and prevent player from pressing! playerMouseInput.playerClickedTile = null; playerMouseInput.enabled = false; CharacterScript playerUnitStat = firstTileClicked.GetComponent <CharacterScript>(); UnitStatWindowManager.gameObject.SetActive(true); UnitStatWindowManager.DisplayUI(playerUnitStat); m_hasFinishedConversing = false; // set the motivation to be true then wait for it to be inactive! //displayMotivationScreen.SetActive(true); //while (displayMotivationScreen.activeSelf) // yield return null; //string talkToWhatChar = playerUnitStat.m_AttackType.ToString() + "|" + playerUnitStat.m_characterCharis.ToString(); // Try to talk to the character //theConversationChart.SendFungusMessage(talkToWhatChar); theConversationChart.SetIntegerVariable(m_MotivationVarStr, playerUnitStat.m_Motivation); theConversationChart.SetStringVariable(m_AttckTypeVarStr, playerUnitStat.m_AttackType.ToString()); theConversationChart.SendFungusMessage(m_MotivateDialogueStr); while (!m_hasFinishedConversing) { yield return(null); } UnitStatWindowManager.gameObject.SetActive(false); // Then we wait till the next tile that the player clicked on or maybe there is none! UnitFSM playerFSM = firstTileClicked.GetComponent <UnitFSM>(); yield return(null); playerUnitStat.m_Motivation = theConversationChart.GetIntegerVariable(m_MotivationVarStr); // Wait till the player clicked on a tile and it turns out to be the enemy or player clicked on the background and nothing is selected forsure! m_clickedFlag = false; //if (playerFSM.GetGenericState("DemoralizeState").interactWithState(m_PlayerChoseChar)) if (playerFSM.GetGenericState("DemoralizeState").interactWithState(null)) { // Only Successful interaction will mean being able to move the unit! m_endPlayerTurnScreen.SetActive(true); playerUnitStat.unitRangeRingGO.SetActive(true); } playerMouseInput.enabled = true; // Wait for next frame yield return(null); playerMouseInput.playerClickedTile = null; #region UNIT_ACTION while (m_endPlayerTurnScreen.activeSelf) { CameraMovement.Instance.BeginCamFreeMovement(); // Wait for PlayerBattleMouse to send the event trigger! while (!m_clickedFlag && m_endPlayerTurnScreen.activeSelf) { if (playerMouseInput.playerClickedTile && (playerMouseInput.playerClickedTile.tag == "Enemy" || playerMouseInput.playerClickedTile.tag == "EnemyFortress") && playerUnitStat.m_AttackType != CharacterScript.TYPE_ATTACK.HEAL) { // check whether the player is close to the enemy! if (playerUnitStat.m_Range >= Vector3.Distance(playerUnitStat.transform.position, playerMouseInput.playerClickedTile.transform.position)) { CharacterScript otherCharStat = playerMouseInput.playerClickedTile.GetComponent <CharacterScript>(); playerFSM.GetGenericState("AttackState").interactWithState(otherCharStat); playerFSM.ChangeCurrentState("AttackState"); // If Player attack, this means the unit turn has ended m_endPlayerTurnScreen.SetActive(false); break; } else { playerMouseInput.playerClickedTile = null; } } else if (playerMouseInput.playerClickedTile && playerMouseInput.playerClickedTile.tag == "Player" && playerUnitStat.m_AttackType == CharacterScript.TYPE_ATTACK.HEAL) { // check whether the player is close to allies! if (playerUnitStat.m_Range >= Vector3.Distance(playerUnitStat.transform.position, playerMouseInput.playerClickedTile.transform.position)) { CharacterScript otherCharStat = playerMouseInput.playerClickedTile.GetComponent <CharacterScript>(); playerFSM.GetGenericState("AttackState").interactWithState(otherCharStat); playerFSM.ChangeCurrentState("AttackState"); // If Player attack, this means the unit turn has ended m_endPlayerTurnScreen.SetActive(false); break; } else { playerMouseInput.playerClickedTile = null; } } yield return(null); } // Making sure the player clicked on an empty tile and their available movement tiles are more than 0. if (!hasUIBlockRaycast && !playerMouseInput.playerClickedTile && playerUnitStat.m_leftOverMoveSpeed > 0) { // If successful interaction, then will move! // Player pressed nothing, so move towards there! if (playerFSM.GetGenericState("MoveState").interactWithState(playerMouseInput.playerMouseLastClickedPos)) { playerFSM.ChangeCurrentState("MoveState"); // Then wait for the FSM to be finished updating! yield return(playerFSM.updateStateCoroutine); } } //else { // Reset the tile! playerMouseInput.playerClickedTile = null; } CameraMovement.Instance.StopCamUpdateMovement(); m_clickedFlag = false; yield return(null); } #endregion // Unblock the raycast! hasUIBlockRaycast = false; playerMouseInput.SetUnitIndicatorPermanent(null); if (firstTileClicked) { playerUnitStat.resetMoveSpeed(); // Removed the already interacted gameobject! m_playerNotInteractGOList.Remove(firstTileClicked.gameObject); m_lastActionUnitTile = firstTileClicked; firstTileClicked.GetComponent <SpriteRenderer>().color = colorOfUsedUnit; playerUnitStat.unitRangeRingGO.SetActive(false); } else { RemoveDestroyedUnit(); } } CameraMovement.Instance.StopCamUpdateMovement(); // Set it to be false! GameManager.Instance.isItPlayerTurn = false; // Then change all of the unit color back to normal foreach (GameObject unitGO in m_playerGOList) { SpriteRenderer unitSprRender = unitGO.GetComponent <SpriteRenderer>(); unitSprRender.color = Color.white; } yield break; }
void Update() { CanChangeForm(); enteredDialogue = flowchart1.GetIntegerVariable("AllTalks"); }
// Start is called before the first frame update void Start() { myflowchart = FindObjectOfType <Flowchart>(); chat_progress = myflowchart.GetIntegerVariable("dio_progress"); }
public override void OnEnter() { result.Value = flowchart.GetIntegerVariable(parameter.Value); Finish(); }
void getFlowchartNums() { heartNum = flowchart.GetIntegerVariable("HeartNum"); }