Netcode Bootstrap
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using TMPro;
|
||||
using Unity.Entities;
|
||||
using UnityEngine;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace Rukhanka.Samples
|
||||
{
|
||||
public class VFXSampleConf: MonoBehaviour
|
||||
{
|
||||
public TextMeshProUGUI sampleDescription;
|
||||
|
||||
void Start()
|
||||
{
|
||||
#if !UNITY_6000_0_OR_NEWER
|
||||
sampleDescription.text += "\n\n\n<color=red>VFX custom node support was added in version 6000.0. Please make sure you are using Unity 6000.0 or newer for this sample to work properly.</color>";
|
||||
#else
|
||||
|
||||
#if !RUKHANKA_SAMPLES_WITH_VFX_GRAPH
|
||||
sampleDescription.text += "\n\n\n<color=red>Please install the <b>Visual Effect Graph</b> package for the proper functioning of this sample!</color>";
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0215b30e5ec763241aa4eda5eb586e7c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 298480
|
||||
packageName: Rukhanka Animation System 2
|
||||
packageVersion: 2.9.0
|
||||
assetPath: Packages/com.rukhanka.animation/Samples~/Samples/Scenes/26. VFX Skinned Mesh Sampling/Scripts/VFXSampleConf.cs
|
||||
uploadId: 897522
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
using Unity.Entities;
|
||||
using UnityEngine;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace Rukhanka.Samples
|
||||
{
|
||||
|
||||
class VFXSkinnedMeshSamplerAuthoring: MonoBehaviour
|
||||
{
|
||||
public GameObject skinnedMesh;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class VFXSkinnedMeshSamplerBaker: Baker<VFXSkinnedMeshSamplerAuthoring>
|
||||
{
|
||||
public override void Bake(VFXSkinnedMeshSamplerAuthoring a)
|
||||
{
|
||||
var e = GetEntity(a, TransformUsageFlags.None);
|
||||
var smsc = new VFXSkinnedMeshSamplerComponent()
|
||||
{
|
||||
skinnedMeshEntity = GetEntity(a.skinnedMesh, TransformUsageFlags.None)
|
||||
};
|
||||
AddComponent(e, smsc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c31456ec2f569064794a072013a37a6b
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 298480
|
||||
packageName: Rukhanka Animation System 2
|
||||
packageVersion: 2.9.0
|
||||
assetPath: Packages/com.rukhanka.animation/Samples~/Samples/Scenes/26. VFX Skinned Mesh Sampling/Scripts/VFXSkinnedMeshSamplerAuthoring.cs
|
||||
uploadId: 897522
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
using Unity.Entities;
|
||||
using UnityEngine;
|
||||
#if RUKHANKA_SAMPLES_WITH_VFX_GRAPH
|
||||
using UnityEngine.VFX;
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace Rukhanka.Samples
|
||||
{
|
||||
|
||||
struct VFXSkinnedMeshSamplerComponent: IComponentData
|
||||
{
|
||||
public Entity skinnedMeshEntity;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[WorldSystemFilter(WorldSystemFilterFlags.Default | WorldSystemFilterFlags.Editor)]
|
||||
partial class VFXSkinnedMeshSamplerSystem: SystemBase
|
||||
{
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
#if RUKHANKA_SAMPLES_WITH_VFX_GRAPH
|
||||
foreach (var (smsc, e) in SystemAPI.Query<VFXSkinnedMeshSamplerComponent>().WithEntityAccess())
|
||||
{
|
||||
if (!EntityManager.HasComponent<VisualEffect>(e))
|
||||
continue;
|
||||
|
||||
if (!EntityManager.HasComponent<DeformedMeshIndex>(smsc.skinnedMeshEntity))
|
||||
continue;
|
||||
|
||||
var vfx = EntityManager.GetComponentObject<VisualEffect>(e);
|
||||
var deformedMeshIndex = EntityManager.GetComponentData<DeformedMeshIndex>(smsc.skinnedMeshEntity);
|
||||
vfx.SetInt("DeformedMeshIndex", (int)deformedMeshIndex.Value);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3848c87a620aba84a9ad9d06d9bebce9
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 298480
|
||||
packageName: Rukhanka Animation System 2
|
||||
packageVersion: 2.9.0
|
||||
assetPath: Packages/com.rukhanka.animation/Samples~/Samples/Scenes/26. VFX Skinned Mesh Sampling/Scripts/VFXSkinnedMeshSamplerSystem.cs
|
||||
uploadId: 897522
|
||||
Reference in New Issue
Block a user