// Use this for initialization public void Start() { List <EnemyUnit> exploded = new List <EnemyUnit>(); List <Unit> list = SlimePool.GetActiveSlimeList(); for (int i = 0; i < list.Count; i++) { if (list[i].element == Element.Fire) { Collider[] col = Physics.OverlapBox(list[i].transform.position, new Vector3(range / 2, 1, 1)); for (int enemyIndex = 0; enemyIndex < col.Length; enemyIndex++) { EnemyUnit e = col[enemyIndex].GetComponent <EnemyUnit>(); if (e != null) { if (allowMultihit) { exploded.Add(e); } else { if (!exploded.Contains(e)) { exploded.Add(e); } } } } } } }
public void Heal(float totalHeal) { List <Unit> list = SlimePool.GetActiveSlimeList(); for (int i = 0; i < list.Count; i++) { list[i].currentHp = (list[i].currentHp + totalHeal > list[i].maxHp)? list[i].maxHp : list[i].currentHp + totalHeal; } }
public void DestroyAllslimeelement() { List <Unit> list = SlimePool.GetActiveSlimeList(); for (int i = 0; i < list.Count; i++) { if (list[i].element == slimeElementtodestroy) { list[i]._Die(); } } Heal(); }
public void Start() { List <Unit> sList = SlimePool.GetActiveSlimeList(); List <EnemyUnit> eList = EnemyPool.GetActiveEnemyList(); for (int i = 0; i < sList.Count; i++) { if (Random.Range(0, 2) < 1) { sList[i].TakeDamage(sList[i].currentHp + 1); } } for (int j = 0; j < eList.Count; j++) { if (Random.Range(0, 2) < 1) { eList[j].TakeDamage(eList[j].currentHp + 1); } } }