public void DoDamage(GameObject sandBag, float damage, float random, bool topple) { GameObject uidmg = GameObject.Instantiate(damageUI, sandBag.transform.position, Quaternion.identity); uidmg.GetComponent <TextMesh>().text = "" + Mathf.RoundToInt(damage * random * enemies[0].GetComponent <BattleEnemyAI>().damageMultipier); if (sandBag.tag == "Enemy") { enemyHealth[0] -= Mathf.RoundToInt(damage * random * enemies[0].GetComponent <BattleEnemyAI>().damageMultipier); Instantiate(slashEffect, Camera.main.transform); if (topple == true) { BattleEnemyAI ai = sandBag.GetComponent <BattleEnemyAI>(); if (ai.curState == BattleEnemyAI.State.Think) {//think ai.curState = BattleEnemyAI.State.Topple; } } } else if (sandBag.tag == "Player") { for (int i = 0; i < players.Count; i++) { if (players[i] == sandBag) { playerHealth[i] -= Mathf.RoundToInt(damage * random); players[i].transform.GetChild(0).GetComponent <Animator>().Play("Idle", 0, 0); players[i].transform.GetChild(0).GetComponent <Animator>().SetFloat("hit", 0.5f); } } } }
public BattleEnemyGroup(Summary1 s1) { set1(s1); for (int t1 = 0; t1 < max(); t1++) { battle_enemy[t1] = new BattleEnemy(s1, t1); } { image_save_enemy = new ImageSaveEnemy(s1); image_save_enemy.init1(); } battle_enemy_appear_control = new BattleEnemyAppearControl(s1); battle_enemy_ai = new BattleEnemyAI(s1); }