// Use this for initialization void Start() { battlePlayer = GameObject.Find("Combat").GetComponent <BattleSystem> (); playerStart = GameObject.Find("PlayerNap").GetComponent <PlayerStart> (); napsack = GameObject.Find("Combat").GetComponent <Napsack> (); HP = GameObject.Find("HP"); SP = GameObject.Find("SP"); HPrectTEMP = battlePlayer.HPrectTEMP; SPrectTEMP = battlePlayer.SPrectTEMP; HPrect = battlePlayer.HPrect; SPrect = battlePlayer.SPrect; napsack = GameObject.Find("Combat").GetComponent <Napsack> (); hpChange = hpChange / playerStart.getbasePHP(); spChange = spChange / playerStart.getbaseSHP(); }
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); }
// Use this for initialization void Start() { playerScript = GameObject.Find("Player").GetComponent <Player> (); playerStart = GameObject.Find("PlayerNap").GetComponent <PlayerStart> (); xButton = GameObject.Find("x"); xButton.SetActive(false); player = GameObject.Find("Player").GetComponent <PlayerMovement> (); location = playerScript.GetComponent <Location> (); Combat = GameObject.Find("Combat"); // // WinSound = GameObject.Find ("WinSound"); // // WinSound.SetActive (true); battleCanvas = GameObject.Find("BattleScreen"); ItemDropImage = GameObject.Find("ItemDropImage"); stats = GameObject.Find("Stats_Icon").GetComponent <Stats> (); ItemSlot1 = GameObject.Find("ItemSlot1").GetComponent <Image> (); napsackImage = GameObject.Find("NapsackImage"); napsackImage.SetActive(true); napsackScript = Combat.GetComponent <Napsack> (); itemDictionary = GameObject.Find("NapsackStart").GetComponent <NapsackStart>().Inventory; bossName = Combat.GetComponent <BattleSystem> ().bossName; randObj = false; if (bossName == "Dream Keeper") { } else if (bossName == "Sleeping Girl") { if (playerScript.getSleepingGirlDefeated() == true) { ItemSlot1.sprite = GameObject.Find("Room Key").GetComponent <Image> ().sprite; napsackScript.testAdd("Room Key"); playerScript.sethasKey(true); addToTXT("Room Key"); } } else if (bossName == "Elliot") { if (playerScript.getMaajiDefeated() && playerScript.getElliotDefeated()) { ItemSlot1.sprite = GameObject.Find("Recorder").GetComponent <Image> ().sprite; napsackScript.testAdd("Recorder"); playerScript.sethasRecorder(true); addToTXT("Recorder"); } else { randObj = true; } } else if (bossName == "Maaji") { if (playerScript.getMaajiDefeated() && playerScript.getElliotDefeated()) { ItemSlot1.sprite = GameObject.Find("Recorder").GetComponent <Image> ().sprite; napsackScript.testAdd("Recorder"); playerScript.sethasRecorder(true); addToTXT("Recorder"); } else { randObj = true; } } else { randObj = true; } if (randObj == true) { string[] tempString = new string[12]; int tempStringLocation = 0; foreach (KeyValuePair <string, int> keyValue in itemDictionary) { string key = keyValue.Key; int value = keyValue.Value; //value == 0 && if (key != "Recorder" && key != "Room Key") { tempString [tempStringLocation] = key; tempStringLocation++; } } int randNum = Random.Range(0, tempStringLocation); print(tempString[randNum]); ItemSlot1.sprite = GameObject.Find(tempString [randNum]).GetComponent <Image>().sprite; napsackScript.testAdd(tempString [randNum]); addToTXT(tempString [randNum]); } Destroy(battleCanvas.GetComponent <BattleSystem> ()); }