1
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using BITKit;
|
||||
using UnityEngine.Events;
|
||||
@@ -19,7 +20,8 @@ namespace BITKit
|
||||
private static VFXService sinleton;
|
||||
public VFX[] vfxs;
|
||||
private readonly Dictionary<string, UnityPool<Transform>> pools = new();
|
||||
|
||||
|
||||
[SerializeField] private bool debug;
|
||||
[SerializeField] private Optional<int> defaultCapacity;
|
||||
private void Awake()
|
||||
{
|
||||
@@ -37,8 +39,11 @@ namespace BITKit
|
||||
}
|
||||
public Transform Spawn(Location location, params string[] keyWords)
|
||||
{
|
||||
StringBuilder reportBuilder = debug ? new() : null;
|
||||
reportBuilder?.AppendLine(JsonHelper.Get(keyWords));
|
||||
if (TryMatch(out var prefab, keyWords))
|
||||
{
|
||||
|
||||
var pool = pools.Get(prefab.name);
|
||||
if (defaultCapacity.Allow)
|
||||
pool.DefaultCapacity = defaultCapacity.Value;
|
||||
@@ -46,6 +51,12 @@ namespace BITKit
|
||||
instance.SetPositionAndRotation(location, location);
|
||||
if (location.forward.sqrMagnitude is not 0)
|
||||
instance.forward = location.forward;
|
||||
|
||||
reportBuilder?.AppendLine($"生成:{prefab.name}");
|
||||
|
||||
if(reportBuilder is not null)
|
||||
BIT4Log.Log<VFXService>(reportBuilder.ToString());
|
||||
|
||||
return instance;
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user