50 lines
2.2 KiB
C#
50 lines
2.2 KiB
C#
using UnityEngine;
|
|
|
|
namespace FlappyBird.Gameplay.Bird
|
|
{
|
|
/// <summary>
|
|
/// ScriptableObject that holds all configurable bird physics parameters.
|
|
/// Create via: Assets → Create → FlappyBird → Bird Settings
|
|
/// </summary>
|
|
[CreateAssetMenu(fileName = "BirdSettings", menuName = "FlappyBird/Bird Settings")]
|
|
public sealed class BirdSettings : ScriptableObject
|
|
{
|
|
[Header("Jump")]
|
|
[Tooltip("Upward force applied on each tap (Impulse mode).")]
|
|
[SerializeField, Min(0f)] private float jumpForce = 5f;
|
|
|
|
[Header("Rotation")]
|
|
[Tooltip("Maximum upward tilt angle in degrees (positive = nose up).")]
|
|
[SerializeField] private float maxUpRotation = 30f;
|
|
|
|
[Tooltip("Maximum downward tilt angle in degrees (positive = nose down).")]
|
|
[SerializeField] private float maxDownRotation = -90f;
|
|
|
|
[Tooltip("Velocity at which the bird reaches full upward rotation.")]
|
|
[SerializeField] private float rotationUpVelocity = 5f;
|
|
|
|
[Tooltip("Velocity at which the bird reaches full downward rotation.")]
|
|
[SerializeField] private float rotationDownVelocity = -10f;
|
|
|
|
[Tooltip("Speed at which the rotation visually lerps to the target angle.")]
|
|
[SerializeField, Min(0f)] private float rotationSpeed = 10f;
|
|
|
|
[Header("Boundaries")]
|
|
[Tooltip("Y position of the ceiling. Bird dies if it rises above this value.")]
|
|
[SerializeField] private float maxY = 5f;
|
|
|
|
[Tooltip("Y position of the ground. Bird dies if it falls below this value.")]
|
|
[SerializeField] private float minY = -5f;
|
|
|
|
// ── Public read-only accessors ──────────────────────────────────────
|
|
public float JumpForce => jumpForce;
|
|
public float MaxUpRotation => maxUpRotation;
|
|
public float MaxDownRotation => maxDownRotation;
|
|
public float RotationUpVelocity => rotationUpVelocity;
|
|
public float RotationDownVelocity => rotationDownVelocity;
|
|
public float RotationSpeed => rotationSpeed;
|
|
public float MaxY => maxY;
|
|
public float MinY => minY;
|
|
}
|
|
}
|