下記戻り値ありのメソッドを渡す
public CharacterBase GetTargetChara(CharacterBase characterBase)
{
CharaAttribute charaAttribute = characterBase.charaAttribute;
if (charaAttribute == CharaAttribute.Player || charaAttribute == CharaAttribute.Summon)
return enemyControllers.GetAtRandom();
if (charaAttribute == CharaAttribute.Enemy)
return moveControllers.GetAtRandom();
return new CharacterBase();
}
Funcでメソッド準備
public void BattleInitialized(CharaAttribute _charaAttribute, Func<CharacterBase, CharacterBase> _getTaget)
{
charaAttribute = _charaAttribute;
getTaget = _getTaget;
targetController = getTaget(this);
}
こんな感じで使う
foreach (var Value in moveControllers)
{
Value.BattleInitialized(CharaAttribute.Player, GetTargetChara);
}
コメントを残す