Edited
Добавлен таймер, конфиг и публичный метод SpawnItems() CooldownRemaining - оставшееся время до спавна float CooldownSecondsRemaining - оставшееся время до спавна int
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(
|
||||
fileName = "ItemPipeConfig",
|
||||
menuName = "Fort Bo/Pipe Junk/Item Pipe Config")]
|
||||
public sealed class ItemPipeConfig : ScriptableObject
|
||||
{
|
||||
[Serializable]
|
||||
public sealed class GuaranteedItem
|
||||
{
|
||||
public GameObject prefab;
|
||||
|
||||
[Min(1)]
|
||||
public int amount = 1;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class RandomItem
|
||||
{
|
||||
public GameObject prefab;
|
||||
|
||||
[Min(0f)]
|
||||
public float weight = 1f;
|
||||
}
|
||||
|
||||
[Header("Timing")]
|
||||
[SerializeField, Min(0.05f)] private float spawnInterval = 0.5f;
|
||||
[SerializeField, Min(0f)] private float spawnCooldown = 10f;
|
||||
|
||||
[Header("Instant velocity change")]
|
||||
[SerializeField] private Vector3 localVelocityChange = Vector3.forward * 4.5f;
|
||||
|
||||
[Header("Guaranteed items")]
|
||||
[SerializeField] private List<GuaranteedItem> guaranteedItems = new();
|
||||
|
||||
[Header("Random items")]
|
||||
[SerializeField, Min(0)] private int randomItemCount = 5;
|
||||
[SerializeField] private List<RandomItem> randomItems = new();
|
||||
|
||||
[Header("Spawn position randomization")]
|
||||
[SerializeField, Min(0f)] private float randomSpawnX = 0.2f;
|
||||
[SerializeField, Min(0f)] private float randomSpawnZ = 0.2f;
|
||||
|
||||
public float SpawnInterval => spawnInterval;
|
||||
public float SpawnCooldown => spawnCooldown;
|
||||
public Vector3 LocalVelocityChange => localVelocityChange;
|
||||
public IReadOnlyList<GuaranteedItem> GuaranteedItems => guaranteedItems;
|
||||
public int RandomItemCount => randomItemCount;
|
||||
public IReadOnlyList<RandomItem> RandomItems => randomItems;
|
||||
public float RandomSpawnX => randomSpawnX;
|
||||
public float RandomSpawnZ => randomSpawnZ;
|
||||
}
|
||||
Reference in New Issue
Block a user