提交 64a5aa72 编写于 作者: 魔术师Dix's avatar 魔术师Dix

添加粒子特效组的配置;

上级 94940a2f
......@@ -44,7 +44,7 @@ namespace TouchFish.Omphalia
/// 这个方法性能极差!只能在编辑器下使用!
/// </summary>
/// <param name="particle"></param>
public void AutoSetValue(Particle particle)
public void SetValueByUnityParticle(Particle particle)
{
m_Position = particle.GetPropertyValue<Vector3>("m_Position");
m_Velocity = particle.GetPropertyValue<Vector3>("m_Velocity");
......
/*
*Copyright(C) 2023 by TouchFinsh All rights reserved.
*Unity版本:2020.3.43f1c1
*作者:Chief
*创建日期: 2023-04-19
*版本: 0.1
*/
using System;
using System.Collections.Generic;
using UnityEngine;
using static UnityEngine.ParticleSystem;
namespace TouchFish.Omphalia
{
/// <summary>
/// 粒子特效 分组配置
/// </summary>
[Serializable]
public class ParticleGroupConfig
{
/// <summary>
/// 所有的子物件例子特效配置
/// </summary>
public ParticleConfig[] Particles;
/// <summary>
/// 通过预制来生成
/// </summary>
/// <param name="SourceParticle"></param>
public void GenerateByGameObject(GameObject SourceParticle)
{
ParticleSystem[] particles = SourceParticle.GetComponentsInChildren<ParticleSystem>();
int length = particles.Length;
Particle[] tempParticle = new Particle[1];
List<ParticleConfig> L = new List<ParticleConfig>(length);
for (int i = 0; i < length; i++)
{
var particle = particles[i];
particle.Simulate(0.01f);
particle.GetParticles(tempParticle);
foreach (var subP in tempParticle)
{
ParticleConfig param = new ParticleConfig();
param.SetValueByUnityParticle(subP);
L.Add(param);
}
}
Particles = L.ToArray();
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 20cffb06a946b014fa8f29b4272a56db
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册