public void Rotate(ObjectSelfDirection direction, float speedMultiplier) { if (!isAllowed) { return; } Vector3 dir = GetRotationDirection(direction); float speed = rotationSpeed * rotationAngles * Time.deltaTime; trans.Rotate(dir * speed * speedMultiplier); }
public void Rotate(float rotationInput) { float input = Mathf.Abs(rotationInput); ObjectSelfDirection direction = ObjectSelfDirection.RIGHT; if (rotationInput < 0.1f) { direction = ObjectSelfDirection.LEFT; } rotationCtrl.Rotate(direction, input); }
private Vector3 GetRotationDirection(ObjectSelfDirection direction) { switch (direction) { case ObjectSelfDirection.RIGHT: return(Vector3.up); case ObjectSelfDirection.LEFT: return(Vector3.down); case ObjectSelfDirection.UP: return(trans.right); case ObjectSelfDirection.DOWN: return(trans.right * -1); default: return(Vector3.zero); } }