This commit is contained in:
JA
2026-06-27 03:36:46 +08:00
parent aec4e97d27
commit 7a8d4a5d83
1215 changed files with 48271 additions and 146052 deletions

View File

@@ -1,16 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ManagersMode : MonoBehaviour
{
private static PollManager _pool;
public static PollManager Poll
{
get { return _pool; }
}
private void Awake()
{
_pool = this.gameObject.AddComponent<PollManager>();
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: afea4f43157c8f541a7fcde752e70440
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,77 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PollManager : MonoBehaviour
{
Transform m_PollParent;
//对象池字典
Dictionary<string, PollBase> m_Polls = new Dictionary<string, PollBase>();
private void Awake()
{
m_PollParent = this.transform.parent.Find("Poll");
}
/// <summary>
/// 创建对象池
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pollName"></param>
/// <param name="releaseTime"></param>
private void CreatePoll<T>(string pollName, float releaseTime)
where T : PollBase
{
if (!m_Polls.TryGetValue(pollName, out PollBase poll))
{
GameObject go = new GameObject();
go.name = pollName;
go.transform.SetParent(m_PollParent);
poll = go.AddComponent<T>();
poll.Init(releaseTime);
m_Polls.Add(pollName, poll);
}
}
/// <summary>
/// 创建物体对象池
/// </summary>
/// <param name="pollName"></param>
/// <param name="releaseTime"></param>
public void CreateGameObjectPoll(string pollName, float releaseTime)
{
CreatePoll<GameObjectPoll>(pollName, releaseTime);
}
/// <summary>
/// 取出对象
/// </summary>
/// <param name="pollName"></param>
/// <param name="asseteName"></param>
/// <returns></returns>
public Object Spwan(string pollName, string asseteName)
{
if (m_Polls.TryGetValue(pollName, out PollBase poll))
{
return poll.Spwan(asseteName);
}
return null;
}
/// <summary>
/// 回收对象
/// </summary>
/// <param name="pollName"></param>
/// <param name="asseteName"></param>
/// <returns></returns>
public void UnSpwan(string pollName, string asseteName, Object assete)
{
if (m_Polls.TryGetValue(pollName, out PollBase poll))
{
poll.UnSpwan(asseteName, assete);
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: ea449011b5381b246bcdfef0efa1523c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: