IEnumerator startEnemyTurn() { //Random rnd = new Random(); if (health <= 0) { //Show defeat text General.text = defeat; InfoTransition.setInBattle(0); UnityEngine.SceneManagement.SceneManager.LoadScene(InfoTransition.getSceneName()); Player playerScript = player.GetComponent <Player>(); playerScript.leaveBattle(); float[] position = InfoTransition.getPosition(); playerScript.transform.position = new Vector3(position[0], position[1], 0); // playerScript.transform.position.y = position[1]; } else { int pickMove = Random.Range(0, 3); Debug.Log("enemy Turn"); Debug.Log(pickMove); Debug.Log(enemyPT [pickMove]); General.text = enemyPT [pickMove]; Text indicator = GameObject.Find("Damage Indicator").GetComponent <Text> (); indicator.text = enemyD [pickMove].ToString(); indicator.enabled = true; yield return(new WaitForSeconds(1)); indicator.enabled = false; while (!Input.GetButtonDown("Submit")) { Debug.Log("pp"); yield return(null); } General.enabled = false; Action1.enabled = true; Action2.enabled = true; Action3.enabled = true; Action4.enabled = true; ActionSet.SetActive(true); } }
// Use this for initialization void Start() { InfoTransition.setInBattle(1); internalName = InfoTransition.getEnemyName(); //Figure out how to send this value Debug.Log("give me muskrat or give me death"); SpriteRenderer rndr = GetComponent <SpriteRenderer>(); enemyDoc = XDocument.Load("Assets/Resources/data/enemy-data.xml"); Debug.Log(enemyDoc); items = enemyDoc.Descendants("enemy").Elements(); Debug.Log(items); foreach (var item in items) { Debug.Log("loopy"); Debug.Log(item.Parent.Attribute("internalname").Value.ToString()); Debug.Log(internalName); if (item.Parent.Attribute("internalname").Value.ToString() == internalName) { health = int.Parse(item.Parent.Element("health").Value); Debug.Log("Are we actually entering into the loop or is this a problem of name check?"); name = item.Parent.Element("Name").Value; introText = item.Parent.Element("Intro-Text").Value.Trim(); spriteName = item.Parent.Element("sprite-info").Value.Trim(); Debug.Log("introText"); Debug.Log(spriteName); actions[0] = item.Parent.Element("A1Text").Value.Trim(); actions[1] = item.Parent.Element("A2Text").Value.Trim(); actions[2] = item.Parent.Element("A3Text").Value.Trim(); actions[3] = item.Parent.Element("A4Text").Value.Trim(); performanceText[0] = item.Parent.Element("A1Performance-Text").Value.Trim(); performanceText[1] = item.Parent.Element("A2Performance-Text").Value.Trim(); performanceText[2] = item.Parent.Element("A3Performance-Text").Value.Trim(); performanceText[3] = item.Parent.Element("A4Performance-Text").Value.Trim(); reactionText[0] = item.Parent.Element("A1Reaction-Text").Value.Trim(); reactionText[1] = item.Parent.Element("A2Reaction-Text").Value.Trim(); reactionText[2] = item.Parent.Element("A3Reaction-Text").Value.Trim(); reactionText[3] = item.Parent.Element("A4Reaction-Text").Value.Trim(); damage[0] = int.Parse(item.Parent.Element("A1Damage").Value); damage[1] = int.Parse(item.Parent.Element("A2Damage").Value); damage[2] = int.Parse(item.Parent.Element("A3Damage").Value); damage[3] = int.Parse(item.Parent.Element("A4Damage").Value); effects[0] = int.Parse(item.Parent.Element("A1Effect").Value); effects[1] = int.Parse(item.Parent.Element("A2Effect").Value); effects[2] = int.Parse(item.Parent.Element("A3Effect").Value); effects[3] = int.Parse(item.Parent.Element("A4Effect").Value); enemyPT[0] = item.Parent.Element("EA1PT").Value.Trim(); enemyPT[1] = item.Parent.Element("EA2PT").Value.Trim(); enemyPT[2] = item.Parent.Element("EA3PT").Value.Trim(); enemyPT[3] = item.Parent.Element("EA4PT").Value.Trim(); enemyD[0] = int.Parse(item.Parent.Element("EA1D").Value); enemyD[1] = int.Parse(item.Parent.Element("EA2D").Value); enemyD[2] = int.Parse(item.Parent.Element("EA3D").Value); enemyD[3] = int.Parse(item.Parent.Element("EA4D").Value); defeat = item.Parent.Element("DText").Value.Trim(); //Debug.Log ("R we getting here prquel\t"); } } Debug.Log("R we getting here"); rndr.sprite = Resources.Load <Sprite> (spriteName); //"Assets/Artwork/sprites/EnemySprites/ElonMuskrat"; Debug.Log(introText); General.text = introText; Action1.text = actions [0]; Action2.text = actions [1]; Action3.text = actions [2]; Action4.text = actions [3]; Debug.Log(actions [0]); Debug.Log(actions [1]); Debug.Log(actions [2]); Debug.Log(actions [3]); btn1.onClick.AddListener(turn1); btn2.onClick.AddListener(turn2); btn3.onClick.AddListener(turn3); btn4.onClick.AddListener(turn4); Debug.Log("WTF"); //rndr.color = new Color(200,0,0); }