private void Burn() { //timer if ((dotTimerTick < StoryProgressionManager.GetTimeHours()) && (dotTimer <= StoryProgressionManager.GetTimeHours())) { gameObject.GetComponent <CharacterStats>().TakeDamage(amount, DictionaryHolder.element.Fire); dotTimer++; } }
public void MoveRight() { moveCast = new Vector3(moveDistance, 0, 0); moveCast += player.transform.position; movedRight = true; ControlsEnabled(false); //advance time StoryProgressionManager.AddTime(1); }
private void Poison() { //timer if ((dotTimerTick <= StoryProgressionManager.GetTimeHours()) && (dotTimer <= StoryProgressionManager.GetTimeHours())) { GameObject.FindGameObjectWithTag("FightWindow").GetComponent <FightManager>().WriteToInfoLabel(string.Format("<color=green>Poisoned</color>... <color=red>{0}</color>", gameObject.GetComponent <CharacterStats>().TakeDamage(amount, DictionaryHolder.element.Earth))); dotTimer++; } }
private void Rotate() { //get angle per hour int exactAngle = (360 / 24) * StoryProgressionManager.GetCurrentTimeHours(); //set location to achieve pointAngle = Quaternion.Euler(0, 0, -exactAngle - 180); //rotate transform.rotation = Quaternion.Lerp(transform.rotation, pointAngle, 0.01f); }
private void Escape() { if (dotTimer >= dotTimerTick) { GameObject.FindGameObjectWithTag("FightWindow").GetComponent <FightManager>().EnemyEscape(); } if (dotTimer < StoryProgressionManager.GetTimeHours()) { dotTimer = StoryProgressionManager.GetTimeHours(); } }
private void Bleed() { //timer if (dotTimerTick < StoryProgressionManager.GetTimeHours()) { Debug.Log(dotTimer + "/" + dotTimerTick); } else { GameObject.FindGameObjectWithTag("FightWindow").GetComponent <FightManager>().WriteToInfoLabel(string.Format("<color=red>Bleeding</color>... <color=red>{0}</color>", gameObject.GetComponent <CharacterStats>().TakeDamage(amount, DictionaryHolder.element.Dark))); amount = 0; } }
// Start is called before the first frame update void Start() { //name playerName = "Slimey"; //save load manager datamanager = GetComponent <DataManager>(); //story progression StoryProgressionManager.Initialize(); //stats currentStats = new DictionaryHolder(); modifierStats = new DictionaryHolder(); baseStats = new DictionaryHolder(); baseStats.ChangeStat(DictionaryHolder.statType.Health, 10); baseStats.ChangeStat(DictionaryHolder.statType.Slime, 10); baseStats.ChangeStat(DictionaryHolder.statType.Damage, DictionaryHolder.element.Neutral, 1); //gathering levels Farming = new CharacterJobClass("Farming", 1, 20, 1, 3); Fishing = new CharacterJobClass("Fishing", 1, 20, 1, 3); Mining = new CharacterJobClass("Mining", 1, 20, 1, 3); WoodCutting = new CharacterJobClass("WoodCutting", 1, 20, 1, 3); //modified stats actionPointsCurent = baseStats.actionPoints; healthCurrent = baseStats.health; slimeCurrent = baseStats.slime; expPoolCurrent = 0; /* * //try load * datamanager.Load(); * * //try save * datamanager.Save(); */ }
/*map legend: * 0 = entrance (this is put at -1*x automatically) * 1 = farm * 2 = forest * 3 = mine * 4 = river * 5 = chest * 6 = monster * 7 = boss * 8 = door (add locations through doorlocations list for each door) * 9 = wall (these are put at the beginning and end of a stage automatically) * 10 = SkillUpgradeStation * 11 = AlchemyStation * */ // Start is called before the first frame update void Start() { map = new List <int>(); doorLocations = new List <string>(); switch (SceneManager.GetActiveScene().name) { //set map creation here //if there are doors, set door locations case "Home": { //sets hub list of blocks map = new List <int>() { 8, 10, 11 }; doorLocations.Clear(); doorLocations.Add("World"); break; } case "World": { map = CreateWorld(StoryProgressionManager.GetMapSize(), StoryProgressionManager.GetDifficulty()); break; } } //door counter (used to go through door scene locations) int door = 0; // Instantiate Walls on the edges of the map Instantiate(blocks[9], new Vector3(-2 * 1.5f, 0, 0), blocks[9].transform.rotation); Instantiate(blocks[9], new Vector3(map.Count * 1.5f, 0, 0), blocks[9].transform.rotation); // Instantiate Entrance Instantiate(blocks[0], new Vector3(-1 * 1.5f, 0, 0), blocks[0].transform.rotation); //instantiate map for (int i = 0; i < map.Count; i++) { //instantiates objects in blocks list var tempObj = Instantiate(blocks[map[i]], new Vector3(i * 1.5f, 0, 0), blocks[map[i]].transform.rotation); //if its a door if (tempObj.tag == "Door") { //adds the scene name to the changeScene script tempObj.GetComponent <ChangeScene>().sceneName = doorLocations[door]; door++; } //if its an enemy else if ((tempObj.tag == "Boss") || (tempObj.tag == "Monster")) { //handles monster spawns EnemySpawn(tempObj, StoryProgressionManager.GetDifficulty()); } } //if it doesnt find player if (!GameObject.FindGameObjectWithTag("Player")) { //instantiate all objects that should be on every scene for (int i = 0; i < dontDestroyOnLoadObjects.Length; i++) { Instantiate(dontDestroyOnLoadObjects[i]); } } //set player to entrance GameObject.FindGameObjectWithTag("Player").transform.position = new Vector3( GameObject.FindGameObjectWithTag("Entrance").transform.position.x, GameObject.FindGameObjectWithTag("Player").transform.position.y, GameObject.FindGameObjectWithTag("Player").transform.position.z); GameObject.FindGameObjectWithTag("Canvas").GetComponent <UIControls>().MoveToEntrance(); }
private void EnemySpawn(GameObject enemyBlock, int mapDifficulty) { //if there is an enemy script attached if (enemyBlock.TryGetComponent <Enemy>(out Enemy en)) { //replace this with monster spawning function int random = Random.Range(0, StoryProgressionManager.GetMaxEnemyUnlocked()); switch (random) { case 0: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.Fish); break; } case 1: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.Lizzard); break; } case 2: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.Cat); break; } case 3: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.Scorpion); break; } case 4: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.Slime); break; } case 5: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.Fox); break; } case 6: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.Boar); break; } case 7: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.Wolf); break; } case 8: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.Bear); break; } case 9: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.Goblin); break; } case 10: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.LandFish); break; } case 11: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.LizardMan); break; } case 12: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.Eagle); break; } case 13: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.Kappa); break; } case 14: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.ArmoredBoar); break; } case 15: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.Pixie); break; } case 16: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.FireFox); break; } case 17: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.Frog); break; } case 18: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.Panda); break; } case 19: { enemyBlock.GetComponent <Enemy>().SetEnemy(EnemiesDatabase.enemy.Golem); break; } } enemyBlock.name = enemyBlock.GetComponent <Enemy>().GetEnemyType().ToString(); } }
private void UpdateInDeCreaseMapSizeButtons() { increaseMapButton.GetComponent <Button>().interactable = ((StoryProgressionManager.GetMapSize() + 1 > StoryProgressionManager.GetMapSizeMaxUnlocked()) ? false : true); decreaseMapButton.GetComponent <Button>().interactable = ((StoryProgressionManager.GetMapSize() - 1 <= 0) ? false : true); }
public void DecreaseMapSize() { StoryProgressionManager.IncrementMapSize(-1); }
public void UpdateNeutralSkills() { UpdateSkills(DictionaryHolder.element.Neutral); StoryProgressionManager.AddTime(6); }
public void UpdateDarkSkills() { UpdateSkills(DictionaryHolder.element.Dark); StoryProgressionManager.AddTime(6); }
// Update is called once per frame void Update() { #region Health/SPUpdate //set hp var temp = hpBar.GetComponent <RectTransform>(); temp.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, Mathf.Clamp((player.GetComponent <CharacterStats>().healthCurrent *hpBarMaxWidth) / player.GetComponent <CharacterStats>().currentStats.health, 0, 100000)); hpLabel.text = player.GetComponent <CharacterStats>().healthCurrent.ToString() + "/" + player.GetComponent <CharacterStats>().currentStats.health.ToString(); //set sp - slime points temp = spBar.GetComponent <RectTransform>(); temp.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, Mathf.Clamp((player.GetComponent <CharacterStats>().slimeCurrent *spBarMaxWidth) / player.GetComponent <CharacterStats>().currentStats.slime, 0, 100000)); spLabel.text = player.GetComponent <CharacterStats>().slimeCurrent.ToString() + "/" + player.GetComponent <CharacterStats>().currentStats.slime.ToString(); //error fixing try { if (enemy != null) { //set enemy hp temp = enemyHpBar.GetComponent <RectTransform>(); temp.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, Mathf.Clamp((enemy.GetHealth() * enemyHpBarMaxWidth) / enemy.GetHealthMax(), 0, 100000)); enemyHpLabel.text = enemy.GetHealth().ToString() + "/" + enemy.GetHealthMax().ToString(); //set enemy sp - slime points temp = enemySpBar.GetComponent <RectTransform>(); temp.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, Mathf.Clamp((enemy.GetSP() * spBarMaxWidth) / enemy.GetSPMax(), 0, 100000)); enemySpLabel.text = enemy.GetSP().ToString() + "/" + enemy.GetSPMax().ToString(); } } catch (Exception ex) { Debug.Log("Enemy not set. Error: " + ex.ToString()); } #endregion #region FightFlow //continuous label update UpdateInfoLabel(); //fight flow switch (fightState) { case FightFlow.Start: { ResetFight(); //label write WriteToInfoLabel(string.Format("<color=purple>{0}</color> encountered!", enemy.GetEnemyType())); #region UISetUp enemyName.text = enemy.GetEnemyName(); //set element choice slots maxElementChoiceSlots = Mathf.Clamp(player.GetComponent <CharacterStats>().currentStats.elementSlots, 0, 7); //disable/enable elemental slots for (int i = 0; i < elementChoiceSlots.Length; i++) { //skill[0] dictates the amount of elemental slots a player can have if (i < maxElementChoiceSlots) { elementChoiceSlots[i].SetActive(true); } else { elementChoiceSlots[i].SetActive(false); } } //set elements available according to lvl 1 skills for (int i = 0; i < elementIcons.Length; i++) { if (player.GetComponent <CharacterSkillTree>().ActiveSkills()[i].CurrentLevel() > 0) { elementChoices[i].SetActive(true); } else { elementChoices[i].SetActive(false); } } #endregion //move to next phase fightState = FightFlow.ChooseElements; break; } case FightFlow.ChooseElements: { //check death if (player.GetComponent <CharacterStats>().healthCurrent <= 0) { //write death WriteToInfoLabel("You're too weak to continue..."); //advance time StoryProgressionManager.AddTime(24); //end fight fightState = FightFlow.End; } //enable element choosing chooseElements = true; //if at least one elements has been chosen if (elementChoicesCounter >= maxElementChoiceSlots) { executeButton.SetActive(true); } else { executeButton.SetActive(false); } break; } case FightFlow.Attack: { //disable element choosing chooseElements = false; //attack AttackRoutine(); //clear element choice slots ClearChosenSlots(); //change phase if (enemy.GetHealth() > 0) { fightState = FightFlow.Defend; } else { //end fightState = FightFlow.Resolve; } break; } case FightFlow.Defend: { //enemy attack DefendRoutine(); //advance time StoryProgressionManager.AddTime(1); //check death if (player.GetComponent <CharacterStats>().healthCurrent <= 0) { //write death WriteToInfoLabel("You're too weak to continue..."); //advance time StoryProgressionManager.AddTime(24); //end fight fightState = FightFlow.End; } else { //attack again fightState = FightFlow.ChooseElements; } break; } case FightFlow.Resolve: { //write exp given WriteToInfoLabel(string.Format("Battle end... Obtained <color=yellow>{0}</color> exp.", enemy.GetExp())); //give exp player.GetComponent <CharacterStats>().GainExp(enemy.GetExp()); //add enemy to requirements StoryProgressionManager.currentRequirementProgress.ChangeRequirementValue(enemy.GetElement(), 1); //end fightState = FightFlow.End; break; } case FightFlow.End: { //remove enemy skill effects foreach (EnemySkillEffect skillEffect in player.GetComponents <EnemySkillEffect>()) { Destroy(skillEffect); } //wait for read if (!WaitingForRead()) { //check death if (player.GetComponent <CharacterStats>().healthCurrent <= 0) { player.GetComponent <CharacterStats>().actionPointsCurent = 0; } else { //take ap player.GetComponent <CharacterStats>().actionPointsCurent--; } fightState = FightFlow.OutsideFight; //fade GameObject.FindGameObjectWithTag("FadePanel").GetComponent <FadePanel>().Fade(0.5f); } break; } case FightFlow.OutsideFight: { //keep window hidden GetComponent <ShowHideWindow>().showHide = false; infoLabel.text = ""; break; } } #endregion }
public void UseSkillEffect(DictionaryHolder.element statElement) { switch (currentEffect) { case Effects.ResUp: { var temp = GameObject.FindGameObjectWithTag("FightWindow").GetComponent <FightManager>().enemy.gameObject.AddComponent <EnemySkillEffect>(); temp.SetAmount(amount); temp.SetEffect(currentEffect); temp.SetElement(statElement); break; } case Effects.AllResUp: { var temp = GameObject.FindGameObjectWithTag("FightWindow").GetComponent <FightManager>().enemy.gameObject.AddComponent <EnemySkillEffect>(); temp.SetAmount(amount); temp.SetEffect(currentEffect); break; } case Effects.ResDown: { var temp = GameObject.FindGameObjectWithTag("Player").gameObject.AddComponent <EnemySkillEffect>(); temp.SetAmount(amount); temp.SetEffect(currentEffect); temp.SetElement(statElement); break; } case Effects.DamageDown: { var temp = GameObject.FindGameObjectWithTag("Player").gameObject.AddComponent <EnemySkillEffect>(); temp.SetAmount(amount); temp.SetEffect(currentEffect); temp.SetElement(statElement); break; } case Effects.DamageUp: { var temp = GameObject.FindGameObjectWithTag("FightWindow").GetComponent <FightManager>().enemy.gameObject.AddComponent <EnemySkillEffect>(); temp.SetAmount(amount); temp.SetEffect(currentEffect); temp.SetElement(statElement); break; } case Effects.Poison: { var temp = GameObject.FindGameObjectWithTag("Player").gameObject.AddComponent <EnemySkillEffect>(); temp.SetAmount(amount); temp.SetEffect(currentEffect); temp.dotTimerTick = StoryProgressionManager.GetTimeHours() + 7; temp.dotTimer = StoryProgressionManager.GetTimeHours() + 1; break; } case Effects.Burn: { var temp = GameObject.FindGameObjectWithTag("Player").gameObject.AddComponent <EnemySkillEffect>(); temp.SetAmount(amount); temp.SetEffect(currentEffect); temp.dotTimerTick = StoryProgressionManager.GetTimeHours() + 3; temp.dotTimer = StoryProgressionManager.GetTimeHours() + 1; break; } case Effects.Bleed: { var temp = GameObject.FindGameObjectWithTag("Player").gameObject.AddComponent <EnemySkillEffect>(); temp.SetAmount(amount); temp.SetEffect(currentEffect); temp.dotTimerTick = StoryProgressionManager.GetTimeHours() + 3; break; } case Effects.Escape: { var temp = GameObject.FindGameObjectWithTag("FightWindow").GetComponent <FightManager>().enemy.gameObject.AddComponent <EnemySkillEffect>(); temp.SetAmount(amount); temp.SetEffect(currentEffect); temp.dotTimerTick = StoryProgressionManager.GetTimeHours() + 1; temp.dotTimer = StoryProgressionManager.GetTimeHours(); break; } case Effects.Exp: { var temp = GameObject.FindGameObjectWithTag("FightWindow").GetComponent <FightManager>().enemy.gameObject.AddComponent <EnemySkillEffect>(); temp.SetAmount(amount); temp.SetEffect(currentEffect); break; } case Effects.Heal: { var temp = GameObject.FindGameObjectWithTag("FightWindow").GetComponent <FightManager>().enemy.gameObject.AddComponent <EnemySkillEffect>(); temp.SetAmount(amount); temp.SetEffect(currentEffect); break; } } }
// Update is called once per frame void Update() { //ap actionPoints.text = "AP:" + GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterStats>().actionPointsCurent.ToString(); //clock clock.text = string.Format("{0}Y {1}M {2}D {3}H", StoryProgressionManager.GetTimeYears(), StoryProgressionManager.GetTimeMonths(), StoryProgressionManager.GetTimeDays(), StoryProgressionManager.GetCurrentTimeHours()); //escape button if ((SceneManager.GetActiveScene().name == "Home") || (GameObject.FindGameObjectWithTag("FightWindow").GetComponent <FightManager>().GetFightState() != FightManager.FightFlow.OutsideFight)) { escapeButton.SetActive(false); } else { escapeButton.SetActive(true); } //door size if (GameObject.FindGameObjectWithTag("Canvas").GetComponent <UIControls>().IsNearDoor()) { doorButton.SetActive(true); doorSize.text = StoryProgressionManager.GetMapSize().ToString(); } else { doorButton.SetActive(false); } //skill Unlock Interface if (GameObject.FindGameObjectWithTag("Canvas").GetComponent <UIControls>().IsNearSkillUnlockStation()) { skillUnlockStationButton.SetActive(true); } else { skillUnlockStationButton.SetActive(false); skillUnlockStationPanel.SetActive(false); skillUnlockStationButton.GetComponent <ShowHideWindow>().showHide = false; } //alchemy Interface if (GameObject.FindGameObjectWithTag("Canvas").GetComponent <UIControls>().IsNearAlchemyStation()) { alchemyButton.SetActive(true); } else { alchemyButton.SetActive(false); alchemyPanel.SetActive(false); alchemyButton.GetComponent <ShowHideWindow>().showHide = false; } //gold gold.text = player.GetComponent <InventorySystem>().itemList[0].GetAmount().ToString(); //player name playerName.text = player.GetComponent <CharacterStats>().playerName; //exp expPool.text = string.Format("{0}/{1}", player.GetComponent <CharacterStats>().expPoolCurrent, player.GetComponent <CharacterStats>().currentStats.expPool); exp.width = AdjustBarSize(exp.Maxwidth, player.GetComponent <CharacterStats>().expPoolCurrent, player.GetComponent <CharacterStats>().currentStats.expPool); expBar.GetComponent <RectTransform>().sizeDelta = new Vector2(exp.width, exp.expbarSize.y); //jobs lumber.text = string.Format("WoodCutting Lvl.{0}", playerStats.WoodCutting.GetLevel()); farmer.text = string.Format("Farming Lvl.{0}", playerStats.Farming.GetLevel()); fisher.text = string.Format("Fishing Lvl.{0}", playerStats.Fishing.GetLevel()); miner.text = string.Format("Mining Lvl.{0}", playerStats.Mining.GetLevel()); //farmer farmerExpLabel.text = string.Format("{0}/{1}", player.GetComponent <CharacterStats>().Farming.GetExp(), player.GetComponent <CharacterStats>().Farming.GetExpToLevel()); farmerExp.width = AdjustBarSize(farmerExp.Maxwidth, player.GetComponent <CharacterStats>().Farming.GetExp(), player.GetComponent <CharacterStats>().Farming.GetExpToLevel()); farmerExpBar.GetComponent <RectTransform>().sizeDelta = new Vector2(farmerExp.width, farmerExp.expbarSize.y); //lumberman lumberjackExpLabel.text = string.Format("{0}/{1}", player.GetComponent <CharacterStats>().WoodCutting.GetExp(), player.GetComponent <CharacterStats>().WoodCutting.GetExpToLevel()); lumberExp.width = AdjustBarSize(lumberExp.Maxwidth, player.GetComponent <CharacterStats>().WoodCutting.GetExp(), player.GetComponent <CharacterStats>().WoodCutting.GetExpToLevel()); lumberjackExpBar.GetComponent <RectTransform>().sizeDelta = new Vector2(lumberExp.width, lumberExp.expbarSize.y); //fisher fisherExpLabel.text = string.Format("{0}/{1}", player.GetComponent <CharacterStats>().Fishing.GetExp(), player.GetComponent <CharacterStats>().Fishing.GetExpToLevel()); fisherExp.width = AdjustBarSize(fisherExp.Maxwidth, player.GetComponent <CharacterStats>().Fishing.GetExp(), player.GetComponent <CharacterStats>().Fishing.GetExpToLevel()); fisherExpBar.GetComponent <RectTransform>().sizeDelta = new Vector2(fisherExp.width, fisherExp.expbarSize.y); //miner minerExpLabel.text = string.Format("{0}/{1}", player.GetComponent <CharacterStats>().Mining.GetExp(), player.GetComponent <CharacterStats>().Mining.GetExpToLevel()); minerExp.width = AdjustBarSize(minerExp.Maxwidth, player.GetComponent <CharacterStats>().Mining.GetExp(), player.GetComponent <CharacterStats>().Mining.GetExpToLevel()); minerExpBar.GetComponent <RectTransform>().sizeDelta = new Vector2(minerExp.width, minerExp.expbarSize.y); //stats stats1.text = string.Format( "Health: {0}/{1}\n" + "Slime: {2}/{3}\n" + "Element Slots: {4}\n" + "Action Points: {5}/{6}", playerStats.healthCurrent.ToString(), playerStats.currentStats.health.ToString(), playerStats.slimeCurrent.ToString(), playerStats.currentStats.slime.ToString(), playerStats.currentStats.elementSlots.ToString(), playerStats.actionPointsCurent.ToString(), playerStats.currentStats.actionPoints.ToString()); stats2.text = string.Format( "Res:\n" + "Fire - {0}\n" + "Water - {1}\n" + "Earth - {2}\n" + "Wind - {3}\n" + "Light - {4}\n" + "Dark - {5}\n" + "Neutral - {6}", playerStats.currentStats.fixedDamageStats[DictionaryHolder.element.Fire].ToString(), playerStats.currentStats.fixedDamageStats[DictionaryHolder.element.Water].ToString(), playerStats.currentStats.fixedDamageStats[DictionaryHolder.element.Earth].ToString(), playerStats.currentStats.fixedDamageStats[DictionaryHolder.element.Wind].ToString(), playerStats.currentStats.fixedDamageStats[DictionaryHolder.element.Fire].ToString(), playerStats.currentStats.fixedDamageStats[DictionaryHolder.element.Dark].ToString(), playerStats.currentStats.fixedDamageStats[DictionaryHolder.element.Neutral].ToString()); stats3.text = string.Format( "Damage:\n" + "Fire - {0}\n" + "Water - {1}\n" + "Earth - {2}\n" + "Wind - {3}\n" + "Light - {4}\n" + "Dark - {5}\n" + "Neutral - {6}", playerStats.currentStats.percentDamageStats[DictionaryHolder.element.Fire].ToString(), playerStats.currentStats.percentDamageStats[DictionaryHolder.element.Water].ToString(), playerStats.currentStats.percentDamageStats[DictionaryHolder.element.Earth].ToString(), playerStats.currentStats.percentDamageStats[DictionaryHolder.element.Wind].ToString(), playerStats.currentStats.percentDamageStats[DictionaryHolder.element.Fire].ToString(), playerStats.currentStats.percentDamageStats[DictionaryHolder.element.Dark].ToString(), playerStats.currentStats.percentDamageStats[DictionaryHolder.element.Neutral].ToString()); stats4.text = string.Format( "Damage(%):\n" + "Fire - {0}%\n" + "Water - {1}%\n" + "Earth - {2}%\n" + "Wind - {3}%\n" + "Light - {4}%\n" + "Dark - {5}%\n" + "Neutral - {6}%", playerStats.currentStats.fixedResStats[DictionaryHolder.element.Fire].ToString(), playerStats.currentStats.fixedResStats[DictionaryHolder.element.Water].ToString(), playerStats.currentStats.fixedResStats[DictionaryHolder.element.Earth].ToString(), playerStats.currentStats.fixedResStats[DictionaryHolder.element.Wind].ToString(), playerStats.currentStats.fixedResStats[DictionaryHolder.element.Fire].ToString(), playerStats.currentStats.fixedResStats[DictionaryHolder.element.Dark].ToString(), playerStats.currentStats.fixedResStats[DictionaryHolder.element.Neutral].ToString()); }
// Update is called once per frame void Update() { if ((interacting) && (timer == 0)) { try { _progressBarImage = Instantiate(progressbarImage, GameObject.FindGameObjectWithTag("Canvas").transform); _progressBarImage.GetComponent <RectTransform>().position = new Vector3((Screen.currentResolution.width / 2) - (_progressBarImage.GetComponent <RectTransform>().sizeDelta.x / 2), Screen.currentResolution.height - _progressBarImage.GetComponent <RectTransform>().sizeDelta.y - 50, 0); _progressBarText = Instantiate(progressbarText, _progressBarImage.transform); _progressBarText.GetComponent <RectTransform>().position = new Vector3(_progressBarImage.transform.position.x, _progressBarImage.transform.position.y, -1); timer += 0.001f; } catch { throw new System.Exception("Error instantiating progress bar."); } } //interaction if ((timer > 0) && (timer <= resourceTimer)) { timer += Time.deltaTime; //ui display _progressBarText.GetComponent <Text>().text = (resourceTimer - timer).ToString("0.00") + " s"; _progressBarImage.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, loadBarMaxWidth * (1 - (timer / resourceTimer))); } //gather resource and cleanup if (timer >= resourceTimer) { int item = 0; int amount = 0; //interaction case switch (tag) { case "Farm": { GetComponent <ResourceGatheringManager>().GetResourceRoll(CharacterJobClass.JobList.Farmer, out item, out amount); player.GetComponent <CharacterStats>().Farming.AddExp(GatheringExpGained); break; } case "Forest": { GetComponent <ResourceGatheringManager>().GetResourceRoll(CharacterJobClass.JobList.WoodCutter, out item, out amount); player.GetComponent <CharacterStats>().WoodCutting.AddExp(GatheringExpGained); break; } case "Mine": { GetComponent <ResourceGatheringManager>().GetResourceRoll(CharacterJobClass.JobList.Miner, out item, out amount); player.GetComponent <CharacterStats>().Mining.AddExp(GatheringExpGained); break; } case "River": { GetComponent <ResourceGatheringManager>().GetResourceRoll(CharacterJobClass.JobList.Fisherman, out item, out amount); player.GetComponent <CharacterStats>().Fishing.AddExp(GatheringExpGained); break; } case "Chest": { GetComponent <ResourceGatheringManager>().GetResourceRoll(CharacterJobClass.JobList.None, out item, out amount); break; } case "Monster": { //fade GameObject.FindGameObjectWithTag("FadePanel").GetComponent <FadePanel>().Fade(1f); //show window GameObject.FindGameObjectWithTag("FightWindow").GetComponent <ShowHideWindow>().showHide = true; //start fight state GameObject.FindGameObjectWithTag("FightWindow").GetComponent <FightManager>().StartFight(gameObject.GetComponent <Enemy>()); break; } case "Boss": { //fade GameObject.FindGameObjectWithTag("FadePanel").GetComponent <FadePanel>().Fade(1.5f); //show window GameObject.FindGameObjectWithTag("FightWindow").GetComponent <ShowHideWindow>().showHide = true; //start fight state GameObject.FindGameObjectWithTag("FightWindow").GetComponent <FightManager>().StartFight(gameObject.GetComponent <Enemy>()); break; } } if (amount != 0) { //add to inventory player.GetComponent <InventorySystem>().AddItem(item, amount); //take ap player.GetComponent <CharacterStats>().actionPointsCurent--; } //stop all interaction timer = -1; GetComponent <Interact>().interacted = true; interacting = false; //destroy Destroy(_progressBarImage); Destroy(_progressBarText); interacting = false; //advance time StoryProgressionManager.AddTime(1); } }