// Update is called once per frame void Update() { if (Input.GetKeyUp(KeyCode.C)) { // player.setinCombat(false); xButton.SetActive(true); // WinSound.SetActive (false); Combat.SetActive(false); GameObject.Find("Player").GetComponent <InitiateDialogue> ().setA(true); location.setLevel(playerScript.getSavedLevel()); stats.setStatsCanOpen(true); print("hp: " + playerStart.getPHPBar() + "sp: " + playerStart.getSHPBar()); Combat.GetComponent <BattleSystem> ().WinSound.Stop(); Destroy(Combat.GetComponent <ItemDrop> ()); } }
void Start() { Napsack combatNap = GameObject.Find("Combat").GetComponent <Napsack> (); combatNap.slotCount = 0; combatNap.fillSlots(); PlayerMove = GameObject.Find("Player").GetComponent <PlayerMovement> (); PlayerMove.setinCombat(true); Player = GameObject.Find("Player").GetComponent <Player> (); playerStart = GameObject.Find("PlayerNap").GetComponent <PlayerStart>(); location = Player.GetComponent <Location> (); GameObject.Find("Player").GetComponent <InitiateDialogue> ().setA(false); Combat = GameObject.Find("Combat"); stats = GameObject.Find("Stats_Icon").GetComponent <Stats> (); stats.setStatsCanOpen(false); ItemDropBool = GameObject.Find("ItemDropImage"); ItemDropBool.SetActive(false); battleScreen = GameObject.Find("BattleScreen"); battleScreen.SetActive(true); pHP = GameObject.Find("PlayerNap").GetComponent <PlayerStart>().getPHP(); sHP = GameObject.Find("PlayerNap").GetComponent <PlayerStart>().getSHP(); //Audio Clips AttackSound = GameObject.Find("Attack").GetComponent <AudioSource>(); BossSpecialSound = GameObject.Find("Boss Special").GetComponent <AudioSource>(); PlayerSPSound = GameObject.Find("Player Special").GetComponent <AudioSource>(); WinSound = GameObject.Find("WinSound").GetComponent <AudioSource>(); //playerTurn playerTurn = true; //health bars HP = GameObject.Find("HP"); SP = GameObject.Find("SP"); EP = GameObject.Find("EP"); //keeps track of health bar size HP.transform.localScale = new Vector3((pHP * .25f) / GameObject.Find("PlayerNap").GetComponent <PlayerStart>().getbasePHP(), .4f, 0); SP.transform.localScale = new Vector3((sHP * .25f) / GameObject.Find("PlayerNap").GetComponent <PlayerStart>().getbaseSHP(), .4f, 0); EP.transform.localScale = new Vector3(.25f, .4f, 0); bossActive = false; maajiActive = Player.getMaajiActive(); elliotActive = Player.getElliotActive(); sleepingGirlActive = Player.getSleepingGirlActive(); dreamKeeperActive = Player.getDreamKeeperActive(); enemyAnimator = GameObject.Find("MonsterImage").GetComponent <Animator> (); noEscape = GameObject.Find("NoEscape"); MonsterName = GameObject.Find("MonsterName").GetComponent <Text>(); chooseMonster(); monsterAttackCurrent = false; HPrectR = HP.GetComponent <RectTransform> (); HPrect = playerStart.getPHPBarSTATIC(); HPrectTEMP = playerStart.getPHPBar(); // print ("HPrecttempinitial: "+HPrectTEMP); HPincN = 5.0f / playerStart.getbasePHP(); HPincS = 10.0f / playerStart.getbasePHP(); System.Math.Round(HPincN, 2); System.Math.Round(HPincS, 2); SPrectR = SP.GetComponent <RectTransform> (); SPrect = playerStart.getSHPBarSTATIC(); SPrectTEMP = playerStart.getSHPBar(); // print ("SPrecttempinitial: "+SPrectTEMP); SPinc = 20.0f / playerStart.getbaseSHP(); System.Math.Round(SPinc, 2); EPrectR = EP.GetComponent <RectTransform> (); EPrect = EPrectR.rect.width; EPrectTEMP = EPrect; EPincN = 5.0f / eHP; EPincS = 10.0f / eHP; System.Math.Round(EPincN, 2); System.Math.Round(EPincS, 2); //menu bar SelectionArrow = GameObject.Find("SelectionArrow"); RectTransform arrowpos = SelectionArrow.GetComponent <RectTransform> (); arrowpos.anchoredPosition = new Vector2(-15f, -39.4f); menuPlaceHolder = 0; SPOut = GameObject.Find("SPOut").GetComponent <RawImage>(); //SPOut.SetActive (false); SPOut.enabled = false; //napsack Napsack = GameObject.Find("NapsackImage"); Napsack.SetActive(false); NapsackActive = false; //log logText = GameObject.Find("LogText").GetComponent <Text>(); logText.text = "Battle Start!"; logTextfiller = ""; logTextTracker = 0; xButton = GameObject.Find("x"); xButton.SetActive(false); //zButton = GameObject.Find("z"); //zButton.SetActive(false); }
IEnumerator clickPause() { yield return(new WaitForSeconds(0.25f)); if (itemName != "Room Key" && itemName != "Recorder") { if (itemName == "Mystery Potion") { int randInt = Random.Range(0, 1); if (randInt == 0) { hpChange = hpChange; } else { hpChange = hpChange * -1; } } if (itemName == "Wooden Amulet") { GameObject.Find("Combat").GetComponent <BattleSystem> ().luckNumCount = 3; } print("hpchange: " + hpChange); print("spchange: " + spChange); HPrectTEMP += (playerStart.getPHPBarSTATIC() * hpChange) * 2; SPrectTEMP += (playerStart.getSHPBarSTATIC() * spChange) * 2; print("hprecttempitem: " + HPrectTEMP); print("sprecttempitem: " + SPrectTEMP); playerStart.setPHPBar(HPrectTEMP); playerStart.setSHPBar(SPrectTEMP); if (playerStart.getPHPBar() >= playerStart.getPHPBarSTATIC()) { playerStart.setPHPBar(playerStart.getPHPBarSTATIC()); HPrectTEMP = playerStart.getPHPBar(); HP.transform.localScale = new Vector3(.25f, .45f, 1); playerStart.setPHP(playerStart.getbasePHP()); } else { HP.transform.localScale += new Vector3(hpChange / 2, 0, 0); playerStart.setPHP((int)((HPrectTEMP * playerStart.getbasePHP()) / HPrect)); } if (playerStart.getSHPBar() >= playerStart.getSHPBarSTATIC()) { playerStart.setSHPBar(playerStart.getSHPBarSTATIC()); SPrectTEMP = playerStart.getSHPBar(); SP.transform.localScale = new Vector3(.25f, .4f, 1); playerStart.setSHP(playerStart.getbaseSHP()); } else { SP.transform.localScale += new Vector3(spChange / 2, 0, 0); playerStart.setSHP((int)((SPrectTEMP * playerStart.getbaseSHP()) / SPrect)); } if (playerStart.getSHP() > 0) { battlePlayer.SPOut.enabled = false; } napsack.removeObject(itemName, slotNumber); print("player HP: " + playerStart.getPHP()); print("player SP: " + playerStart.getSHP()); print("testing wait function"); battlePlayer.logText.text += "\n >You used"; battlePlayer.logText.text += "\n " + itemName; battlePlayer.logTextfiller = "\n >You used \n " + itemName; battlePlayer.logTextTracker = 2; battlePlayer.lineCount += 2; // napsack.Slots [slotNumber].GetComponent<Button> ().onClick.AddListener (delegate { // applyValues (); // }); } pauseBool = false; }