protected void ApplyBuffsToUnit(Unit unit) { foreach (GameObject buffPrefab in placeableBuffs) { AbstractBuff newBuff = Instantiate(buffPrefab).GetComponent <AbstractBuff>(); newBuff.ApplyOnTarget(unit); } }
protected void ApplyBuffsToUnit(List <GameObject> buffs, Unit target) { foreach (GameObject buffPrefab in buffs) { var buffObject = Instantiate(buffPrefab, target.transform); var buffObjectBuffs = buffObject.GetComponents <AbstractBuff>(); if (buffObjectBuffs.Length != 1) { Debug.LogError("Wrong count of buffs on buff object: " + buffObject.name + ". Number should be 1, is: " + buffObjectBuffs.Length); } AbstractBuff newBuff = buffObjectBuffs[0]; newBuff.ApplyOnTarget(target, this); } }