using System; using Unity.Burst; using Unity.Entities; using Unity.Mathematics; using UnityEngine; using UnityEngine.UI; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// namespace Rukhanka.Samples { public struct InputStateData { public float floatParam1; public float floatParam2; public float floatParam3; public int intParam1; public bool boolParam1; public bool triggerParam1; } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// [WorldSystemFilter(WorldSystemFilterFlags.LocalSimulation | WorldSystemFilterFlags.ClientSimulation)] [UpdateBefore(typeof(RukhankaAnimationSystemGroup))] [RequireMatchingQueriesForUpdate] public partial class PlayerControllerSystem: SystemBase { static readonly string floatParam1Name = "FloatParam1"; static FastAnimatorParameter floatParam1 = new (floatParam1Name); static readonly string floatParam2Name = "FloatParam2"; static FastAnimatorParameter floatParam2 = new (floatParam2Name); static readonly string floatParam3Name = "FloatParam3"; static FastAnimatorParameter floatParam3 = new (floatParam3Name); static readonly string intParam1Name = "IntParam1"; static FastAnimatorParameter intParam1 = new (intParam1Name); static readonly string boolParam1Name = "BoolParam1"; static FastAnimatorParameter boolParam1 = new (boolParam1Name); static readonly string triggerParam1Name = "TriggerParam1"; static FastAnimatorParameter triggerParam1 = new (triggerParam1Name); Animator[] managedAnimators; bool trigger1Value; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// [BurstCompile] partial struct ProcessInputJob: IJobEntity { public InputStateData inputData; public FastAnimatorParameter floatParam3P; public FastAnimatorParameter floatParam2P; public FastAnimatorParameter floatParam1P; public FastAnimatorParameter intParam1P; public FastAnimatorParameter boolParam1P; public FastAnimatorParameter triggerParam1P; void Execute(AnimatorControllerParameterIndexTableComponent indexTable, DynamicBuffer parametersArr) { var paramAspect = new AnimatorParametersAspect(parametersArr, indexTable); if (paramAspect.HasParameter(floatParam1P)) paramAspect.SetParameterValue(floatParam1P, inputData.floatParam1); if (paramAspect.HasParameter(floatParam2P)) paramAspect.SetParameterValue(floatParam2P, inputData.floatParam2); if (paramAspect.HasParameter(floatParam3P)) paramAspect.SetParameterValue(floatParam3P, inputData.floatParam2); if (paramAspect.HasParameter(intParam1P)) paramAspect.SetParameterValue(intParam1P, inputData.intParam1); if (paramAspect.HasParameter(boolParam1P)) paramAspect.SetParameterValue(boolParam1P, inputData.boolParam1); if (inputData.triggerParam1) paramAspect.SetParameterValue(triggerParam1P, inputData.triggerParam1); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected override void OnStartRunning() { base.OnStartRunning(); var setTriggerBtn = GameObject.Find(triggerParam1Name); if (setTriggerBtn != null) { setTriggerBtn.GetComponent