Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
摸鱼小分队
Unity 粒子特效方案:竹铃芝
提交
73a4b170
Unity 粒子特效方案:竹铃芝
项目概览
摸鱼小分队
/
Unity 粒子特效方案:竹铃芝
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Unity 粒子特效方案:竹铃芝
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
73a4b170
编写于
4月 20, 2023
作者:
魔术师Dix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加本地测试用例,生成粒子以调试;
上级
46ea5106
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
330 addition
and
16 deletion
+330
-16
Assets/GameRes/Config/OmphaliaConfig_Local.asset
Assets/GameRes/Config/OmphaliaConfig_Local.asset
+147
-2
Assets/GameRes/Effects/prefabs/FX_hudun.prefab
Assets/GameRes/Effects/prefabs/FX_hudun.prefab
+1
-1
Assets/Local/OmphaliaConfig_Local.cs
Assets/Local/OmphaliaConfig_Local.cs
+2
-2
Assets/Local/OmphaliaLocalRunner.cs
Assets/Local/OmphaliaLocalRunner.cs
+11
-1
Assets/Local/OmphaliaLocalSpawner.cs
Assets/Local/OmphaliaLocalSpawner.cs
+31
-0
Assets/Local/OmphaliaLocalSpawner.cs.meta
Assets/Local/OmphaliaLocalSpawner.cs.meta
+11
-0
Assets/Scenes/SampleScene.unity
Assets/Scenes/SampleScene.unity
+45
-1
Assets/TouchFish.Omphalia/Core/Config/OmphaliaConfig.cs
Assets/TouchFish.Omphalia/Core/Config/OmphaliaConfig.cs
+1
-1
Assets/TouchFish.Omphalia/Core/Config/ParticleConfig.cs
Assets/TouchFish.Omphalia/Core/Config/ParticleConfig.cs
+1
-1
Assets/TouchFish.Omphalia/Core/OmphaliaParticleSystem.cs
Assets/TouchFish.Omphalia/Core/OmphaliaParticleSystem.cs
+13
-2
Assets/TouchFish.Omphalia/Core/OmphaliaUtils.cs
Assets/TouchFish.Omphalia/Core/OmphaliaUtils.cs
+56
-0
Assets/TouchFish.Omphalia/Core/ParticleGroup.cs
Assets/TouchFish.Omphalia/Core/ParticleGroup.cs
+11
-5
未找到文件。
Assets/GameRes/Config/OmphaliaConfig_Local.asset
浏览文件 @
73a4b170
...
...
@@ -23,8 +23,153 @@ MonoBehaviour:
SerializationNodes
:
[]
Config
:
BatchParticleCount
:
512
ParticleGroups
:
[]
ListGroupConfig
:
[]
ParticleGroupConfigs
:
-
ConfigID
:
0
SourceParticlePrefab
:
{
fileID
:
2408373863616230867
,
guid
:
9b5c60020a23743418f9bad0a4ed0eda
,
type
:
3
}
BatchParticleCount
:
512
ReserveCount
:
8
ExpansionCount
:
4
Particles
:
-
ParticleSystemIndex
:
0
Duration
:
3
Loop
:
1
m_Position
:
x
:
0
y
:
0
z
:
0
m_Velocity
:
x
:
0
y
:
0
z
:
0
m_AnimatedVelocity
:
x
:
0
y
:
0
z
:
0
m_InitialVelocity
:
x
:
0
y
:
0
z
:
0
m_AxisOfRotation
:
x
:
0
y
:
0
z
:
1
m_Rotation
:
x
:
0
y
:
0
z
:
0
m_AngularVelocity
:
x
:
0
y
:
0
z
:
0
m_StartSize
:
x
:
1.78
y
:
1.78
z
:
1.78
m_StartColor
:
serializedVersion
:
2
rgba
:
3662723320
m_RandomSeed
:
638269364
m_ParentRandomSeed
:
0
m_Lifetime
:
0.44981024
m_StartLifetime
:
1.9498088
m_MeshIndex
:
-1
m_EmitAccumulator0
:
0
m_EmitAccumulator1
:
0
m_Flags
:
0
-
ParticleSystemIndex
:
1
Duration
:
1
Loop
:
1
m_Position
:
x
:
0
y
:
0
z
:
0
m_Velocity
:
x
:
0
y
:
0
z
:
0
m_AnimatedVelocity
:
x
:
0
y
:
0
z
:
0
m_InitialVelocity
:
x
:
0
y
:
0
z
:
0
m_AxisOfRotation
:
x
:
0
y
:
0
z
:
1
m_Rotation
:
x
:
0
y
:
0
z
:
0
m_AngularVelocity
:
x
:
0
y
:
0
z
:
0
m_StartSize
:
x
:
1.78
y
:
1.78
z
:
1.78
m_StartColor
:
serializedVersion
:
2
rgba
:
4294967295
m_RandomSeed
:
2820221114
m_ParentRandomSeed
:
0
m_Lifetime
:
0.33333337
m_StartLifetime
:
1
m_MeshIndex
:
-1
m_EmitAccumulator0
:
0
m_EmitAccumulator1
:
0
m_Flags
:
0
-
ParticleSystemIndex
:
2
Duration
:
5
Loop
:
1
m_Position
:
x
:
0
y
:
0
z
:
0
m_Velocity
:
x
:
0
y
:
0
z
:
0
m_AnimatedVelocity
:
x
:
0
y
:
0
z
:
0
m_InitialVelocity
:
x
:
0
y
:
0
z
:
0
m_AxisOfRotation
:
x
:
0
y
:
0
z
:
1
m_Rotation
:
x
:
0
y
:
0
z
:
0
m_AngularVelocity
:
x
:
0
y
:
0
z
:
0
m_StartSize
:
x
:
1.78
y
:
1.78
z
:
1.78
m_StartColor
:
serializedVersion
:
2
rgba
:
4294967295
m_RandomSeed
:
2820221114
m_ParentRandomSeed
:
0
m_Lifetime
:
0.33333337
m_StartLifetime
:
1
m_MeshIndex
:
-1
m_EmitAccumulator0
:
0
m_EmitAccumulator1
:
0
m_Flags
:
0
ListGroupConfig
:
-
{
fileID
:
11400000
,
guid
:
84469826bb78844429d3ad29d6d0d436
,
type
:
2
}
ListFxPrefab
:
-
{
fileID
:
2408373863616230867
,
guid
:
9b5c60020a23743418f9bad0a4ed0eda
,
type
:
3
}
ConfigPath
:
Assets/GameRes/Config/ParticleGroup
Assets/GameRes/Effects/prefabs/FX_hudun.prefab
浏览文件 @
73a4b170
...
...
@@ -4869,7 +4869,7 @@ ParticleSystemRenderer:
m_FreeformStretching
:
0
m_RotateWithStretchDirection
:
1
m_VertexStreams
:
0001030409
m_Mesh
:
{
fileID
:
4300000
,
guid
:
f8186d29d6a404f4bab3ca0a333be00e
,
type
:
3
}
m_Mesh
:
{
fileID
:
10207
,
guid
:
0000000000000000e000000000000000
,
type
:
0
}
m_Mesh1
:
{
fileID
:
0
}
m_Mesh2
:
{
fileID
:
0
}
m_Mesh3
:
{
fileID
:
0
}
...
...
Assets/Local/OmphaliaConfig_Local.cs
浏览文件 @
73a4b170
...
...
@@ -35,9 +35,9 @@ namespace TouchFish.Omphalia.Local
[
PropertyOrder
(
10
)]
public
void
UpdateData
()
{
Config
.
ParticleGroups
.
Clear
();
Config
.
ParticleGroup
Config
s
.
Clear
();
foreach
(
var
item
in
ListGroupConfig
)
Config
.
ParticleGroups
.
Add
(
item
.
Config
);
Config
.
ParticleGroup
Config
s
.
Add
(
item
.
Config
);
}
[
LabelText
(
"特效预制"
)]
...
...
Assets/Local/OmphaliaLocalRunner.cs
浏览文件 @
73a4b170
...
...
@@ -22,7 +22,17 @@ namespace TouchFish.Omphalia.Local
private
void
Start
()
{
OmphaliaUtils
.
Init
(
Config
.
Config
);
}
private
void
Update
()
{
OmphaliaUtils
.
Update
(
Time
.
realtimeSinceStartup
);
}
private
void
OnDestroy
()
{
OmphaliaUtils
.
Dispose
();
}
}
...
...
Assets/Local/OmphaliaLocalSpawner.cs
0 → 100644
浏览文件 @
73a4b170
/*
*Copyright(C) 2023 by TouchFinsh All rights reserved.
*Unity版本:2020.3.43f1c1
*作者:Chief
*创建日期: 2023-04-20
*版本: 0.1
*/
using
Sirenix.OdinInspector
;
using
UnityEngine
;
namespace
TouchFish.Omphalia.Local
{
/// <summary>
/// 本地例子生成器
/// </summary>
public
class
OmphaliaLocalSpawner
:
MonoBehaviour
{
[
LabelText
(
"目标配置"
)]
public
int
ConfigID
;
[
Button
(
"生成一个"
)]
[
HideInEditorMode
]
public
void
SpawnOne
()
{
ParticleGroupSpawnInfo
spawnInfo
=
new
ParticleGroupSpawnInfo
(
transform
.
position
,
transform
.
rotation
,
transform
.
localScale
,
Time
.
realtimeSinceStartup
);
OmphaliaUtils
.
SpawnParticle
(
ConfigID
,
spawnInfo
);
}
}
}
\ No newline at end of file
Assets/Local/OmphaliaLocalSpawner.cs.meta
0 → 100644
浏览文件 @
73a4b170
fileFormatVersion: 2
guid: 8d4c370c91d7d6648a83a44062066eb8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scenes/SampleScene.unity
浏览文件 @
73a4b170
...
...
@@ -606,7 +606,7 @@ GameObject:
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
m_IsActive
:
0
---
!u!4
&1765665486
Transform
:
m_ObjectHideFlags
:
0
...
...
@@ -626,6 +626,50 @@ Transform:
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
2
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!1
&1938569926
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
1938569928
}
-
component
:
{
fileID
:
1938569927
}
m_Layer
:
0
m_Name
:
OmphaliaLocalSpawner
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&1938569927
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1938569926
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
8d4c370c91d7d6648a83a44062066eb8
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
ConfigID
:
0
---
!u!4
&1938569928
Transform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1938569926
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
4
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!1001
&2029928270
PrefabInstance
:
m_ObjectHideFlags
:
0
...
...
Assets/TouchFish.Omphalia/Core/Config/OmphaliaConfig.cs
浏览文件 @
73a4b170
...
...
@@ -31,7 +31,7 @@ namespace TouchFish.Omphalia
#if ODIN_INSPECTOR
[
LabelText
(
"粒子组配置"
)]
#endif
public
List
<
ParticleGroupConfig
>
ParticleGroups
=
new
List
<
ParticleGroupConfig
>();
public
List
<
ParticleGroupConfig
>
ParticleGroup
Config
s
=
new
List
<
ParticleGroupConfig
>();
}
}
\ No newline at end of file
Assets/TouchFish.Omphalia/Core/Config/ParticleConfig.cs
浏览文件 @
73a4b170
...
...
@@ -135,7 +135,7 @@ namespace TouchFish.Omphalia
AxisOfRotation
=
m_AxisOfRotation
,
Rotation
=
m_Rotation
+
spawnInfo
.
Rotation
,
AngularVelocity
=
m_AngularVelocity
,
StartSize
=
m_StartSize
+
spawnInfo
.
Scale
,
StartSize
=
m_StartSize
*
spawnInfo
.
Scale
,
StartColor
=
m_StartColor
,
RandomSeed
=
m_RandomSeed
,
ParentRandomSeed
=
m_ParentRandomSeed
,
...
...
Assets/TouchFish.Omphalia/Core/OmphaliaParticleSystem.cs
浏览文件 @
73a4b170
...
...
@@ -63,6 +63,9 @@ namespace TouchFish.Omphalia
/// </summary>
public
void
Init
()
{
particleSystem
?.
Clear
();
particleSystem
.
SetParticles
(
null
);
particleSystem
.
Stop
();
SetArrayLength
(
ParticleCount
*
ReserveCount
);
}
...
...
@@ -89,15 +92,23 @@ namespace TouchFish.Omphalia
m_OmphaliaParticles
.
CopyTo
(
m_Particles
);
}
private
int
unityParticleCount
;
private
Particle
[]
m_Particles
;
#
endregion
#
region
显示更新
private
int
unityParticleCount
;
private
Particle
[]
m_Particles
;
public
void
UpdateView
()
{
if
(
unityParticleCount
<=
0
)
{
particleSystem
.
Stop
();
return
;
}
if
(!
particleSystem
.
isPlaying
)
particleSystem
.
Play
();
particleSystem
?.
SetParticles
(
m_Particles
,
unityParticleCount
);
}
...
...
Assets/TouchFish.Omphalia/Core/OmphaliaUtils.cs
浏览文件 @
73a4b170
...
...
@@ -7,6 +7,7 @@
*/
using
System
;
using
System.Collections.Generic
;
using
System.Reflection
;
using
Unity.Entities
;
using
UnityEngine
;
...
...
@@ -26,6 +27,61 @@ namespace TouchFish.Omphalia
{
Config
=
config
;
OmphaliaFxRoot
=
new
GameObject
(
"OmphaliaFxRoot"
).
transform
;
//开始生成所有配置
m_DictParticleGroups
.
Clear
();
CreateAllGroup
();
}
private
static
void
CreateAllGroup
()
{
m_DictParticleGroups
.
Clear
();
var
configs
=
Config
.
ParticleGroupConfigs
;
foreach
(
var
config
in
configs
)
{
ParticleGroup
group
=
new
ParticleGroup
();
group
.
Init
(
config
,
true
);
m_DictParticleGroups
[
config
.
ConfigID
]=
group
;
}
}
private
static
Dictionary
<
int
,
ParticleGroup
>
m_DictParticleGroups
=
new
Dictionary
<
int
,
ParticleGroup
>();
public
static
void
Update
(
float
gameTime
)
{
GameTime
=
gameTime
;
foreach
(
var
item
in
m_DictParticleGroups
.
Values
)
{
item
.
UpdateAll
();
}
}
public
static
void
Dispose
()
{
}
#
endregion
#
region
外部调用接口
public
static
int
SpawnParticle
(
int
cfgId
,
ParticleGroupSpawnInfo
spawnInfo
)
{
ParticleGroup
group
;
if
(
m_DictParticleGroups
.
TryGetValue
(
cfgId
,
out
group
))
{
return
group
.
Add
(
spawnInfo
);
}
return
-
1
;
}
public
static
void
RemoveParticle
(
int
cfgId
,
int
index
)
{
ParticleGroup
group
;
if
(
m_DictParticleGroups
.
TryGetValue
(
cfgId
,
out
group
))
{
group
.
Remove
(
index
);
}
}
#
endregion
...
...
Assets/TouchFish.Omphalia/Core/ParticleGroup.cs
浏览文件 @
73a4b170
...
...
@@ -40,8 +40,6 @@ namespace TouchFish.Omphalia
//生成运行时粒子配置
particleSystems
=
gameObject
.
GetComponentsInChildren
<
ParticleSystem
>();
foreach
(
var
particle
in
particleSystems
)
particle
.
Clear
();
//清空所有默认的粒子
m_InitConfig
=
true
;
...
...
@@ -94,8 +92,9 @@ namespace TouchFish.Omphalia
/// </summary>
private
int
m_EnableCount
;
public
int
Add
(
Vector3
pos
,
Quaternion
rot
,
Vector3
scale
,
float
startTime
)
public
int
Add
(
ParticleGroupSpawnInfo
spawnInfo
)
{
m_IsDirty
=
true
;
//找一个空位;
int
length
=
m_SpawnInfos
.
Count
;
for
(
int
i
=
0
;
i
<
length
;
i
++)
...
...
@@ -103,12 +102,12 @@ namespace TouchFish.Omphalia
var
info
=
m_SpawnInfos
[
i
];
if
(!
info
.
Enable
)
{
m_SpawnInfos
[
i
]
=
new
ParticleGroupSpawnInfo
(
pos
,
rot
,
scale
,
startTime
)
;
m_SpawnInfos
[
i
]
=
spawnInfo
;
m_EnableCount
++;
return
i
;
}
}
m_SpawnInfos
.
Add
(
new
ParticleGroupSpawnInfo
(
pos
,
rot
,
scale
,
startTime
)
);
m_SpawnInfos
.
Add
(
spawnInfo
);
m_EnableCount
++;
return
length
;
}
...
...
@@ -120,14 +119,21 @@ namespace TouchFish.Omphalia
m_EnableCount
--;
var
spawnInfo
=
m_SpawnInfos
[
index
];
spawnInfo
.
Enable
=
false
;
m_IsDirty
=
true
;
}
#
endregion
#
region
Update
private
bool
m_IsDirty
=
false
;
public
void
UpdateAll
()
{
//if (!m_IsDirty)
// return;
//m_IsDirty = false;
UpdateData
();
UpdateView
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录