// Decrit l'IA d'un enemi // Dictionnaire de skills // ---------------------------------------------------------------------------------------------------------- // !!!!!!!!! SELECT NEXT MOVE !!!!!!!!! // ---------------------------------------------------------------------------------------------------------- public static string Next_Move(Enemy_behavior enemy) { string _name = ""; // THINK, GET A NAME switch (enemy.enemy_name) { case "Boxter": if (Random.Range(0.0f, 1.0f) > 0.9) { _name = "Sk_Large_Attack"; } else { _name = "Sk_Attack"; } break; case "Boxtosor": _name = "Sk_Attack"; break; default: break; } // ASSIGN NEXT MOVE return(_name); }
public static void Attack_monster(float power, string _element) { float _HP_loss = 0; int _t_index = GameObject.Find("Magic_wheel").GetComponent <Magic_wheel_behavior>().target_index; Enemy_behavior target = GameObject.Find("Enemies").GetComponent <Enemy_system>().List_target[_t_index].GetComponent <Enemy_behavior>(); _HP_loss = power; _HP_loss -= target.DEF; if (target.vulnerabilities.Contains(_element)) { _HP_loss += _HP_loss * 0.5f; } if (target.resistances.Contains(_element)) { _HP_loss -= _HP_loss * 0.5f; } target.HP -= _HP_loss; if (target.skill_shield < power) { target.BreakSkill(); } }
// ---------------------------------------------------------------------------------------------------------- // !!!!!!!!! LAUNCH NEXT MOVE !!!!!!!!! // ---------------------------------------------------------------------------------------------------------- public static void LaunchSkill(string skill, Enemy_behavior enemy) { switch (skill) { case "Sk_Attack": Sk_Attack(enemy); break; case "Sk_Large_Attack": Sk_Large_Attack(enemy); break; default: break; } }
private void OnTriggerEnter2D(Collider2D hitInfo) { BossBehavior boss = hitInfo.GetComponent <BossBehavior>(); Enemy_behavior enemy = hitInfo.GetComponent <Enemy_behavior>(); if (enemy != null) { enemy.TakeDamage(damage); } else if (boss != null) { boss.TakeDamage(damage); } Destroy(gameObject); }
private void Awake() { enemyParent = GetComponentInParent <Enemy_behavior>(); }
// ---------------------------------------------------------------------------------------------------------- // !!!!!!!!!!!!!!! SKILLS FONCTIONS !!!!!!!!!!!!!!!!! // ---------------------------------------------------------------------------------------------------------- static void Sk_Attack(Enemy_behavior enemy) { float _coef = 1; Attack_player(enemy.POW * _coef); }