protected override Vector2 LimitMovePosition(Vector2 _position) { if (InvalidNextPosition(_position)) { CurrentGrid.SetCurrentUnitObject(this); return(transform.position); } CurrentGrid.SetCurrentUnitObject(null); return(new Vector2(Mathf.Clamp(_position.x, -(GameManager.ScreenBounds.x + Width), GameManager.ScreenBounds.x - Width), Mathf.Clamp(_position.y, -(GameManager.ScreenBounds.y + Height), GameManager.LimitScreenHeight))); }
protected override Vector2 LimitMovePosition(Vector2 _position) { if (InvalidNextPosition(_position)) { CurrentGrid.SetCurrentUnitObject(this); if (_GoUp) { GoUp(); } else { GoDown(); } ToggleDirection(); return(transform.position); } CurrentGrid.SetCurrentUnitObject(null); return(_position); }