fix HammerThrower
This commit is contained in:
@@ -47,6 +47,7 @@ public class PlayerController : Character
|
||||
|
||||
Vector2 move = _inputManager.Movement;
|
||||
MoveTo(move.x, isAllowVertical ? move.y : 0);
|
||||
_hammerThrower.SetFacingDirection(_facingRight);
|
||||
}
|
||||
|
||||
private void OnFireButtonPressed()
|
||||
|
||||
@@ -27,15 +27,18 @@ public class HammerThrower : MonoBehaviour
|
||||
|
||||
_currentHammer = Instantiate(_hammerPrefab, _spawnPoint.position, _spawnPoint.rotation);
|
||||
|
||||
float direction = _facingRight ? 1f : -1f;
|
||||
//float direction = _facingRight ? 1f : -1f;
|
||||
|
||||
var rb = _currentHammer.GetComponent<Rigidbody2D>();
|
||||
rb.linearVelocity = new Vector2(direction * _throwSpeed, 0);
|
||||
//var rb = _currentHammer.GetComponent<Rigidbody2D>();
|
||||
//rb.linearVelocity = new Vector2(direction * _throwSpeed, 0);
|
||||
|
||||
// Flip hammer visually
|
||||
var scale = _currentHammer.transform.localScale;
|
||||
scale.x = Mathf.Abs(scale.x) * direction;
|
||||
_currentHammer.transform.localScale = scale;
|
||||
//// Flip hammer visually
|
||||
//var scale = _currentHammer.transform.localScale;
|
||||
//scale.x = Mathf.Abs(scale.x) * direction;
|
||||
//_currentHammer.transform.localScale = scale;
|
||||
|
||||
_currentHammer.transform.localScale = new Vector2(_currentHammer.transform.localScale.x * (_facingRight ? 1 : -1), _currentHammer.transform.localScale.y);
|
||||
_currentHammer.GetComponent<Rigidbody2D>().linearVelocity = new Vector2(gameObject.transform.localScale.x * _throwSpeed, 0);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
||||
Reference in New Issue
Block a user