架构大更

This commit is contained in:
SoulliesOfficial
2026-03-20 11:56:50 -04:00
parent e60ef64d01
commit d09b58fd80
3663 changed files with 15232012 additions and 105579 deletions

View File

@@ -0,0 +1,37 @@
using System.Collections.Generic;
using System.Linq;
using Lean.Pool;
using NaughtyAttributes;
using UnityEngine;
using UnityEngine.Serialization;
namespace SLSFramework.General.LeanPoolAssistance
{
public class PooledObject : MonoBehaviour, IPoolable
{
[FormerlySerializedAs("autoDespawn")] [Tooltip("是否在生成后定时自动回收")]
public bool isAutoDespawn = true;
[ShowIf("isAutoDespawn")][Tooltip("自动回收时间")]
public float autoDespawnTime = 1;
private List<IPoolable> children;
public void OnSpawn()
{
children = GetComponentsInChildren<IPoolable>().ToList();
children.Remove(this);
children.ForEach(child => child.OnSpawn());
if (isAutoDespawn)
{
LeanPool.Despawn(gameObject, autoDespawnTime);
}
}
public void OnDespawn()
{
children.ForEach(child => child.OnDespawn());
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: cfc79d04c0439624b848efbb0e52b465