private void Start() { _rigidbody2D = GetComponent <Rigidbody2D>(); var health = GetComponentInChildren <HealthBar>(); _damageUtil = new DamageUtil(health); _movementUtil = new MobileMovementUtil(_rigidbody2D, transform, Bullet, MoveSpeed, true); }
// Start is called before the first frame update void Start() { var rb = GetComponent <Rigidbody2D>(); var health = GetComponentInChildren <HealthBar>(); _mobileInputController = GetComponentInChildren <MobileInputController>(); _damageUtil = new DamageUtil(health); _movementUtil = new MobileMovementUtil(rb, transform, Bullet, MoveSpeed, false); // Set Movement Events Jump.onClick.AddListener(() => { _movementUtil.Jump(); }); Shoot.onClick.AddListener(() => { _movementUtil.Shoot(); }); }