46 lines
2.3 KiB
C#
46 lines
2.3 KiB
C#
using UnityEngine;
|
|
namespace FlappyBird.Gameplay.Pipes
|
|
{
|
|
/// <summary>
|
|
/// ScriptableObject — all configurable pipe-spawning parameters.
|
|
/// Create via: Assets -> Create -> FlappyBird -> Pipe Settings
|
|
/// </summary>
|
|
[CreateAssetMenu(fileName = "PipeSettings", menuName = "FlappyBird/Pipe Settings")]
|
|
public sealed class PipeSettings : ScriptableObject
|
|
{
|
|
[Header("Spawning")]
|
|
[Tooltip("Seconds between each pipe pair spawn.")]
|
|
[SerializeField, Min(0.1f)] private float spawnInterval = 2f;
|
|
[Tooltip("X position at which pipes are spawned (right edge of screen).")]
|
|
[SerializeField] private float spawnX = 10f;
|
|
[Header("Gap")]
|
|
[Tooltip("Vertical size of the gap the bird flies through.")]
|
|
[SerializeField, Min(0.5f)] private float gapSize = 3f;
|
|
[Tooltip("Minimum Y position of the gap centre.")]
|
|
[SerializeField] private float minGapCentreY = -2f;
|
|
[Tooltip("Maximum Y position of the gap centre.")]
|
|
[SerializeField] private float maxGapCentreY = 2f;
|
|
[Tooltip("Half the height of a pipe sprite in world units. " +
|
|
"Used to shift each pipe outward when its pivot is centred. " +
|
|
"Set to 0 if the pivot is already at the tip facing the gap.")]
|
|
[SerializeField, Min(0f)] private float pipeHalfHeight = 3f;
|
|
[Header("Movement")]
|
|
[Tooltip("Horizontal scroll speed (units per second, positive = leftward).")]
|
|
[SerializeField, Min(0f)] private float scrollSpeed = 3f;
|
|
[Tooltip("X position at which a pipe is considered off-screen and returned to pool.")]
|
|
[SerializeField] private float despawnX = -12f;
|
|
[Header("Pool")]
|
|
[Tooltip("Number of pipe pairs pre-allocated in the pool at startup.")]
|
|
[SerializeField, Min(1)] private int initialPoolSize = 5;
|
|
// Accessors
|
|
public float SpawnInterval => spawnInterval;
|
|
public float SpawnX => spawnX;
|
|
public float GapSize => gapSize;
|
|
public float MinGapCentreY => minGapCentreY;
|
|
public float MaxGapCentreY => maxGapCentreY;
|
|
public float PipeHalfHeight => pipeHalfHeight;
|
|
public float ScrollSpeed => scrollSpeed;
|
|
public float DespawnX => despawnX;
|
|
public int InitialPoolSize => initialPoolSize;
|
|
}
|
|
} |