using System.Collections; using System.Collections.Generic; using UnityEngine; using SC.XR.Unity.Module_InputSystem.InputDeviceGC.KS; using SC.XR.Unity.Module_InputSystem; public class ModleK102Blend : ModelK102 { public float keyAXBlend = 0; public float keyBYBlend = 0; public float keyFunctionBlend = 0; public float keyHallInsideBlend = 0; public float keyHallForwardBlend = 0; public float JoystickXBlend = 0; public float JoystickYBlend = 0; public Animator ControllerKeyAnimator; public override void OnSCAwake() { base.OnSCAwake(); if (ControllerKeyAnimator == null) { ControllerKeyAnimator = GetComponent(); } } public override void UpdateHallVisual() { if (inputDeviceKSPartUI.inputDeviceKSPart.inputDataKS.HallFoward <= (HallForwardReleaseValue - HallForwardPressValue) / 2) { keyHallForwardBlend = 1; } else { keyHallForwardBlend = 0; } SetAnimatorValue("keyHallForwardBlend", keyHallForwardBlend); if (inputDeviceKSPartUI.inputDeviceKSPart.inputDataKS.HallInside <= (HallInsideReleaseValue - HallInsidePressValue) / 2) { keyHallInsideBlend = 1; } else { keyHallInsideBlend = 0; } SetAnimatorValue("keyHallInsideBlend", keyHallInsideBlend); } public override void UpdateJoystickTransform() { if (inputDeviceKSPartUI.inputDeviceKSPart.inputDataKS.JoystickX != joystickTempValue.x || inputDeviceKSPartUI.inputDeviceKSPart.inputDataKS.JoystickY != joystickTempValue.y) { JoystickXBlend = inputDeviceKSPartUI.inputDeviceKSPart.inputDataKS.JoystickX - joystickInitalValue.x; JoystickYBlend = inputDeviceKSPartUI.inputDeviceKSPart.inputDataKS.JoystickY - joystickInitalValue.y; SetAnimatorValue("JoystickXBlend", JoystickXBlend); SetAnimatorValue("JoystickYBlend", JoystickYBlend); joystickTempValue.x = inputDeviceKSPartUI.inputDeviceKSPart.inputDataKS.JoystickX; joystickTempValue.y = inputDeviceKSPartUI.inputDeviceKSPart.inputDataKS.JoystickY; } } public override void SetHandleKeysColor() { foreach (var item in inputDeviceKSPartUI.inputDeviceKSPart.inputDataKS.inputKeys.inputKeyPressDic) { if (item.Key == InputKeyCode.Trigger) { //triggerKey.material = releaseMaterial; //if (item.Value == InputKeyState.DOWN || item.Value == InputKeyState.LONG) { // triggerKey.material = pressMaterial; //} } else if ((item.Key == InputKeyCode.RFunction || item.Key == InputKeyCode.LFunction)) { if (item.Value == InputKeyState.DOWN || item.Value == InputKeyState.LONG) { keyFunctionBlend = 1; } else if (item.Value == InputKeyState.UP) { keyFunctionBlend = 0; } SetAnimatorValue("keyFunctionBlend", keyFunctionBlend); } else if (item.Key == InputKeyCode.X || item.Key == InputKeyCode.A) { if (item.Value == InputKeyState.DOWN || item.Value == InputKeyState.LONG) { keyAXBlend = 1; } else if (item.Value == InputKeyState.UP) { keyAXBlend = 0; } SetAnimatorValue("keyAXBlend", keyAXBlend); } else if (item.Key == InputKeyCode.Y || item.Key == InputKeyCode.B) { if (item.Value == InputKeyState.DOWN || item.Value == InputKeyState.LONG) { keyBYBlend = 1; } else if (item.Value == InputKeyState.UP) { keyBYBlend = 0; } SetAnimatorValue("keyBYBlend", keyBYBlend); } else if (item.Key == InputKeyCode.LjoystickKey || item.Key == InputKeyCode.RjoystickKey) { if (item.Value == InputKeyState.DOWN || item.Value == InputKeyState.LONG) { } else if (item.Value == InputKeyState.UP) { } } } } void SetAnimatorValue(string name,float value) { if (ControllerKeyAnimator) { ControllerKeyAnimator.SetFloat(name, value); } } }