我有一个Monobehaviour对象BaseUnit可以有一些状态,所以我创建了 州工厂,就像在Zenject示例项目中一样,但我的问题是当我为这个BaseUnit创建这个状态工厂时如何传递这个BaseUnit的引用?
public class UnitStateFactory
{
readonly UnitMoveState.Factory _moveState;
readonly UnitActiveState.Factory _activeState;
readonly BaseUnit _unit;
public UnitStateFactory(
UnitMoveState.Factory mS,
UnitActiveState.Factory aS,
BaseUnit unit
)
{
_moveState = mS;
_activeState = aS;
_unit = unit;
}
}