public void BreakSkill() { ATB = 0; string _next_move = Enemy_IA.Next_Move(this); charging_skill = _next_move; float _next_move_duration = Enemy_IA.Next_Move_duration(_next_move); ATB_max = _next_move_duration; skill_shield = Enemy_IA.Next_Move_shield(_next_move); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "DamagePlayer") { Enemy_IA IA = other.transform.root.GetComponent <Enemy_IA>(); float Damage = IA.Damage; Debug.Log("Hit"); if (Health - Damage <= 0) { Debug.Log("Kill"); SceneManager.LoadSceneAsync(0); } else { Health -= Damage; } HealthSlider.value = Health; systemPR.Play(); } }
void Update() { // CHARGE SYSTEM ATB += Time.deltaTime; if (ATB >= ATB_max) { Enemy_IA.LaunchSkill(charging_skill, this); ATB = 0; string _next_move = Enemy_IA.Next_Move(this); charging_skill = _next_move; float _next_move_duration = Enemy_IA.Next_Move_duration(_next_move); ATB_max = _next_move_duration; skill_shield = Enemy_IA.Next_Move_shield(_next_move); } //UPDATE VISUAL ATB_gauge.GetComponent <RectTransform>().sizeDelta = new Vector2(120 * ATB / ATB_max, 15); if (ATB >= ATB_max) { ATB_gauge.GetComponent <RectTransform>().sizeDelta = new Vector2(120, 15); } HP_gauge.GetComponent <RectTransform>().sizeDelta = new Vector2(120 * HP / HP_max, 20); if (HP >= HP_max) { HP_gauge.GetComponent <RectTransform>().sizeDelta = new Vector2(120, 20); } if (Target_index == GameObject.Find("Magic_wheel").GetComponent <Magic_wheel_behavior>().target_index) { target_indicator.SetActive(true); } else { target_indicator.SetActive(false); } //DEATH if (this.HP <= 0) { Magic_wheel_behavior player_magic = GameObject.Find("Magic_wheel").GetComponent <Magic_wheel_behavior>(); int player_target = player_magic.target_index; if (player_target == Target_index) { if (player_target - 1 < 0) { player_magic.target_index = 0; } else { player_target -= 1; } player_magic.target_index = player_target; } enemy_system.List_target.RemoveAt(Target_index); enemy_system.AssignTargetIndex(); Destroy(Target_UI); Destroy(this.gameObject); } }