public event Action Tested;
private void Start()
{
Tested += Test;
var delegates = Tested.GetInvocationList();
Debug.Log(delegates[0].Method);
}
void Flip()
{
facingRight = !facingRight;
Vector3 Scaler = transform.localScale;
Scaler.x *= -1;
transform.localScale = Scaler;
}
private SpriteRenderer _spriteRenderer;
private void Start()
{
_spriteRenderer = GetComponent<SpriteRenderer>();
}
public void Flip(float direction)
{
_spriteRenderer.flipY = direction < 0;// Если direction < 0, то оружие смотрит налево
}
[SerializeField] private gun _gun;
...
...
...
private void Flip()
{
...
...
_gun.Flip(moveInput.x);
...
}
public class Game : MonoBehaviour
{
private SomeModule _someModule;
private SomeModule2 _someModule2;
private void Awake()
{
_someModule = new SomeModule();
_someModule2 = new SomeModule2(_someModule);
}
}
public class SomeModule2
{
private SomeModule _someDependency;
public SomeModule2(SomeModule _dependency)
{
_someDependency = _dependency;
}
}