public void Battle1() { BattleExit BatExit = TextBox.GetComponent <BattleExit> (); Animator TxtAnim = AtkDamage.GetComponent <Animator> (); HealthBar_Enemy HBE = EnemyHealthBar.GetComponent <HealthBar_Enemy> (); BatExit.InBattle = true; TextBox.enabled = true; //AtkDamage.enabled = false; HBEH.enabled = false; HBEHDamage.enabled = false; //TxtAnim.enabled = false; }
// Update is called once per frame void OnEnable() { SpriteRenderer Spr = Heart.GetComponent <SpriteRenderer> (); HealthBar_Enemy HBE = EnemyHealthBar.GetComponent <HealthBar_Enemy> (); Battle Bat = TextBox.GetComponent <Battle> (); TextBoxAnim.Play("TextBox1"); Animator BarAnim = Bar.GetComponent <Animator> (); Bat.Battle1(); FightBg.Play("BattleBg"); Bar.enabled = false; Bar.transform.position = start.position; BarAnim.enabled = false; Heart.SetActive(true); Spr.enabled = true; Heart.transform.position = PlayerSpawn.position; }
// Update is called once per frame public void OnEnable() { HeartMove Heart = HeartMov.GetComponent <HeartMove> (); HealthBar_Enemy HBarE = HBarEn.GetComponent <HealthBar_Enemy> (); Animator anim = Marciano.GetComponent <Animator>(); BattleFight BF = AtkDamage.GetComponent <BattleFight> (); Atk.SetBool("IsAttaking", false); Hit.Play(); AtkDamage.enabled = true; AtkDamageAnim.enabled = true; AtkDamageAnim.Play("AtkDamageAnim"); HealthBarHit.enabled = true; HealthBarHitDamaged.enabled = true; anim.Play("Quake"); anim.SetBool("QuakeEna", true); HBarE.EHealth -= Damage; AtkDamage.text = Damage.ToString(); //BF.enabled = false; }
public void TalkBoxSc() { GameObject item = GameObject.Find("ItemMove"); Item IScript = item.GetComponent <Item> (); TalkBox Talk = TextBox.GetComponent <TalkBox> (); UITextTypeWriterTalkBox TypeTalk = TalkBox.GetComponent <UITextTypeWriterTalkBox> (); BattleExit BatExit = TextBox.GetComponent <BattleExit> (); Attacks Attack = Attacks.GetComponent <Attacks> (); HealthBar_Enemy HBE = HealthBar_Enemy_GameObject.GetComponent <HealthBar_Enemy> (); if (Talk.Talking) { if (TalkBoxFinished) { //Talk.StopAllCoroutines (); Talk.StartCoroutine("TalkProgress", 4); if (Input.GetAxisRaw("Submit") == 1) { if (IScript.NOfClicks > 1) { Talk.TalkingProgress = false; Talk.TalkBoxText.enabled = false; Talk.TalkBoxImage.enabled = false; TypeTalk.StopAllCoroutines(); BatExit.InBattle = true; if (HBE.Betrayed == false && HBE.Dead == false) { Talk.Talking = false; if (Attack.AttackNumber == 0) //AtkNumber in Attack GameObject { BatExit.StartCoroutine("BattleDuration", 4); Attack.ChoseAttack(); } else if (Attack.AttackNumber == 1) { BatExit.StartCoroutine("BattleDuration", 6); Attack.ChoseAttack(); } else if (Attack.AttackNumber == 2) { BatExit.StartCoroutine("BattleDuration", 1000000); Attack.ChoseAttack(); } } else { if (Spareable == false) { FadeToBlackAnim.Play("FadeToBlack"); SceneManager.LoadScene(3); } } } } if (Talk.TalkingProgress) { Talk.TalkingProgress = false; Talk.TalkBoxText.enabled = false; Talk.TalkBoxImage.enabled = false; TypeTalk.StopAllCoroutines(); BatExit.InBattle = true; if (HBE.Betrayed == false && HBE.Dead == false) { Talk.Talking = false; if (Attack.AttackNumber == 0) //AtkNumber in Attack GameObject { BatExit.StartCoroutine("BattleDuration", 4); } else if (Attack.AttackNumber == 1) { BatExit.StartCoroutine("BattleDuration", 6); } else if (Attack.AttackNumber == 2) { BatExit.StartCoroutine("BattleDuration", 1000000); } } else { if (Spareable == false) { FadeToBlackAnim.Play("FadeToBlack"); SceneManager.LoadScene(3); } } } } } // if(Talk.Talking){ // if(TalkBoxFinished){ // Talk.StartCoroutine ("TalkProgress"); // if() // // // } // // } }
public void SpawnLaser() { BattleExit BE = TextBox.GetComponent <BattleExit> (); SpriteRenderer LG = LaserGreen.GetComponent <SpriteRenderer> (); HealthBar_Enemy HB = EnemyH.GetComponent <HealthBar_Enemy> (); if (BE.InBattle) { if (LaserSpawn) { LG.enabled = true; Vector3 LaserPosition = new Vector3(Random.Range(spawnLU.position.x, spawnRU.position.x), spawnLU.position.y, 0); LaserSpawn = false; GameObject LaserClone = (GameObject)Instantiate(LaserGreen, LaserPosition, Quaternion.identity); //Rigidbody2D LCRB = LaserClone.AddComponent <Rigidbody2D>()as Rigidbody2D; //LCRB.AddForce (LaserForce); LaserClone.transform.SetParent(Attack1Parent); Lasers.Add(LaserClone); for (int i = 0; i < Lasers.Count; i++) { LaserGreen L = Lasers [i].GetComponent <LaserGreen> (); //LaserClone.transform.SetParent (LaserGreenParent); LaserClone.name = "Laser " + Lasers.IndexOf(LaserClone); LaserClone.tag = "LaserClone"; L.Tm = 0; } // GameObject LaserC=GameObject.f } } int n = Lasers.Count; for (int i = 0; i < n; i++) { if (Lasers.Count != 0) { Vector3 LaserPosition = new Vector3(Random.Range(spawnLU.position.x, spawnRU.position.x), Random.Range(spawnLU.position.y, spawnRU.position.y), 0); SpriteRenderer S = Lasers[i].GetComponent <SpriteRenderer> (); LaserGreen L = Lasers [i].GetComponent <LaserGreen> (); if (HB.CurrentHealth != 0) { speed = (1 / (HB.CurrentHealth + 1)); } Lasers [i].transform.position += LaserForce * speed * Time.deltaTime; if (Lasers [i].transform.position.y < spawnLD.position.y) { Lasers [i].transform.position = LaserPosition; S.enabled = false; } else if (Lasers [i].transform.position.y >= spawnLU.position.y) { S.enabled = false; } else if (Lasers [i].transform.position.y < spawnLU.position.y) { S.enabled = true; } if (CancelSpawn) { CancelSpawn = false; CancelSpawn = true; Destroy(Lasers [0]); Lasers.Remove(Lasers [0]); Debug.Log(Lasers.Count); } } } }