Netcode Bootstrap
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.VFX;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace Rukhanka.Samples
|
||||
{
|
||||
[RequireComponent(typeof(VisualEffect))]
|
||||
public class DestroyVFXAfterPlay: MonoBehaviour
|
||||
{
|
||||
VisualEffect vfx;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
vfx = GetComponent<VisualEffect>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (vfx.aliveParticleCount == 0)
|
||||
Destroy(gameObject, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5673f7855462454792e2cf679d20f15
|
||||
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/19. Animation and Animator Events/Scripts/DestroyVFXAfterPlay.cs
|
||||
uploadId: 897522
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace Rukhanka.Samples
|
||||
{
|
||||
public class EventsSampleConf: MonoBehaviour
|
||||
{
|
||||
public GameObject walkStepLParticle;
|
||||
public GameObject walkStepRParticle;
|
||||
public TextMeshProUGUI sampleDescription;
|
||||
|
||||
void Start()
|
||||
{
|
||||
#if !RUKHANKA_SAMPLES_WITH_VFX_GRAPH
|
||||
sampleDescription.text += "\n\n<color=red>Please install the <b>Visual Effect Graph</b> package for the proper functioning of this sample!</color>";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b9df9e1c3df57841bf77935767cf607
|
||||
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/19. Animation and Animator Events/Scripts/EventsSampleConf.cs
|
||||
uploadId: 897522
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
using Unity.Entities;
|
||||
using Unity.Mathematics;
|
||||
using Unity.Transforms;
|
||||
using UnityEngine;
|
||||
using UnityEngine.VFX;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace Rukhanka.Samples
|
||||
{
|
||||
[UpdateAfter(typeof(RukhankaAnimationSystemGroup))]
|
||||
[WorldSystemFilter(WorldSystemFilterFlags.LocalSimulation | WorldSystemFilterFlags.ClientSimulation)]
|
||||
public partial class SampleEventReactionSystem : SystemBase
|
||||
{
|
||||
EventsSampleConf cfg;
|
||||
|
||||
protected override void OnStartRunning()
|
||||
{
|
||||
cfg = GameObject.FindFirstObjectByType<EventsSampleConf>();
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
if (cfg == null)
|
||||
return;
|
||||
|
||||
float3 leftLegPos = 0, rightLegPos = 0;
|
||||
|
||||
foreach (var (_, lt) in SystemAPI.Query<EllenLeftFootTag, LocalTransform>())
|
||||
{
|
||||
leftLegPos = lt.Position;
|
||||
}
|
||||
|
||||
foreach (var (_, lt) in SystemAPI.Query<EllenRightFootTag, LocalTransform>())
|
||||
{
|
||||
rightLegPos = lt.Position;
|
||||
}
|
||||
|
||||
foreach (var aes in SystemAPI.Query<DynamicBuffer<AnimationEventComponent>>())
|
||||
{
|
||||
foreach (var ae in aes)
|
||||
{
|
||||
if (ae.intParam == 0)
|
||||
GameObject.Instantiate(cfg.walkStepLParticle, new Vector3(leftLegPos.x, leftLegPos.y, leftLegPos.z), Quaternion.Euler(0, 0, 45));
|
||||
|
||||
if (ae.intParam == 1)
|
||||
GameObject.Instantiate(cfg.walkStepRParticle, new Vector3(rightLegPos.x, rightLegPos.y, rightLegPos.z), Quaternion.Euler(0, 0, -45));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var aces in SystemAPI.Query<DynamicBuffer<AnimatorControllerEventComponent>>())
|
||||
{
|
||||
foreach (var ace in aces)
|
||||
{
|
||||
if (ace.eventType == AnimatorControllerEventComponent.EventType.StateEnter)
|
||||
{
|
||||
var color = new Vector4(1, 1, 0, 1);
|
||||
if (ace.stateId == 1)
|
||||
color = new Vector4(1, 0, 0, 1);
|
||||
cfg.walkStepRParticle.GetComponent<VisualEffect>().SetVector4("myColor", color);
|
||||
cfg.walkStepLParticle.GetComponent<VisualEffect>().SetVector4("myColor", color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 506800e2760d10446a12d95e8edd8ac7
|
||||
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/19. Animation and Animator Events/Scripts/SampleEventReactionSystem.cs
|
||||
uploadId: 897522
|
||||
Reference in New Issue
Block a user