init
This commit is contained in:
commit
c7d8c303a6
499 changed files with 2349700 additions and 0 deletions
13
Assets/ABI.CCK/Components/CVRAction.cs
Executable file
13
Assets/ABI.CCK/Components/CVRAction.cs
Executable file
|
@ -0,0 +1,13 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRAction : MonoBehaviour
|
||||
{
|
||||
[Header("Meta")]
|
||||
public string actionName;
|
||||
[Header("Objects")]
|
||||
public GameObject[] actionObjects;
|
||||
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRAction.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRAction.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a097fabf5861a554bb69d8192c7de2d9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
19
Assets/ABI.CCK/Components/CVRAdvancedAvatarSettingsPointer.cs
Executable file
19
Assets/ABI.CCK/Components/CVRAdvancedAvatarSettingsPointer.cs
Executable file
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRAdvancedAvatarSettingsPointer : CVRPointer
|
||||
{
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
if (isActiveAndEnabled)
|
||||
{
|
||||
Gizmos.color = Color.cyan;
|
||||
Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one);
|
||||
Gizmos.matrix = rotationMatrix;
|
||||
Gizmos.DrawSphere(Vector3.zero, 0.015f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRAdvancedAvatarSettingsPointer.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRAdvancedAvatarSettingsPointer.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b653dce02e8592f41aa6be74bcee243b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
226
Assets/ABI.CCK/Components/CVRAdvancedAvatarSettingsTrigger.cs
Executable file
226
Assets/ABI.CCK/Components/CVRAdvancedAvatarSettingsTrigger.cs
Executable file
|
@ -0,0 +1,226 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRAdvancedAvatarSettingsTrigger : MonoBehaviour
|
||||
{
|
||||
public Vector3 areaSize = new Vector3(0.05f, 0.05f, 0.05f);
|
||||
public Vector3 areaOffset = Vector3.zero;
|
||||
public string settingName;
|
||||
public float settingValue = 0;
|
||||
|
||||
public bool useAdvancedTrigger = false;
|
||||
public bool isNetworkInteractable = true;
|
||||
[SerializeField]
|
||||
public List<CVRPointer> allowedPointer = new List<CVRPointer>();
|
||||
|
||||
public string[] allowedTypes = new string[0];
|
||||
public bool allowParticleInteraction = false;
|
||||
|
||||
public List<CVRAdvancedAvatarSettingsTriggerTask> enterTasks = new List<CVRAdvancedAvatarSettingsTriggerTask>();
|
||||
public List<CVRAdvancedAvatarSettingsTriggerTask> exitTasks = new List<CVRAdvancedAvatarSettingsTriggerTask>();
|
||||
|
||||
public List<CVRAdvancedAvatarSettingsTriggerTaskStay> stayTasks = new List<CVRAdvancedAvatarSettingsTriggerTaskStay>();
|
||||
|
||||
public enum SampleDirection
|
||||
{
|
||||
XPositive,
|
||||
XNegative,
|
||||
YPositive,
|
||||
YNegative,
|
||||
ZPositive,
|
||||
ZNegative
|
||||
}
|
||||
|
||||
public SampleDirection sampleDirection = SampleDirection.XPositive;
|
||||
|
||||
public void Trigger()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void EnterTrigger()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ExitTrigger()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void StayTrigger(float percent = 0f)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
if (isActiveAndEnabled)
|
||||
{
|
||||
Gizmos.color = Color.cyan;
|
||||
Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, transform.lossyScale);
|
||||
Gizmos.matrix = rotationMatrix;
|
||||
Gizmos.DrawCube(areaOffset, areaSize);
|
||||
|
||||
Vector3 bounds = new Vector3(areaSize.x * 0.5f, areaSize.y * 0.5f, areaSize.z * 0.5f);
|
||||
|
||||
if (stayTasks.Count > 0)
|
||||
{
|
||||
Gizmos.DrawWireCube(areaOffset, areaSize);
|
||||
|
||||
switch (sampleDirection)
|
||||
{
|
||||
case SampleDirection.XPositive:
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(bounds.x, 0f, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, -bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(bounds.x, 0f, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(bounds.x, bounds.y, 0f) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, -bounds.z) + areaOffset,
|
||||
new Vector3(bounds.x, bounds.y, 0f) + areaOffset
|
||||
);
|
||||
break;
|
||||
case SampleDirection.XNegative:
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, 0f, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(bounds.x, -bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, 0f, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, bounds.y, 0f) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(bounds.x, bounds.y, -bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, bounds.y, 0f) + areaOffset
|
||||
);
|
||||
break;
|
||||
case SampleDirection.YPositive:
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, -bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(0f, bounds.y, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(bounds.x, -bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(0f, bounds.y, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, -bounds.y, -bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, bounds.y, 0f) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, -bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, bounds.y, 0f) + areaOffset
|
||||
);
|
||||
break;
|
||||
case SampleDirection.YNegative:
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(0f, -bounds.y, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(0f, -bounds.y, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, -bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, -bounds.y, 0f) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, -bounds.y, 0f) + areaOffset
|
||||
);
|
||||
break;
|
||||
case SampleDirection.ZPositive:
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, -bounds.z) + areaOffset,
|
||||
new Vector3(0f, bounds.y, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(bounds.x, bounds.y, -bounds.z) + areaOffset,
|
||||
new Vector3(0f, bounds.y, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, -bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, 0f, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, -bounds.y, -bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, 0f, bounds.z) + areaOffset
|
||||
);
|
||||
break;
|
||||
case SampleDirection.ZNegative:
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(0f, bounds.y, -bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(0f, bounds.y, -bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, 0f, -bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, -bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, 0f, -bounds.z) + areaOffset
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class CVRAdvancedAvatarSettingsTriggerTask
|
||||
{
|
||||
public string settingName;
|
||||
public float settingValue = 0f;
|
||||
public float delay = 0f;
|
||||
public float holdTime = 0f;
|
||||
|
||||
public enum UpdateMethod
|
||||
{
|
||||
Override = 1,
|
||||
Add = 2,
|
||||
Subtract = 3,
|
||||
Toggle = 4
|
||||
}
|
||||
|
||||
public CVRAdvancedAvatarSettingsTriggerTask.UpdateMethod updateMethod = UpdateMethod.Override;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class CVRAdvancedAvatarSettingsTriggerTaskStay
|
||||
{
|
||||
public string settingName;
|
||||
public float minValue = 0f;
|
||||
public float maxValue = 1f;
|
||||
|
||||
public enum UpdateMethod
|
||||
{
|
||||
SetFromPosition = 1,
|
||||
Add = 2,
|
||||
Subtract = 3,
|
||||
}
|
||||
|
||||
public CVRAdvancedAvatarSettingsTriggerTaskStay.UpdateMethod updateMethod = UpdateMethod.SetFromPosition;
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRAdvancedAvatarSettingsTrigger.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRAdvancedAvatarSettingsTrigger.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4c38a501be50ebd468683e624abb7520
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
26
Assets/ABI.CCK/Components/CVRAdvancedAvatarSettingsTriggerHelper.cs
Executable file
26
Assets/ABI.CCK/Components/CVRAdvancedAvatarSettingsTriggerHelper.cs
Executable file
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRAdvancedAvatarSettingsTriggerHelper : MonoBehaviour
|
||||
{
|
||||
public List<CVRAdvancedAvatarSettingsTrigger> triggers = new List<CVRAdvancedAvatarSettingsTrigger>();
|
||||
|
||||
public void onEnter(int i)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void onExit(int i)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void onStay(int i)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRAdvancedAvatarSettingsTriggerHelper.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRAdvancedAvatarSettingsTriggerHelper.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fc162b1be61549a791b340677e4d330b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
74
Assets/ABI.CCK/Components/CVRAnimatorDriver.cs
Executable file
74
Assets/ABI.CCK/Components/CVRAnimatorDriver.cs
Executable file
|
@ -0,0 +1,74 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRAnimatorDriver : MonoBehaviour
|
||||
{
|
||||
public float animatorParameter01;
|
||||
public float animatorParameter02;
|
||||
public float animatorParameter03;
|
||||
public float animatorParameter04;
|
||||
public float animatorParameter05;
|
||||
public float animatorParameter06;
|
||||
public float animatorParameter07;
|
||||
public float animatorParameter08;
|
||||
public float animatorParameter09;
|
||||
public float animatorParameter10;
|
||||
public float animatorParameter11;
|
||||
public float animatorParameter12;
|
||||
public float animatorParameter13;
|
||||
public float animatorParameter14;
|
||||
public float animatorParameter15;
|
||||
public float animatorParameter16;
|
||||
|
||||
[HideInInspector]
|
||||
public List<Animator> animators = new List<Animator>();
|
||||
[HideInInspector]
|
||||
public List<string> animatorParameters = new List<string>();
|
||||
[HideInInspector]
|
||||
public List<int> animatorParameterType = new List<int>();
|
||||
|
||||
private void OnDidApplyAnimationProperties()
|
||||
{
|
||||
if (animators.Count >= 1) ApplyAnimatorChange(animators[ 0], animatorParameters[ 0], animatorParameterType[ 0], animatorParameter01);
|
||||
if (animators.Count >= 2) ApplyAnimatorChange(animators[ 1], animatorParameters[ 1], animatorParameterType[ 1], animatorParameter02);
|
||||
if (animators.Count >= 3) ApplyAnimatorChange(animators[ 2], animatorParameters[ 2], animatorParameterType[ 2], animatorParameter03);
|
||||
if (animators.Count >= 4) ApplyAnimatorChange(animators[ 3], animatorParameters[ 3], animatorParameterType[ 3], animatorParameter04);
|
||||
if (animators.Count >= 5) ApplyAnimatorChange(animators[ 4], animatorParameters[ 4], animatorParameterType[ 4], animatorParameter05);
|
||||
if (animators.Count >= 6) ApplyAnimatorChange(animators[ 5], animatorParameters[ 5], animatorParameterType[ 5], animatorParameter06);
|
||||
if (animators.Count >= 7) ApplyAnimatorChange(animators[ 6], animatorParameters[ 6], animatorParameterType[ 6], animatorParameter07);
|
||||
if (animators.Count >= 8) ApplyAnimatorChange(animators[ 7], animatorParameters[ 7], animatorParameterType[ 7], animatorParameter08);
|
||||
if (animators.Count >= 9) ApplyAnimatorChange(animators[ 8], animatorParameters[ 8], animatorParameterType[ 8], animatorParameter09);
|
||||
if (animators.Count >= 10) ApplyAnimatorChange(animators[ 9], animatorParameters[ 9], animatorParameterType[ 9], animatorParameter10);
|
||||
if (animators.Count >= 11) ApplyAnimatorChange(animators[10], animatorParameters[10], animatorParameterType[10], animatorParameter11);
|
||||
if (animators.Count >= 12) ApplyAnimatorChange(animators[11], animatorParameters[11], animatorParameterType[11], animatorParameter12);
|
||||
if (animators.Count >= 13) ApplyAnimatorChange(animators[12], animatorParameters[12], animatorParameterType[12], animatorParameter13);
|
||||
if (animators.Count >= 14) ApplyAnimatorChange(animators[13], animatorParameters[13], animatorParameterType[13], animatorParameter14);
|
||||
if (animators.Count >= 15) ApplyAnimatorChange(animators[14], animatorParameters[14], animatorParameterType[14], animatorParameter15);
|
||||
if (animators.Count >= 16) ApplyAnimatorChange(animators[15], animatorParameters[15], animatorParameterType[15], animatorParameter16);
|
||||
}
|
||||
|
||||
private void ApplyAnimatorChange(Animator animator, string parameterName, int parameterType, float parameterValue)
|
||||
{
|
||||
if (parameterName != "-none-")
|
||||
{
|
||||
switch (parameterType)
|
||||
{
|
||||
case 0:
|
||||
animator.SetFloat(parameterName, parameterValue);
|
||||
break;
|
||||
case 1:
|
||||
animator.SetInteger(parameterName, (int) parameterValue);
|
||||
break;
|
||||
case 2:
|
||||
animator.SetBool(parameterName, parameterValue > 0.5f);
|
||||
break;
|
||||
case 3:
|
||||
if (parameterValue > 0.5f) animator.SetTrigger(parameterName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRAnimatorDriver.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRAnimatorDriver.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 85325d81a0074483a716c31506478354
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
21
Assets/ABI.CCK/Components/CVRAssetInfo.cs
Executable file
21
Assets/ABI.CCK/Components/CVRAssetInfo.cs
Executable file
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRAssetInfo : MonoBehaviour
|
||||
{
|
||||
public enum AssetType
|
||||
{
|
||||
Avatar = 1,
|
||||
World = 2,
|
||||
Spawnable = 3
|
||||
}
|
||||
|
||||
|
||||
public AssetType type;
|
||||
public string objectId;
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRAssetInfo.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRAssetInfo.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 990f6f4efb7f4ec98ad99f6dff1bc6f6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
80
Assets/ABI.CCK/Components/CVRAttachment.cs
Executable file
80
Assets/ABI.CCK/Components/CVRAttachment.cs
Executable file
|
@ -0,0 +1,80 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRAttachment : MonoBehaviour
|
||||
{
|
||||
[System.Flags]
|
||||
public enum AttachmentType
|
||||
{
|
||||
Bone = 1,
|
||||
Tracker = 2,
|
||||
}
|
||||
|
||||
public AttachmentType attachmentType;
|
||||
|
||||
[System.Flags]
|
||||
public enum BoneType
|
||||
{
|
||||
Hips = 1,
|
||||
Spine = 2,
|
||||
Chest = 4,
|
||||
UpperChest = 8,
|
||||
Neck = 16,
|
||||
Head = 32,
|
||||
LeftUpperLeg = 64,
|
||||
LeftLowerLeg = 128,
|
||||
LeftFoot = 256,
|
||||
RightUpperLeg = 512,
|
||||
RightLowerLeg = 1024,
|
||||
RightFoot = 2048,
|
||||
LeftShoulder = 4096,
|
||||
LeftArm = 8192,
|
||||
LeftForearm = 16384,
|
||||
LeftHand = 32768,
|
||||
RightShoulder = 65536,
|
||||
RightArm = 131072,
|
||||
RightForearm = 262144,
|
||||
RightHand = 524288,
|
||||
Root = 1048576
|
||||
}
|
||||
|
||||
public BoneType boneType = 0;
|
||||
|
||||
[System.Flags]
|
||||
public enum TrackerType
|
||||
{
|
||||
MainCamera = 1,
|
||||
RightHand = 2,
|
||||
LeftHand = 4,
|
||||
AdditionalTracker = 8
|
||||
}
|
||||
|
||||
public TrackerType trackerType = 0;
|
||||
|
||||
public bool useFixedPositionOffset = false;
|
||||
public bool useFixedRotationOffset = false;
|
||||
|
||||
public Vector3 positionOffset;
|
||||
public Vector3 rotationOffset;
|
||||
|
||||
public float maxAttachmentDistance = 0f;
|
||||
|
||||
[SerializeField]
|
||||
public UnityEvent onAttach;
|
||||
|
||||
[SerializeField]
|
||||
public UnityEvent onDeattach;
|
||||
|
||||
public void Attach()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeAttach()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRAttachment.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRAttachment.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 49500f2c365e4c0894107af6cb238228
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
74
Assets/ABI.CCK/Components/CVRAudioDriver.cs
Executable file
74
Assets/ABI.CCK/Components/CVRAudioDriver.cs
Executable file
|
@ -0,0 +1,74 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRAudioDriver : MonoBehaviour
|
||||
{
|
||||
public AudioSource audioSource;
|
||||
[SerializeField]
|
||||
public List<AudioClip> audioClips = new List<AudioClip>();
|
||||
public int selectedAudioClip = 0;
|
||||
public bool playOnSwitch = true;
|
||||
|
||||
private int _selectedAudioClip = 0;
|
||||
|
||||
private void OnDidApplyAnimationProperties()
|
||||
{
|
||||
if (selectedAudioClip != _selectedAudioClip)
|
||||
{
|
||||
if(SetAudioClip(selectedAudioClip) && playOnSwitch) PlaySound();
|
||||
}
|
||||
}
|
||||
|
||||
private bool SetAudioClip(int index)
|
||||
{
|
||||
if (index < audioClips.Count)
|
||||
{
|
||||
if (audioClips[index] != null && audioSource != null)
|
||||
{
|
||||
audioSource.clip = audioClips[index];
|
||||
_selectedAudioClip = selectedAudioClip;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void PlaySound(int index)
|
||||
{
|
||||
if (SetAudioClip(index)) PlaySound();
|
||||
}
|
||||
public void PlaySound()
|
||||
{
|
||||
if (audioSource != null) audioSource.Play();
|
||||
}
|
||||
public void PlayNext()
|
||||
{
|
||||
if (_selectedAudioClip + 1 >= audioClips.Count)
|
||||
{
|
||||
PlaySound(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySound(_selectedAudioClip + 1);
|
||||
}
|
||||
}
|
||||
public void PlayPrev()
|
||||
{
|
||||
if (_selectedAudioClip == 0)
|
||||
{
|
||||
PlaySound(audioClips.Count - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySound(_selectedAudioClip - 1);
|
||||
}
|
||||
}
|
||||
public void SelectRandomSound()
|
||||
{
|
||||
if (SetAudioClip(Random.Range(0, audioClips.Count)) && playOnSwitch) PlaySound();
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRAudioDriver.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRAudioDriver.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0acbd238ff874a4daa35e52d4ac9d3cd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
48
Assets/ABI.CCK/Components/CVRAudioMaterialParser.cs
Executable file
48
Assets/ABI.CCK/Components/CVRAudioMaterialParser.cs
Executable file
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRAudioMaterialParser : MonoBehaviour
|
||||
{
|
||||
public bool useSeparateAudioSources = false;
|
||||
|
||||
public AudioSource sourceAudio;
|
||||
|
||||
public AudioSource sourceAudioL;
|
||||
public AudioSource sourceAudioR;
|
||||
|
||||
public enum AudioDataType
|
||||
{
|
||||
OutputData = 0,
|
||||
SpectrumData = 1
|
||||
}
|
||||
|
||||
public AudioDataType audioDataType = AudioDataType.OutputData;
|
||||
|
||||
public Material processingMaterial;
|
||||
|
||||
public int fragmentSize = 1024;
|
||||
|
||||
public string fragmentParameterNameL1 = "_leftSamples1";
|
||||
public string fragmentParameterNameL2 = "_leftSamples2";
|
||||
public string fragmentParameterNameL3 = "_leftSamples3";
|
||||
public string fragmentParameterNameL4 = "_leftSamples4";
|
||||
|
||||
public string fragmentParameterNameR1 = "_rightSamples1";
|
||||
public string fragmentParameterNameR2 = "_rightSamples2";
|
||||
public string fragmentParameterNameR3 = "_rightSamples3";
|
||||
public string fragmentParameterNameR4 = "_rightSamples4";
|
||||
|
||||
public string volumeParameterName = "_volume";
|
||||
public string distanceParameterName = "_distance";
|
||||
public string pitchParameterName = "_pitch";
|
||||
public string dopplerParameterName = "_doppler";
|
||||
public string spatialParameterName = "_spatial";
|
||||
|
||||
private void Start()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRAudioMaterialParser.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRAudioMaterialParser.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1e1ae130a2a14040bfe48ff6f5b7fd93
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
95
Assets/ABI.CCK/Components/CVRAvatar.cs
Executable file
95
Assets/ABI.CCK/Components/CVRAvatar.cs
Executable file
|
@ -0,0 +1,95 @@
|
|||
using System.Collections.Generic;
|
||||
using ABI.CCK.Scripts;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
[RequireComponent(typeof(CVRAssetInfo))]
|
||||
[RequireComponent(typeof(Animator))]
|
||||
[ExecuteInEditMode]
|
||||
public class CVRAvatar : MonoBehaviour
|
||||
{
|
||||
public enum CVRAvatarVoiceParent
|
||||
{
|
||||
Head = 0,
|
||||
LeftHand = 2,
|
||||
RightHand = 3,
|
||||
Hips = 4
|
||||
}
|
||||
|
||||
[Space] [Header("General avatar settings")] [Space]
|
||||
public Vector3 viewPosition = new Vector3(0, 0.1f, 0);
|
||||
public Vector3 voicePosition = new Vector3(0, 0.1f, 0);
|
||||
public CVRAvatarVoiceParent voiceParent = CVRAvatarVoiceParent.Head;
|
||||
public bool useEyeMovement = true;
|
||||
public bool useBlinkBlendshapes;
|
||||
public bool useVisemeLipsync;
|
||||
public SkinnedMeshRenderer bodyMesh;
|
||||
|
||||
public string[] blinkBlendshape = new string[4];
|
||||
|
||||
public enum CVRAvatarVisemeMode
|
||||
{
|
||||
Visemes = 0,
|
||||
SingleBlendshape = 1,
|
||||
JawBone = 2
|
||||
}
|
||||
|
||||
public CVRAvatarVisemeMode visemeMode = CVRAvatarVisemeMode.Visemes;
|
||||
|
||||
public string[] visemeBlendshapes = new string[15];
|
||||
|
||||
[Space] [Header("Avatar customization")] [Space]
|
||||
public AnimatorOverrideController overrides;
|
||||
|
||||
public bool enableAdvancedTagging = false;
|
||||
public List<CVRAvatarAdvancedTaggingEntry> advancedTaggingList = new List<CVRAvatarAdvancedTaggingEntry>();
|
||||
|
||||
public bool avatarUsesAdvancedSettings = false;
|
||||
public CVRAdvancedAvatarSettings avatarSettings = null;
|
||||
|
||||
void OnDrawGizmosSelected()
|
||||
{
|
||||
var scale = transform.localScale;
|
||||
scale.x = 1 / scale.x;
|
||||
scale.y = 1 / scale.y;
|
||||
scale.z = 1 / scale.z;
|
||||
|
||||
Gizmos.color = Color.green;
|
||||
Gizmos.DrawSphere(transform.TransformPoint(Vector3.Scale(viewPosition, scale)), 0.01f);
|
||||
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawSphere(transform.TransformPoint(Vector3.Scale(voicePosition, scale)), 0.01f);
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
CVRAssetInfo info = gameObject.GetComponent<CVRAssetInfo>();
|
||||
info.type = CVRAssetInfo.AssetType.Avatar;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class CVRAvatarAdvancedTaggingEntry
|
||||
{
|
||||
public enum Tags
|
||||
{
|
||||
LoudAudio = 1,
|
||||
LongRangeAudio = 2,
|
||||
ScreenFx = 4,
|
||||
FlashingColors = 8,
|
||||
FlashingLights = 16,
|
||||
Violence = 32,
|
||||
Gore = 64,
|
||||
//Suggestive = 128,
|
||||
//Nudity = 256,
|
||||
Horror = 512
|
||||
}
|
||||
|
||||
public Tags tags = 0;
|
||||
|
||||
public GameObject gameObject;
|
||||
public GameObject fallbackGameObject;
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRAvatar.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRAvatar.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e197bf28ecd22dd4ea1528dbc81dfe70
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
27
Assets/ABI.CCK/Components/CVRAvatarPickupMarker.cs
Executable file
27
Assets/ABI.CCK/Components/CVRAvatarPickupMarker.cs
Executable file
|
@ -0,0 +1,27 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRAvatarPickupMarker : MonoBehaviour
|
||||
{
|
||||
public string avatarGuid;
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
Gizmos.color = Color.magenta;
|
||||
Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, transform.lossyScale);
|
||||
Gizmos.matrix = rotationMatrix;
|
||||
Gizmos.DrawWireCube(new Vector3(0, 0.75f, 0), new Vector3(1f, 1.5f, 0f));
|
||||
|
||||
Gizmos.DrawWireCube(new Vector3(0, 0.7f, 0), new Vector3(0.8f, 0.1f, 0f));
|
||||
Gizmos.DrawWireCube(new Vector3(0, 0.615f, 0), new Vector3(0.6f, 0.07f, 0f));
|
||||
Gizmos.DrawWireCube(new Vector3(0.24f, 0.28f, 0), new Vector3(0.32f, 0.42f, 0f));
|
||||
Gizmos.DrawWireCube(new Vector3(-0.24f, 0.28f, 0), new Vector3(0.32f, 0.42f, 0f));
|
||||
var scale = transform.lossyScale;
|
||||
scale.Scale(new Vector3(1f, 1f, 0f));
|
||||
rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, scale);
|
||||
Gizmos.matrix = rotationMatrix;
|
||||
Gizmos.DrawWireSphere(new Vector3(0, 1.11f, 0), 0.31f);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRAvatarPickupMarker.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRAvatarPickupMarker.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8c707f0c2d4140d095b500de7833c2cc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
9
Assets/ABI.CCK/Components/CVRBlitter.cs
Executable file
9
Assets/ABI.CCK/Components/CVRBlitter.cs
Executable file
|
@ -0,0 +1,9 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class CVRBlitter : MonoBehaviour
|
||||
{
|
||||
[SerializeField] RenderTexture originTexture = null;
|
||||
[SerializeField] RenderTexture destinationTexture = null;
|
||||
[SerializeField] Material blitMaterial = null;
|
||||
public bool clearEveryFrame;
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRBlitter.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRBlitter.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c7bbfe1a8e1c03b43a00c3f0d58f981f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
19
Assets/ABI.CCK/Components/CVRBuilderSpawnable.cs
Executable file
19
Assets/ABI.CCK/Components/CVRBuilderSpawnable.cs
Executable file
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRBuilderSpawnable : MonoBehaviour
|
||||
{
|
||||
private void Reset()
|
||||
{
|
||||
if (GetComponent<CVRSpawnable>() != null)
|
||||
{
|
||||
Invoke("DestroyThis", 0);
|
||||
}
|
||||
}
|
||||
void DestroyThis() {
|
||||
DestroyImmediate(this);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRBuilderSpawnable.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRBuilderSpawnable.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8bf3cee607da4c1bac3976711609c971
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
19
Assets/ABI.CCK/Components/CVRCameraHelper.cs
Executable file
19
Assets/ABI.CCK/Components/CVRCameraHelper.cs
Executable file
|
@ -0,0 +1,19 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRCameraHelper : MonoBehaviour
|
||||
{
|
||||
public Camera cam;
|
||||
public bool setAsMirroringCamera;
|
||||
|
||||
public List<Shader> replacementShaders = new List<Shader>();
|
||||
public int selectedShader = -1;
|
||||
|
||||
public void TakeScreenshot()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRCameraHelper.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRCameraHelper.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 38ae5c1f207c427a882d4d278bc76b33
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
16
Assets/ABI.CCK/Components/CVRCustomRenderTextureUpdater.cs
Executable file
16
Assets/ABI.CCK/Components/CVRCustomRenderTextureUpdater.cs
Executable file
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.PlayerLoop;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRCustomRenderTextureUpdater : MonoBehaviour
|
||||
{
|
||||
public CustomRenderTexture customRenderTexture;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
customRenderTexture.Update();
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRCustomRenderTextureUpdater.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRCustomRenderTextureUpdater.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0b14e438db1847868a21c1a31f0200b3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
12
Assets/ABI.CCK/Components/CVRDescription.cs
Executable file
12
Assets/ABI.CCK/Components/CVRDescription.cs
Executable file
|
@ -0,0 +1,12 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRDescription : MonoBehaviour
|
||||
{
|
||||
public string description;
|
||||
public string url;
|
||||
public bool locked = false;
|
||||
public int type = 0;
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRDescription.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRDescription.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: edc847c3525e44118a56bf95486e228c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
70
Assets/ABI.CCK/Components/CVRDistanceConstrain.cs
Executable file
70
Assets/ABI.CCK/Components/CVRDistanceConstrain.cs
Executable file
|
@ -0,0 +1,70 @@
|
|||
using System.ComponentModel;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
[AddComponentMenu("Scripts/CVR Distance Constraint")]
|
||||
public class CVRDistanceConstrain : MonoBehaviour
|
||||
{
|
||||
public Transform target;
|
||||
public float minDistance = 0;
|
||||
public float maxDistance = 0;
|
||||
|
||||
[ReadOnly]
|
||||
[SerializeField]
|
||||
private float currentDistance = 0f;
|
||||
|
||||
public void OnDrawGizmosSelected()
|
||||
{
|
||||
if (target == null) return;
|
||||
|
||||
if (maxDistance < minDistance && maxDistance != 0f) return;
|
||||
|
||||
Vector3 direction = (transform.position - target.position).normalized;
|
||||
|
||||
if (minDistance == 0)
|
||||
{
|
||||
if (maxDistance == 0)
|
||||
{
|
||||
Gizmos.color = Color.green;
|
||||
Gizmos.DrawRay(target.position, direction * 9999f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gizmos.color = Color.green;
|
||||
Gizmos.DrawLine(target.position, target.position + direction * maxDistance);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (maxDistance == 0)
|
||||
{
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawLine(target.position, target.position + direction * minDistance);
|
||||
Gizmos.color = Color.green;
|
||||
Gizmos.DrawRay(target.position + direction * minDistance, direction * 9999f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawLine(target.position, target.position + direction * minDistance);
|
||||
Gizmos.color = Color.green;
|
||||
Gizmos.DrawLine(target.position + direction * minDistance, target.position + direction * maxDistance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
currentDistance = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDistance = Vector3.Distance(transform.position, target.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRDistanceConstrain.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRDistanceConstrain.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a65db7e52b5148fcbd0aee531a310878
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
42
Assets/ABI.CCK/Components/CVRDistanceLod.cs
Executable file
42
Assets/ABI.CCK/Components/CVRDistanceLod.cs
Executable file
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRDistanceLod : MonoBehaviour
|
||||
{
|
||||
public bool distance3D = false;
|
||||
public List<CVRDistanceLodGroup> Groups = new List<CVRDistanceLodGroup>();
|
||||
|
||||
private static Color[] _gizmoColors = new Color[] { Color.green, Color.yellow, Color.red, Color.white };
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
if (!distance3D)
|
||||
{
|
||||
Gizmos.matrix = Matrix4x4.TRS(transform.position, Quaternion.identity, new Vector3(1f, 0f, 1f));
|
||||
}
|
||||
else
|
||||
{
|
||||
Gizmos.matrix = Matrix4x4.TRS(transform.position, Quaternion.identity, Vector3.one);
|
||||
}
|
||||
|
||||
var i = 0;
|
||||
foreach (var group in Groups)
|
||||
{
|
||||
Gizmos.color = _gizmoColors[Math.Min(i, 3)];
|
||||
Gizmos.DrawWireSphere(Vector3.zero, group.MaxDistance);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class CVRDistanceLodGroup
|
||||
{
|
||||
public GameObject GameObject;
|
||||
public float MinDistance;
|
||||
public float MaxDistance;
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRDistanceLod.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRDistanceLod.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d2671fd98209432cb55b51e323e54140
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
59
Assets/ABI.CCK/Components/CVRFaceTracking.cs
Executable file
59
Assets/ABI.CCK/Components/CVRFaceTracking.cs
Executable file
|
@ -0,0 +1,59 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRFaceTracking : MonoBehaviour
|
||||
{
|
||||
public bool UseFacialTracking = true;
|
||||
public float BlendShapeStrength = 100f;
|
||||
public SkinnedMeshRenderer FaceMesh;
|
||||
public string[] FaceBlendShapes = new string[37];
|
||||
|
||||
public Mesh OriginalMesh = null;
|
||||
[HideInInspector]
|
||||
public List<string> BlendShapeNames = null;
|
||||
[HideInInspector]
|
||||
public static string[] FaceBlendShapeNames = new[] {"Jaw_Right", "Jaw_Left", "Jaw_Forward", "Jaw_Open",
|
||||
"Mouth_Ape_Shape", "Mouth_Upper_Right", "Mouth_Upper_Left", "Mouth_Lower_Right", "Mouth_Lower_Left",
|
||||
"Mouth_Upper_Overturn", "Mouth_Lower_Overturn", "Mouth_Pout", "Mouth_Smile_Right", "Mouth_Smile_Left",
|
||||
"Mouth_Sad_Right", "Mouth_Sad_Left", "Cheek_Puff_Right", "Cheek_Puff_Left", "Cheek_Suck",
|
||||
"Mouth_Upper_UpRight", "Mouth_Upper_UpLeft", "Mouth_Lower_DownRight", "Mouth_Lower_DownLeft",
|
||||
"Mouth_Upper_Inside", "Mouth_Lower_Inside", "Mouth_Lower_Overlay", "Tongue_LongStep1", "Tongue_LongStep2",
|
||||
"Tongue_Down", "Tongue_Up", "Tongue_Right", "Tongue_Left", "Tongue_Roll", "Tongue_UpLeft_Morph",
|
||||
"Tongue_UpRight_Morph", "Tongue_DownLeft_Morph", "Tongue_DownRight_Morph"};
|
||||
|
||||
public bool enableOverdriveBlendShapes = false;
|
||||
|
||||
public void GetBlendShapeNames()
|
||||
{
|
||||
if (FaceMesh != null)
|
||||
{
|
||||
BlendShapeNames = new List<string>();
|
||||
BlendShapeNames.Add("-none-");
|
||||
for (int i = 0; i < FaceMesh.sharedMesh.blendShapeCount; ++i)
|
||||
BlendShapeNames.Add(FaceMesh.sharedMesh.GetBlendShapeName(i));
|
||||
}
|
||||
else
|
||||
{
|
||||
BlendShapeNames = new List<string>();
|
||||
BlendShapeNames.Add("-none-");
|
||||
}
|
||||
}
|
||||
|
||||
public void FindVisemes()
|
||||
{
|
||||
for (int i = 0; i < FaceBlendShapeNames.Length; i++)
|
||||
{
|
||||
for (int j = 0; j < BlendShapeNames.Count; ++j)
|
||||
{
|
||||
if (BlendShapeNames[j].ToLower().Contains(FaceBlendShapeNames[i].ToLower()) ||
|
||||
BlendShapeNames[j].ToLower().Contains(FaceBlendShapeNames[i].ToLower().Replace("_", "")))
|
||||
{
|
||||
FaceBlendShapes[i] = BlendShapeNames[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRFaceTracking.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRFaceTracking.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 644a460ac674462b9f3cedc3e47e4e9e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
23
Assets/ABI.CCK/Components/CVRGIMaterialUpdater.cs
Executable file
23
Assets/ABI.CCK/Components/CVRGIMaterialUpdater.cs
Executable file
|
@ -0,0 +1,23 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
[RequireComponent(typeof(Renderer))]
|
||||
public class CVRGIMaterialUpdater : MonoBehaviour
|
||||
{
|
||||
[SerializeField] bool updateEveryFrame;
|
||||
private Renderer _renderer;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_renderer = GetComponent<Renderer>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_renderer == null || !updateEveryFrame) return;
|
||||
_renderer.UpdateGIMaterials();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRGIMaterialUpdater.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRGIMaterialUpdater.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6dd3336019292b4408db3891856207db
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
32
Assets/ABI.CCK/Components/CVRGlobalMaterialPropertyUpdater.cs
Executable file
32
Assets/ABI.CCK/Components/CVRGlobalMaterialPropertyUpdater.cs
Executable file
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRGlobalMaterialPropertyUpdater : MonoBehaviour
|
||||
{
|
||||
public Material material;
|
||||
|
||||
public enum PropertyType
|
||||
{
|
||||
paramInt = 0,
|
||||
paramFloat = 1,
|
||||
paramVector4 = 2
|
||||
}
|
||||
|
||||
public string propertyName;
|
||||
|
||||
public PropertyType propertyType = PropertyType.paramFloat;
|
||||
|
||||
public int intValue;
|
||||
|
||||
public float floatValue;
|
||||
|
||||
public Vector4 vector4Value;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRGlobalMaterialPropertyUpdater.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRGlobalMaterialPropertyUpdater.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 091ca3dff91045a8b8da69ddde772e2a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
25
Assets/ABI.CCK/Components/CVRGlobalShaderUpdater.cs
Executable file
25
Assets/ABI.CCK/Components/CVRGlobalShaderUpdater.cs
Executable file
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRGlobalShaderUpdater : MonoBehaviour
|
||||
{
|
||||
public bool updateValues = true;
|
||||
|
||||
public Vector4 CVR_CCK_Global_1 = Vector4.zero;
|
||||
public Vector4 CVR_CCK_Global_2 = Vector4.zero;
|
||||
public Vector4 CVR_CCK_Global_3 = Vector4.zero;
|
||||
public Vector4 CVR_CCK_Global_4 = Vector4.zero;
|
||||
|
||||
public bool updateTexture = false;
|
||||
|
||||
public RenderTexture renderTexture;
|
||||
public string propertyName;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRGlobalShaderUpdater.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRGlobalShaderUpdater.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 293555ef6a1d479c877910b6e1ef8961
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
85
Assets/ABI.CCK/Components/CVRHapticAreaChest.cs
Executable file
85
Assets/ABI.CCK/Components/CVRHapticAreaChest.cs
Executable file
|
@ -0,0 +1,85 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRHapticAreaChest : MonoBehaviour
|
||||
{
|
||||
public Vector3 chestAreaSize = new Vector3(0.05f, 0.05f, 0.05f);
|
||||
|
||||
[HideInInspector]
|
||||
public Vector3[] HapticPoints40 = new []
|
||||
{
|
||||
new Vector3(-0.75f, 0.8f, 1f),
|
||||
new Vector3(-0.25f, 0.8f, 1f),
|
||||
new Vector3(0.25f, 0.8f, 1f),
|
||||
new Vector3(0.75f, 0.8f, 1f),
|
||||
|
||||
new Vector3(-0.75f, 0.4f, 1f),
|
||||
new Vector3(-0.25f, 0.4f, 1f),
|
||||
new Vector3(0.25f, 0.4f, 1f),
|
||||
new Vector3(0.75f, 0.4f, 1f),
|
||||
|
||||
new Vector3(-0.75f, 0f, 1f),
|
||||
new Vector3(-0.25f, 0f, 1f),
|
||||
new Vector3(0.25f, 0f, 1f),
|
||||
new Vector3(0.75f, 0f, 1f),
|
||||
|
||||
new Vector3(-0.75f, -0.4f, 1f),
|
||||
new Vector3(-0.25f, -0.4f, 1f),
|
||||
new Vector3(0.25f, -0.4f, 1f),
|
||||
new Vector3(0.75f, -0.4f, 1f),
|
||||
|
||||
new Vector3(-0.75f, -0.8f, 1f),
|
||||
new Vector3(-0.25f, -0.8f, 1f),
|
||||
new Vector3(0.25f, -0.8f, 1f),
|
||||
new Vector3(0.75f, -0.8f, 1f),
|
||||
|
||||
new Vector3(-0.75f, 0.8f, -1f),
|
||||
new Vector3(-0.25f, 0.8f, -1f),
|
||||
new Vector3(0.25f, 0.8f, -1f),
|
||||
new Vector3(0.75f, 0.8f, -1f),
|
||||
|
||||
new Vector3(-0.75f, 0.4f, -1f),
|
||||
new Vector3(-0.25f, 0.4f, -1f),
|
||||
new Vector3(0.25f, 0.4f, -1f),
|
||||
new Vector3(0.75f, 0.4f, -1f),
|
||||
|
||||
new Vector3(-0.75f, 0f, -1f),
|
||||
new Vector3(-0.25f, 0f, -1f),
|
||||
new Vector3(0.25f, 0f, -1f),
|
||||
new Vector3(0.75f, 0f, -1f),
|
||||
|
||||
new Vector3(-0.75f, -0.4f, -1f),
|
||||
new Vector3(-0.25f, -0.4f, -1f),
|
||||
new Vector3(0.25f, -0.4f, -1f),
|
||||
new Vector3(0.75f, -0.4f, -1f),
|
||||
|
||||
new Vector3(-0.75f, -0.8f, -1f),
|
||||
new Vector3(-0.25f, -0.8f, -1f),
|
||||
new Vector3(0.25f, -0.8f, -1f),
|
||||
new Vector3(0.75f, -0.8f, -1f),
|
||||
};
|
||||
|
||||
[HideInInspector]
|
||||
public int selectedPoint = -1;
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
if (isActiveAndEnabled)
|
||||
{
|
||||
Gizmos.color = Color.yellow;
|
||||
Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, transform.lossyScale);
|
||||
Gizmos.matrix = rotationMatrix;
|
||||
Gizmos.DrawWireCube(Vector3.zero, chestAreaSize);
|
||||
|
||||
foreach (var point in HapticPoints40)
|
||||
{
|
||||
var localPoint = point;
|
||||
localPoint.Scale(chestAreaSize * 0.5f);
|
||||
|
||||
Gizmos.DrawWireCube(localPoint, new Vector3(0.01f, 0.01f, 0.01f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRHapticAreaChest.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRHapticAreaChest.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: df887164a20042b3a4f5cfa9e8975d32
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
51
Assets/ABI.CCK/Components/CVRHapticZone.cs
Executable file
51
Assets/ABI.CCK/Components/CVRHapticZone.cs
Executable file
|
@ -0,0 +1,51 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRHapticZone : MonoBehaviour
|
||||
{
|
||||
public enum TriggerForm
|
||||
{
|
||||
Box = 1,
|
||||
Sphere = 2
|
||||
}
|
||||
|
||||
public TriggerForm triggerForm = TriggerForm.Box;
|
||||
|
||||
public Vector3 center = Vector3.zero;
|
||||
public Vector3 bounds = Vector3.one;
|
||||
|
||||
public enum TriggerTiming
|
||||
{
|
||||
once = 1,
|
||||
continuous = 2,
|
||||
random = 3
|
||||
}
|
||||
|
||||
public bool enableOnEnter = false;
|
||||
public float onEnterIntensity = 0.2f;
|
||||
|
||||
public bool enableOnStay = false;
|
||||
public float onStayIntensity = 0.2f;
|
||||
public TriggerTiming onStayTiming = TriggerTiming.continuous;
|
||||
public float onStayChance = 0.1f;
|
||||
|
||||
public bool enableOnExit = false;
|
||||
public float onExitIntensity = 0.2f;
|
||||
|
||||
public void OnDrawGizmos()
|
||||
{
|
||||
Gizmos.color = Color.yellow;
|
||||
Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, transform.lossyScale);
|
||||
Gizmos.matrix = rotationMatrix;
|
||||
if (triggerForm == TriggerForm.Box)
|
||||
{
|
||||
Gizmos.DrawWireCube(center, bounds);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gizmos.DrawWireSphere(center, bounds.x);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRHapticZone.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRHapticZone.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: aaa0f509044f4ebc9d20e15d89a303e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
113
Assets/ABI.CCK/Components/CVRInteractable.cs
Executable file
113
Assets/ABI.CCK/Components/CVRInteractable.cs
Executable file
|
@ -0,0 +1,113 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
[System.Serializable]
|
||||
public class CVRInteractable : MonoBehaviour
|
||||
{
|
||||
public string tooltip;
|
||||
public List<CVRInteractableAction> actions = new List<CVRInteractableAction>();
|
||||
|
||||
public UnityEvent onEnterSeat;
|
||||
public UnityEvent onExitSeat;
|
||||
|
||||
public void CustomTrigger()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
foreach (var action in actions)
|
||||
{
|
||||
foreach (var operation in action.operations)
|
||||
{
|
||||
if (operation.type == CVRInteractableActionOperation.ActionType.TeleportPlayer)
|
||||
{
|
||||
Gizmos.color = Color.green;
|
||||
if(operation.gameObjectVal == null) continue;
|
||||
Gizmos.DrawLine(transform.position, operation.gameObjectVal.transform.position);
|
||||
DrawArrow(operation.gameObjectVal.transform.position, new Vector3(0, operation.gameObjectVal.transform.eulerAngles.y, 0), 1);
|
||||
}
|
||||
|
||||
if (operation.type == CVRInteractableActionOperation.ActionType.SitAtPosition)
|
||||
{
|
||||
Gizmos.color = Color.blue;
|
||||
if(operation.targets.Count > 0 && operation.targets[0] == null) continue;
|
||||
Gizmos.DrawLine(transform.position, operation.targets[0].transform.position);
|
||||
DrawArrow(operation.targets[0].transform.position, new Vector3(0, operation.targets[0].transform.eulerAngles.y, 0), 0.5f);
|
||||
|
||||
if (operation.gameObjectVal == null) continue;
|
||||
var position = operation.gameObjectVal.transform;
|
||||
Gizmos.DrawLine(transform.position, position.position);
|
||||
Matrix4x4 rotationMatrix = Matrix4x4.TRS(position.position, position.rotation, Vector3.one);
|
||||
Gizmos.matrix = rotationMatrix;
|
||||
Gizmos.DrawWireCube(new Vector3(+0.12f, -0.2f, 0.05f), new Vector3(0.1f, 0.4f, 0.1f));
|
||||
Gizmos.DrawWireCube(new Vector3(-0.12f, -0.2f, 0.05f), new Vector3(0.1f, 0.4f, 0.1f));
|
||||
Gizmos.DrawWireCube(new Vector3(+0.12f, 0.05f, -0.2f), new Vector3(0.1f, 0.1f, 0.6f));
|
||||
Gizmos.DrawWireCube(new Vector3(-0.12f, 0.05f, -0.2f), new Vector3(0.1f, 0.1f, 0.6f));
|
||||
Gizmos.DrawWireCube(new Vector3(0f, 0.4f, -0.4f), new Vector3(0.34f, 0.6f, 0.2f));
|
||||
Gizmos.DrawWireCube(new Vector3(0f, 0.8f, -0.4f), new Vector3(0.2f, 0.2f, 0.2f));
|
||||
Gizmos.DrawWireCube(new Vector3(+0.22f, 0.4f, -0.4f), new Vector3(0.1f, 0.4f, 0.1f));
|
||||
Gizmos.DrawWireCube(new Vector3(-0.22f, 0.4f, -0.4f), new Vector3(0.1f, 0.4f, 0.1f));
|
||||
Gizmos.DrawWireCube(new Vector3(+0.22f, 0.25f, -0.2f), new Vector3(0.1f, 0.1f, 0.3f));
|
||||
Gizmos.DrawWireCube(new Vector3(-0.22f, 0.25f, -0.2f), new Vector3(0.1f, 0.1f, 0.3f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawArrow(Vector3 position, Vector3 angle, float size)
|
||||
{
|
||||
var a1 = position + new Vector3(0, 0.1f * size, 0);
|
||||
var a2 = RotatePointAroundPivot(position + new Vector3(0.1f * size, 0, 0), position, angle);
|
||||
var a3 = position + new Vector3(0, -0.1f * size, 0);
|
||||
var a4 = RotatePointAroundPivot(position + new Vector3(-0.1f * size, 0, 0), position, angle);
|
||||
|
||||
var b1 = RotatePointAroundPivot(position + new Vector3(0, 0.1f * size, 0.3f * size), position, angle);
|
||||
var b2 = RotatePointAroundPivot(position + new Vector3(0.1f * size, 0, 0.3f * size), position, angle);
|
||||
var b3 = RotatePointAroundPivot(position + new Vector3(0, -0.1f * size, 0.3f * size), position, angle);
|
||||
var b4 = RotatePointAroundPivot(position + new Vector3(-0.1f * size, 0, 0.3f * size), position, angle);
|
||||
|
||||
var c1 = RotatePointAroundPivot(position + new Vector3(0, 0.2f * size, 0.3f * size), position, angle);
|
||||
var c2 = RotatePointAroundPivot(position + new Vector3(0.2f * size, 0, 0.3f * size), position, angle);
|
||||
var c3 = RotatePointAroundPivot(position + new Vector3(0, -0.2f * size, 0.3f * size), position, angle);
|
||||
var c4 = RotatePointAroundPivot(position + new Vector3(-0.2f * size, 0, 0.3f * size), position, angle);
|
||||
|
||||
var d = RotatePointAroundPivot(position + new Vector3(0, 0, 0.5f * size), position, angle);
|
||||
|
||||
Gizmos.DrawLine(position, a1);
|
||||
Gizmos.DrawLine(position, a2);
|
||||
Gizmos.DrawLine(position, a3);
|
||||
Gizmos.DrawLine(position, a4);
|
||||
|
||||
Gizmos.DrawLine(a1, b1);
|
||||
Gizmos.DrawLine(a2, b2);
|
||||
Gizmos.DrawLine(a3, b3);
|
||||
Gizmos.DrawLine(a4, b4);
|
||||
|
||||
Gizmos.DrawLine(b1, c1);
|
||||
Gizmos.DrawLine(b2, c2);
|
||||
Gizmos.DrawLine(b3, c3);
|
||||
Gizmos.DrawLine(b4, c4);
|
||||
|
||||
Gizmos.DrawLine(c1, d);
|
||||
Gizmos.DrawLine(c2, d);
|
||||
Gizmos.DrawLine(c3, d);
|
||||
Gizmos.DrawLine(c4, d);
|
||||
}
|
||||
|
||||
private Vector3 RotatePointAroundPivot(Vector3 point, Vector3 pivot, Vector3 angles)
|
||||
{
|
||||
var dir = point - pivot; // get point direction relative to pivot
|
||||
dir = Quaternion.Euler(angles) * dir; // rotate it
|
||||
point = dir + pivot; // calculate rotated point
|
||||
return point; // return it
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRInteractable.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRInteractable.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a45fb99111d54dba84a8ff33016b93fd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
159
Assets/ABI.CCK/Components/CVRInteractableAction.cs
Executable file
159
Assets/ABI.CCK/Components/CVRInteractableAction.cs
Executable file
|
@ -0,0 +1,159 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
[System.Serializable]
|
||||
public class CVRInteractableAction
|
||||
{
|
||||
public enum ActionRegister
|
||||
{
|
||||
OnGrab = 1,
|
||||
OnDrop = 2,
|
||||
OnInteractDown = 3,
|
||||
OnInteractUp = 4,
|
||||
OnEnterTrigger = 5,
|
||||
OnExitTrigger = 6,
|
||||
OnEnterCollider = 7,
|
||||
OnExitCollider = 8,
|
||||
OnEnable = 9,
|
||||
OnDisable = 10,
|
||||
OnTimer = 11,
|
||||
OnParticleHit = 12,
|
||||
OnVariableBufferUpdate = 13,
|
||||
OnVariableBufferComparision = 14,
|
||||
OnCron = 15,
|
||||
OnPointerEnter = 16,
|
||||
OnWorldTrigger = 17,
|
||||
OnCustomTrigger = 18,
|
||||
OnInputDown = 19,
|
||||
OnInputUp = 20,
|
||||
OnAPFTrigger = 21,
|
||||
OnAPFBoolChange = 22,
|
||||
OnAPFIntChange = 23,
|
||||
OnAPFFloatChange = 24,
|
||||
OnAPFStringChange = 27,
|
||||
OnGazeEnter = 25,
|
||||
OnGazeExit = 26
|
||||
}
|
||||
|
||||
public enum ExecutionType
|
||||
{
|
||||
LocalNotNetworked = 1,
|
||||
GlobalNetworked = 2,
|
||||
GlobalNetworkedBuffered = 4,
|
||||
GlobalInstanceOwnerOnly = 3,
|
||||
GlobalInstanceOwnerOnlyBuffered = 5,
|
||||
GlobalNetworkedAllInstanceModerators = 6,
|
||||
GlobalNetworkedAllInstanceModeratorsBuffered = 7
|
||||
}
|
||||
|
||||
public float delay = 0f;
|
||||
|
||||
public List<CVRInteractableActionOperation> operations = new List<CVRInteractableActionOperation>();
|
||||
|
||||
public ActionRegister actionType = ActionRegister.OnInteractDown;
|
||||
public ExecutionType execType = ExecutionType.GlobalNetworked;
|
||||
|
||||
public LayerMask layerMask = 0;
|
||||
|
||||
public float floatVal = 0;
|
||||
public float floatVal2 = 0;
|
||||
public float floatVal3 = 0;
|
||||
public bool boolVal;
|
||||
public CVRVariableBuffer varBufferVal;
|
||||
public CVRVariableBuffer varBufferVal2;
|
||||
public string stringVal = "";
|
||||
|
||||
public List<CVRPointer> allowedPointer = new List<CVRPointer>();
|
||||
public bool allowedPointerCollapse = false;
|
||||
public List<string> allowedTypes = new List<string>();
|
||||
public bool allowedTypesCollapse = false;
|
||||
|
||||
public List<ParticleSystem> specificParticleSystems = new List<ParticleSystem>();
|
||||
public bool specificParticleSystemsCollapse = false;
|
||||
|
||||
public enum InteractionFilter
|
||||
{
|
||||
Global = 0,
|
||||
Looking = 1,
|
||||
Attached = 2,
|
||||
Held = 3,
|
||||
Sitting = 4
|
||||
}
|
||||
|
||||
public InteractionFilter interactionFilter = InteractionFilter.Global;
|
||||
|
||||
public enum InteractionInput
|
||||
{
|
||||
A = KeyCode.A,
|
||||
B = KeyCode.B,
|
||||
C = KeyCode.C,
|
||||
D = KeyCode.D,
|
||||
E = KeyCode.E,
|
||||
F = KeyCode.F,
|
||||
G = KeyCode.G,
|
||||
H = KeyCode.H,
|
||||
I = KeyCode.I,
|
||||
J = KeyCode.J,
|
||||
K = KeyCode.K,
|
||||
L = KeyCode.L,
|
||||
M = KeyCode.M,
|
||||
N = KeyCode.N,
|
||||
O = KeyCode.O,
|
||||
P = KeyCode.P,
|
||||
Q = KeyCode.Q,
|
||||
R = KeyCode.R,
|
||||
S = KeyCode.S,
|
||||
T = KeyCode.T,
|
||||
U = KeyCode.U,
|
||||
V = KeyCode.V,
|
||||
W = KeyCode.W,
|
||||
X = KeyCode.X,
|
||||
Y = KeyCode.Y,
|
||||
Z = KeyCode.Z,
|
||||
Alpha0 = KeyCode.Alpha0,
|
||||
Alpha1 = KeyCode.Alpha1,
|
||||
Alpha2 = KeyCode.Alpha2,
|
||||
Alpha3 = KeyCode.Alpha3,
|
||||
Alpha4 = KeyCode.Alpha4,
|
||||
Alpha5 = KeyCode.Alpha5,
|
||||
Alpha6 = KeyCode.Alpha6,
|
||||
Alpha7 = KeyCode.Alpha7,
|
||||
Alpha8 = KeyCode.Alpha8,
|
||||
Alpha9 = KeyCode.Alpha9,
|
||||
InputHorizontalNegative = 10000,
|
||||
InputHorizontalPositive = 10001,
|
||||
InputVerticalNegative = 10002,
|
||||
InputVerticalPositive = 10003,
|
||||
InputJump = 10004,
|
||||
InputAccelerate = 10005,
|
||||
InputBrake = 10006,
|
||||
InputLeftClick = 10007,
|
||||
InputRightClick = 10008
|
||||
}
|
||||
|
||||
public InteractionInput interactionInput = InteractionInput.Alpha0;
|
||||
|
||||
public enum InteractionInputModifier
|
||||
{
|
||||
LeftCtrl = 1,
|
||||
LeftShift = 2,
|
||||
LeftAlt = 4,
|
||||
RightCtrl = 8,
|
||||
RightShift = 16,
|
||||
RightAlt = 32
|
||||
}
|
||||
|
||||
public InteractionInputModifier interactionInputModifier = 0;
|
||||
|
||||
[HideInInspector]
|
||||
public string guid = "";
|
||||
|
||||
private bool IsInLayerMask(GameObject obj, LayerMask inLayerMask)
|
||||
{
|
||||
return ((inLayerMask.value & (1 << obj.layer)) > 0);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRInteractableAction.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRInteractableAction.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b087858572ff8724ea9a21c38c0b0d17
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
74
Assets/ABI.CCK/Components/CVRInteractableActionOperation.cs
Executable file
74
Assets/ABI.CCK/Components/CVRInteractableActionOperation.cs
Executable file
|
@ -0,0 +1,74 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
[System.Serializable]
|
||||
public class CVRInteractableActionOperation
|
||||
{
|
||||
public enum ActionType
|
||||
{
|
||||
SetGameObjectActive = 1,
|
||||
//SetComponentActive = 2,
|
||||
SetAnimatorFloatValue = 3,
|
||||
SetAnimatorBoolValue = 4,
|
||||
SetAnimatorIntValue = 17,
|
||||
TriggerAnimatorTrigger = 18,
|
||||
SpawnObject = 5,
|
||||
TeleportPlayer = 6,
|
||||
TeleportObject = 7,
|
||||
ToggleAnimatorBoolValue = 8,
|
||||
SetAnimatorFloatRandom = 9,
|
||||
SetAnimatorBoolRandom = 10,
|
||||
SetAnimatorIntRandom = 19,
|
||||
SetAnimatorFloatByVar = 11,
|
||||
SetAnimatorIntByVar = 20,
|
||||
VariableBufferArithmetic = 12,
|
||||
DisplayWorldDetailPage = 13,
|
||||
DisplayInstanceDetailPage = 14,
|
||||
DisplayAvatarDetailPage = 15,
|
||||
SitAtPosition = 16,
|
||||
MethodCall = 21,
|
||||
SetSpawnableValue = 22,
|
||||
PlayAudio = 23,
|
||||
StopAudio = 24,
|
||||
SetAnimatorBoolByAPF= 25,
|
||||
SetAnimatorIntByAPF = 26,
|
||||
SetAnimatorFloatByAPF = 27,
|
||||
SetVariableBufferByAPF= 28,
|
||||
UpdateAPFTrigger = 29,
|
||||
UpdateAPFBool = 30,
|
||||
UpdateAPFInt = 31,
|
||||
UpdateAPFFloat = 32,
|
||||
UpdateAPFString = 33,
|
||||
SetPropertyByApf = 34,
|
||||
SetPropertyByValue = 35,
|
||||
DeleteGameObject = 36,
|
||||
}
|
||||
|
||||
public ActionType type = ActionType.SetGameObjectActive;
|
||||
|
||||
public List<GameObject> targets = new List<GameObject>();
|
||||
|
||||
public float floatVal;
|
||||
public string stringVal;
|
||||
public string stringVal2;
|
||||
public string stringVal3;
|
||||
public string stringVal4;
|
||||
public bool boolVal;
|
||||
public bool boolVal2;
|
||||
public GameObject gameObjectVal;
|
||||
public float floatVal2 = 0f;
|
||||
public float floatVal3 = 0f;
|
||||
public float floatVal4 = 0f;
|
||||
public CVRVariableBuffer varBufferVal;
|
||||
public CVRVariableBuffer varBufferVal2;
|
||||
public CVRVariableBuffer varBufferVal3;
|
||||
public AnimationClip animationVal;
|
||||
|
||||
[SerializeField]
|
||||
public UnityEvent customEvent;
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRInteractableActionOperation.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRInteractableActionOperation.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c194b5d1b3df3d64c911aa02e124a3d5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
111
Assets/ABI.CCK/Components/CVRMaterialDriver.cs
Executable file
111
Assets/ABI.CCK/Components/CVRMaterialDriver.cs
Executable file
|
@ -0,0 +1,111 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRMaterialDriver : MonoBehaviour
|
||||
{
|
||||
public float material01X;
|
||||
public float material01Y;
|
||||
public float material01Z;
|
||||
public float material01W;
|
||||
|
||||
public float material02X;
|
||||
public float material02Y;
|
||||
public float material02Z;
|
||||
public float material02W;
|
||||
|
||||
public float material03X;
|
||||
public float material03Y;
|
||||
public float material03Z;
|
||||
public float material03W;
|
||||
|
||||
public float material04X;
|
||||
public float material04Y;
|
||||
public float material04Z;
|
||||
public float material04W;
|
||||
|
||||
public float material05X;
|
||||
public float material05Y;
|
||||
public float material05Z;
|
||||
public float material05W;
|
||||
|
||||
public float material06X;
|
||||
public float material06Y;
|
||||
public float material06Z;
|
||||
public float material06W;
|
||||
|
||||
public float material07X;
|
||||
public float material07Y;
|
||||
public float material07Z;
|
||||
public float material07W;
|
||||
|
||||
|
||||
public float material08X;
|
||||
public float material08Y;
|
||||
public float material08Z;
|
||||
public float material08W;
|
||||
|
||||
public float material09X;
|
||||
public float material09Y;
|
||||
public float material09Z;
|
||||
public float material09W;
|
||||
|
||||
public float material10X;
|
||||
public float material10Y;
|
||||
public float material10Z;
|
||||
public float material10W;
|
||||
|
||||
public float material11X;
|
||||
public float material11Y;
|
||||
public float material11Z;
|
||||
public float material11W;
|
||||
|
||||
public float material12X;
|
||||
public float material12Y;
|
||||
public float material12Z;
|
||||
public float material12W;
|
||||
|
||||
public float material13X;
|
||||
public float material13Y;
|
||||
public float material13Z;
|
||||
public float material13W;
|
||||
|
||||
public float material14X;
|
||||
public float material14Y;
|
||||
public float material14Z;
|
||||
public float material14W;
|
||||
|
||||
public float material15X;
|
||||
public float material15Y;
|
||||
public float material15Z;
|
||||
public float material15W;
|
||||
|
||||
public float material16X;
|
||||
public float material16Y;
|
||||
public float material16Z;
|
||||
public float material16W;
|
||||
|
||||
[HideInInspector]
|
||||
public List<CVRMaterialDriverTask> tasks = new List<CVRMaterialDriverTask>();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class CVRMaterialDriverTask
|
||||
{
|
||||
public Renderer Renderer;
|
||||
public int Index = 0;
|
||||
public string RendererType = "";
|
||||
public string PropertyName = "";
|
||||
public CVRMaterialDriverTask.Type PropertyType;
|
||||
|
||||
public enum Type
|
||||
{
|
||||
Float = 0,
|
||||
Vector4 = 1,
|
||||
Color = 2
|
||||
}
|
||||
|
||||
public Vector4 values;
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRMaterialDriver.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRMaterialDriver.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c34792c3273641a788f611267cb17273
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
51
Assets/ABI.CCK/Components/CVRMaterialUpdater.cs
Executable file
51
Assets/ABI.CCK/Components/CVRMaterialUpdater.cs
Executable file
|
@ -0,0 +1,51 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRMaterialUpdater : MonoBehaviour
|
||||
{
|
||||
public enum UpdateType
|
||||
{
|
||||
Update = 0,
|
||||
FixedUpdate = 1,
|
||||
}
|
||||
|
||||
public UpdateType updateType = UpdateType.Update;
|
||||
|
||||
private Renderer renderer;
|
||||
private Vector3 lastPos;
|
||||
private Vector3 velocity;
|
||||
private Vector3 lastRot;
|
||||
private Vector3 angularVelocity;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
renderer = GetComponent<Renderer>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (updateType == UpdateType.FixedUpdate || renderer == null) return;
|
||||
ProcessUpdate();
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (updateType == UpdateType.Update || renderer == null) return;
|
||||
ProcessUpdate();
|
||||
}
|
||||
|
||||
private void ProcessUpdate()
|
||||
{
|
||||
velocity = (lastPos - transform.position) / (updateType == UpdateType.Update?Time.deltaTime:Time.fixedDeltaTime);
|
||||
angularVelocity = transform.rotation.eulerAngles - lastRot;
|
||||
|
||||
renderer.material.SetVector("_CVR_Velocity", velocity);
|
||||
renderer.material.SetVector("_CVR_Angular_Velocity", angularVelocity);
|
||||
|
||||
lastPos = transform.position;
|
||||
lastRot = transform.rotation.eulerAngles;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRMaterialUpdater.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRMaterialUpdater.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1a227cecf8f446a7821c6a243f59dd3d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
25
Assets/ABI.CCK/Components/CVRMirror.cs
Executable file
25
Assets/ABI.CCK/Components/CVRMirror.cs
Executable file
|
@ -0,0 +1,25 @@
|
|||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#pragma warning disable
|
||||
|
||||
public class CVRMirror : MonoBehaviour
|
||||
{
|
||||
public bool m_DisablePixelLights = true;
|
||||
public int m_TextureSize = 256;
|
||||
public float m_ClipPlaneOffset = 0.07f;
|
||||
public int m_framesNeededToUpdate = 0;
|
||||
|
||||
public LayerMask m_ReflectLayers = -1;
|
||||
|
||||
private Dictionary<Camera, Camera> m_ReflectionCameras = new Dictionary<Camera, Camera>();
|
||||
|
||||
private RenderTexture m_ReflectionTextureLeft = null;
|
||||
private RenderTexture m_ReflectionTextureRight = null;
|
||||
private int m_OldReflectionTextureSize = 0;
|
||||
|
||||
private int m_frameCounter = 0;
|
||||
|
||||
private static bool s_InsideRendering = false;
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRMirror.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRMirror.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c3bb4181bdb9c2643b8ee5857a3b18ee
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/ABI.CCK/Components/CVRMovementParent.cs
Executable file
10
Assets/ABI.CCK/Components/CVRMovementParent.cs
Executable file
|
@ -0,0 +1,10 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRMovementParent : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRMovementParent.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRMovementParent.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4d5101e7f108ab74bb2f98b5203dfce3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
16
Assets/ABI.CCK/Components/CVRNavController.cs
Executable file
16
Assets/ABI.CCK/Components/CVRNavController.cs
Executable file
|
@ -0,0 +1,16 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRNavController : MonoBehaviour
|
||||
{
|
||||
public NavMeshAgent navMeshAgent;
|
||||
public Transform[] navTargetList;
|
||||
public int navTargetIndex = 0;
|
||||
public Transform[] patrolPoints;
|
||||
public int patrolPointIndex = 0;
|
||||
public float patrolPointCheckDistance = 0.5f;
|
||||
public bool patrolEnabled = false;
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRNavController.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRNavController.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6af531c91777428586b3012938c50e6a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
11
Assets/ABI.CCK/Components/CVRObjectLibrary.cs
Executable file
11
Assets/ABI.CCK/Components/CVRObjectLibrary.cs
Executable file
|
@ -0,0 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRObjectLibrary : MonoBehaviour
|
||||
{
|
||||
public List<CVRObjectCatalogCategory> objectCatalogCategories = new List<CVRObjectCatalogCategory>();
|
||||
public List<CVRObjectCatalogEntry> objectCatalogEntries = new List<CVRObjectCatalogEntry>();
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRObjectLibrary.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRObjectLibrary.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 468b4d9f12304bcc96506ece8cd28208
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
17
Assets/ABI.CCK/Components/CVRObjectSync.cs
Executable file
17
Assets/ABI.CCK/Components/CVRObjectSync.cs
Executable file
|
@ -0,0 +1,17 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRObjectSync : MonoBehaviour
|
||||
{
|
||||
|
||||
[HideInInspector]
|
||||
public string syncOwner;
|
||||
|
||||
[HideInInspector]
|
||||
public string guid = "";
|
||||
|
||||
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRObjectSync.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRObjectSync.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5e64e73267099d84684eed99ad7d145f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
111
Assets/ABI.CCK/Components/CVRObjectSyncTask.cs
Executable file
111
Assets/ABI.CCK/Components/CVRObjectSyncTask.cs
Executable file
|
@ -0,0 +1,111 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
[System.Serializable]
|
||||
public class CVRObjectSyncTask
|
||||
{
|
||||
public enum TaskType
|
||||
{
|
||||
Position = 1,
|
||||
Rotation = 2,
|
||||
ActivityState = 3,
|
||||
PickupOwner = 4,
|
||||
AnimatorParameter = 5,
|
||||
AnimatorAnimationProgress = 6,
|
||||
VariableBufferValue = 7,
|
||||
}
|
||||
|
||||
public TaskType type = TaskType.Position;
|
||||
|
||||
public Component component = null;
|
||||
|
||||
public int intVal = 0;
|
||||
|
||||
public CVRSerializableObjectSyncTask getDefaultValues()
|
||||
{
|
||||
if (component == null) return null;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case TaskType.Position:
|
||||
var retPos = new CVRSerializableObjectSyncTask();
|
||||
retPos.type = TaskType.Position;
|
||||
retPos.value = ((Transform) component).position.ToString("F6");
|
||||
retPos.intVal = intVal;
|
||||
return retPos;
|
||||
break;
|
||||
case TaskType.Rotation:
|
||||
var retRot = new CVRSerializableObjectSyncTask();
|
||||
retRot.type = TaskType.Rotation;
|
||||
retRot.value = ((Transform) component).eulerAngles.ToString("F3");
|
||||
retRot.intVal = intVal;
|
||||
return retRot;
|
||||
break;
|
||||
case TaskType.ActivityState:
|
||||
var retAct = new CVRSerializableObjectSyncTask();
|
||||
retAct.type = TaskType.ActivityState;
|
||||
retAct.value = ((Transform) component).gameObject.activeSelf ? "1" : "0";
|
||||
retAct.intVal = intVal;
|
||||
return retAct;
|
||||
break;
|
||||
case TaskType.PickupOwner:
|
||||
var retPick = new CVRSerializableObjectSyncTask();
|
||||
retPick.type = TaskType.PickupOwner;
|
||||
retPick.value = "";
|
||||
retPick.intVal = intVal;
|
||||
return retPick;
|
||||
break;
|
||||
case TaskType.AnimatorParameter:
|
||||
var retAniParam = new CVRSerializableObjectSyncTask();
|
||||
retAniParam.type = TaskType.AnimatorParameter;
|
||||
var animator = (Animator) component;
|
||||
if (animator == null) return null;
|
||||
if (animator.runtimeAnimatorController == null) return null;
|
||||
if (animator.parameters.Length <= intVal) return null;
|
||||
switch (animator.parameters[intVal].type)
|
||||
{
|
||||
case AnimatorControllerParameterType.Bool:
|
||||
retAniParam.value = animator.parameters[intVal].defaultBool ? "1" : "0";
|
||||
break;
|
||||
case AnimatorControllerParameterType.Float:
|
||||
retAniParam.value = animator.parameters[intVal].defaultFloat.ToString("F8");
|
||||
break;
|
||||
case AnimatorControllerParameterType.Int:
|
||||
retAniParam.value = animator.parameters[intVal].defaultInt.ToString();
|
||||
break;
|
||||
case AnimatorControllerParameterType.Trigger:
|
||||
retAniParam.value = "0";
|
||||
break;
|
||||
}
|
||||
retAniParam.intVal = intVal;
|
||||
return retAniParam;
|
||||
break;
|
||||
case TaskType.AnimatorAnimationProgress:
|
||||
var retAniProg = new CVRSerializableObjectSyncTask();
|
||||
retAniProg.type = TaskType.AnimatorAnimationProgress;
|
||||
retAniProg.value = (0f).ToString("F8");
|
||||
retAniProg.intVal = intVal;
|
||||
return retAniProg;
|
||||
break;
|
||||
case TaskType.VariableBufferValue:
|
||||
var retVar = new CVRSerializableObjectSyncTask();
|
||||
retVar.type = TaskType.VariableBufferValue;
|
||||
retVar.value = ((CVRVariableBuffer) component).defaultValue.ToString("F8");
|
||||
retVar.intVal = intVal;
|
||||
return retVar;
|
||||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class CVRSerializableObjectSyncTask
|
||||
{
|
||||
public CVRObjectSyncTask.TaskType type = CVRObjectSyncTask.TaskType.Position;
|
||||
public string value;
|
||||
public int intVal;
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRObjectSyncTask.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRObjectSyncTask.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: da0a3faa33d84c39bb8b9026cda126b1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
100
Assets/ABI.CCK/Components/CVRParameterStream.cs
Executable file
100
Assets/ABI.CCK/Components/CVRParameterStream.cs
Executable file
|
@ -0,0 +1,100 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRParameterStream : MonoBehaviour
|
||||
{
|
||||
public enum ReferenceType
|
||||
{
|
||||
World = 0,
|
||||
Avatar = 1,
|
||||
Spawnable = 2
|
||||
}
|
||||
|
||||
public ReferenceType referenceType = ReferenceType.World;
|
||||
|
||||
public List<CVRParameterStreamEntry> entries = new List<CVRParameterStreamEntry>();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class CVRParameterStreamEntry
|
||||
{
|
||||
public enum Type
|
||||
{
|
||||
TimeSeconds = 0,
|
||||
TimeSecondsUtc = 10,
|
||||
DeviceMode = 20,
|
||||
HeadsetOnHead = 30,
|
||||
ZoomFactor = 40,
|
||||
ZoomFactorCurve = 50,
|
||||
EyeMovementLeftX = 60,
|
||||
EyeMovementLeftY = 70,
|
||||
EyeMovementRightX = 80,
|
||||
EyeMovementRightY = 90,
|
||||
EyeBlinkingLeft = 100,
|
||||
EyeBlinkingRight = 110,
|
||||
VisemeLevel = 120,
|
||||
TimeSinceHeadsetRemoved = 130,
|
||||
TimeSinceLocalAvatarLoaded = 140,
|
||||
LocalWorldDownloadPercentage = 150,
|
||||
LocalFPS = 160,
|
||||
LocalPing = 170,
|
||||
LocalPlayerCount = 180,
|
||||
LocalTimeSinceFirstWorldJoin = 190,
|
||||
LocalTimeSinceWorldJoin = 200,
|
||||
LocalPlayerMuted = 210,
|
||||
LocalPlayerHudEnabled = 220,
|
||||
LocalPlayerNameplatesEnabled = 230,
|
||||
LocalPlayerHeight = 240,
|
||||
LocalPlayerControllerType = 250,
|
||||
LocalPlayerFullBodyEnabled = 260,
|
||||
TriggerLeftValue = 270,
|
||||
TriggerRightValue = 280,
|
||||
GripLeftValue = 290,
|
||||
GripRightValue = 300,
|
||||
GrippedObjectLeft = 310,
|
||||
GrippedObjectRight = 320
|
||||
}
|
||||
|
||||
public Type type = Type.TimeSeconds;
|
||||
|
||||
public enum TargetType
|
||||
{
|
||||
Animator = 0,
|
||||
VariableBuffer = 1,
|
||||
AvatarAnimator = 2,
|
||||
CustomFloat = 3,
|
||||
}
|
||||
|
||||
public TargetType targetType = TargetType.Animator;
|
||||
|
||||
public enum ApplicationType
|
||||
{
|
||||
Override = 0,
|
||||
AddToCurrent = 10,
|
||||
AddToStatic = 21,
|
||||
SubtractFromCurrent = 30,
|
||||
SubtractFromStatic = 41,
|
||||
SubtractWithCurrent = 50,
|
||||
SubtractWithStatic = 61,
|
||||
MultiplyWithCurrent = 70,
|
||||
MultiplyWithStatic = 81,
|
||||
CompareLessThen = 91,
|
||||
CompareLessThenEquals = 101,
|
||||
CompareEquals = 111,
|
||||
CompareMoreThenEquals = 121,
|
||||
CompareMoreThen = 131,
|
||||
Mod = 141,
|
||||
Pow = 151,
|
||||
}
|
||||
|
||||
public ApplicationType applicationType = ApplicationType.Override;
|
||||
|
||||
public float staticValue;
|
||||
|
||||
public GameObject target;
|
||||
|
||||
public string parameterName;
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRParameterStream.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRParameterStream.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 943b2a67b8ad4877b53caadebe4d8d00
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
90
Assets/ABI.CCK/Components/CVRParticleSound.cs
Executable file
90
Assets/ABI.CCK/Components/CVRParticleSound.cs
Executable file
|
@ -0,0 +1,90 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRParticleSound : MonoBehaviour
|
||||
{
|
||||
public ParticleSystem particleSystem;
|
||||
|
||||
public AudioClip[] spawnSound;
|
||||
public AudioClip[] dieSound;
|
||||
|
||||
public float spawnPlaybackVolume = 1f;
|
||||
public float diePlaybackVolume = 1f;
|
||||
|
||||
private IDictionary<uint, ParticleSystem.Particle> _particles = new Dictionary<uint, ParticleSystem.Particle>();
|
||||
|
||||
public AudioSource spawnAudioSourceReference;
|
||||
public AudioSource dieAudioSourceReference;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (particleSystem == null) return;
|
||||
|
||||
ParticleSystem.Particle[] currentParticles = new ParticleSystem.Particle[particleSystem.particleCount];
|
||||
particleSystem.GetParticles(currentParticles);
|
||||
|
||||
ParticleChange particleChange = GetParticleChange(currentParticles);
|
||||
|
||||
if (spawnSound.Length > 0)
|
||||
{
|
||||
foreach (ParticleSystem.Particle particleAdded in particleChange.Added)
|
||||
{
|
||||
AudioSource.PlayClipAtPoint(spawnSound[Random.Range(0, spawnSound.Length)], particleAdded.position, spawnPlaybackVolume);
|
||||
}
|
||||
}
|
||||
|
||||
if (dieSound.Length > 0)
|
||||
{
|
||||
foreach (ParticleSystem.Particle particleRemoved in particleChange.Removed)
|
||||
{
|
||||
AudioSource.PlayClipAtPoint(dieSound[Random.Range(0, dieSound.Length)], particleRemoved.position, diePlaybackVolume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ParticleChange GetParticleChange(ParticleSystem.Particle[] currentParticles)
|
||||
{
|
||||
ParticleChange particleChange = new ParticleChange();
|
||||
|
||||
foreach (ParticleSystem.Particle activeParticle in currentParticles)
|
||||
{
|
||||
ParticleSystem.Particle foundParticle;
|
||||
if(_particles.TryGetValue(activeParticle.randomSeed, out foundParticle))
|
||||
{
|
||||
_particles[activeParticle.randomSeed] = activeParticle;
|
||||
}
|
||||
else
|
||||
{
|
||||
particleChange.Added.Add(activeParticle);
|
||||
_particles.Add(activeParticle.randomSeed, activeParticle);
|
||||
}
|
||||
}
|
||||
|
||||
var updatedParticleAsDictionary = currentParticles.ToDictionary(x => x.randomSeed, x => x);
|
||||
var dictionaryKeysAsList = _particles.Keys.ToList();
|
||||
|
||||
foreach (uint dictionaryKey in dictionaryKeysAsList)
|
||||
{
|
||||
if (updatedParticleAsDictionary.ContainsKey(dictionaryKey) == false)
|
||||
{
|
||||
particleChange.Removed.Add(_particles[dictionaryKey]);
|
||||
_particles.Remove(dictionaryKey);
|
||||
}
|
||||
}
|
||||
|
||||
return particleChange;
|
||||
}
|
||||
|
||||
private class ParticleChange
|
||||
{
|
||||
public IList<ParticleSystem.Particle> Added = new List<ParticleSystem.Particle>();
|
||||
public IList<ParticleSystem.Particle> Removed = new List<ParticleSystem.Particle>();
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRParticleSound.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRParticleSound.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bce006ea5e07463f86d8c2685afe2d59
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
54
Assets/ABI.CCK/Components/CVRPickupObject.cs
Executable file
54
Assets/ABI.CCK/Components/CVRPickupObject.cs
Executable file
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRPickupObject : MonoBehaviour
|
||||
{
|
||||
public enum GripType
|
||||
{
|
||||
Free = 1,
|
||||
Origin = 2
|
||||
}
|
||||
|
||||
public GripType gripType = GripType.Free;
|
||||
public Transform gripOrigin;
|
||||
|
||||
public bool disallowTheft;
|
||||
|
||||
public float maximumGrabDistance = 0f;
|
||||
|
||||
public List<SnappingReference> snappingReferences = new List<SnappingReference>();
|
||||
|
||||
public bool autoHold = false;
|
||||
|
||||
public Transform ikReference;
|
||||
|
||||
private Transform _originalParent;
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
if (gripType == GripType.Origin && gripOrigin != null)
|
||||
{
|
||||
var t = gripOrigin.transform;
|
||||
var s = t.lossyScale;
|
||||
|
||||
Gizmos.matrix = Matrix4x4.TRS(t.position, t.rotation, Vector3.one);
|
||||
Gizmos.color = Color.white;
|
||||
|
||||
Gizmos.DrawWireCube(new Vector3(0f, 0f, -0.15f), new Vector3(0.1f, 0.1f, 0.2f));
|
||||
Gizmos.DrawWireCube(new Vector3(-0.075f, 0f, 0f), new Vector3(0.05f, 0.2f, 0.2f));
|
||||
Gizmos.DrawWireCube(new Vector3(0f, 0f, 0.1f), new Vector3(0.1f, 0.2f, 0.05f));
|
||||
Gizmos.DrawWireCube(new Vector3(0.07f, 0.05f, 0f), new Vector3(0.05f, 0.05f, 0.15f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class SnappingReference
|
||||
{
|
||||
public Transform referencePoint;
|
||||
public string allowedType;
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRPickupObject.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRPickupObject.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 12974925555b471580cacf5d2d5fa9e3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
20
Assets/ABI.CCK/Components/CVRPointer.cs
Executable file
20
Assets/ABI.CCK/Components/CVRPointer.cs
Executable file
|
@ -0,0 +1,20 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRPointer : MonoBehaviour
|
||||
{
|
||||
public string type;
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
if (isActiveAndEnabled)
|
||||
{
|
||||
Gizmos.color = Color.blue;
|
||||
Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one);
|
||||
Gizmos.matrix = rotationMatrix;
|
||||
Gizmos.DrawSphere(Vector3.zero, 0.015f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRPointer.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRPointer.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 39d87b8783794dfd81ce396483019cbb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
18
Assets/ABI.CCK/Components/CVRPortalMarker.cs
Executable file
18
Assets/ABI.CCK/Components/CVRPortalMarker.cs
Executable file
|
@ -0,0 +1,18 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRPortalMarker : MonoBehaviour
|
||||
{
|
||||
public string worldGUID;
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
Gizmos.color = Color.magenta;
|
||||
Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, transform.lossyScale);
|
||||
Gizmos.matrix = rotationMatrix;
|
||||
Gizmos.DrawWireCube(new Vector3(0, 0.15f, 0), new Vector3(0.75f, 0.3f, 0.75f));
|
||||
Gizmos.DrawWireSphere(new Vector3(0, 1f, 0), 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRPortalMarker.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRPortalMarker.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c9746fb541d346d1bcaa3a67f4baa058
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
25
Assets/ABI.CCK/Components/CVRSnappingPoint.cs
Executable file
25
Assets/ABI.CCK/Components/CVRSnappingPoint.cs
Executable file
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRSnappingPoint : MonoBehaviour
|
||||
{
|
||||
public string type;
|
||||
|
||||
public float distance = 0.05f;
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
Gizmos.color = Color.white;
|
||||
Vector3 pos = transform.position;
|
||||
float length = distance * 1.25f;
|
||||
Gizmos.DrawLine(pos - length * Vector3.up, pos + length * Vector3.up);
|
||||
Gizmos.DrawLine(pos - length * Vector3.left, pos + length * Vector3.left);
|
||||
Gizmos.DrawLine(pos - length * Vector3.forward, pos + length * Vector3.forward);
|
||||
Gizmos.DrawWireSphere(pos, distance);
|
||||
Gizmos.color = new Color(0.2f, 0.2f, 0.2f);
|
||||
Gizmos.DrawWireSphere(pos, length);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRSnappingPoint.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRSnappingPoint.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3f5b56add4ca4b8d8500666987bd2adb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
185
Assets/ABI.CCK/Components/CVRSpawnable.cs
Executable file
185
Assets/ABI.CCK/Components/CVRSpawnable.cs
Executable file
|
@ -0,0 +1,185 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using ABI.CCK.Components;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRSpawnable : MonoBehaviour
|
||||
{
|
||||
public float spawnHeight = 0f;
|
||||
|
||||
public bool useAdditionalValues;
|
||||
|
||||
public List<CVRSpawnableValue> syncValues = new List<CVRSpawnableValue>();
|
||||
|
||||
public enum PropPrivacy
|
||||
{
|
||||
everyone = 1,
|
||||
owner = 2
|
||||
}
|
||||
|
||||
public PropPrivacy propPrivacy = PropPrivacy.everyone;
|
||||
|
||||
public List<CVRSpawnableSubSync> subSyncs = new List<CVRSpawnableSubSync>();
|
||||
|
||||
public enum SpawnableType
|
||||
{
|
||||
StandaloneSpawnable = 0,
|
||||
WorldSpawnable = 1
|
||||
}
|
||||
|
||||
[HideInInspector]
|
||||
public SpawnableType spawnableType = SpawnableType.StandaloneSpawnable;
|
||||
|
||||
[HideInInspector]
|
||||
public string preGeneratedInstanceId = "";
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
Gizmos.color = Color.white;
|
||||
|
||||
Gizmos.DrawLine(transform.position, transform.position - new Vector3(0, spawnHeight, 0));
|
||||
Gizmos.matrix = Matrix4x4.TRS(transform.position - new Vector3(0, spawnHeight, 0), Quaternion.identity,
|
||||
new Vector3(1f, 0f, 1f));
|
||||
Gizmos.DrawWireSphere(Vector3.zero, 0.25f);
|
||||
Gizmos.DrawLine(new Vector3(0, 0, 0.35f), new Vector3(0.177f, 0, 0.177f));
|
||||
Gizmos.DrawLine(new Vector3(0, 0, 0.35f), new Vector3(0, 0, 0.25f));
|
||||
Gizmos.DrawLine(new Vector3(0, 0, 0.35f), new Vector3(-0.177f, 0, 0.177f));
|
||||
|
||||
Gizmos.matrix = Matrix4x4.identity;
|
||||
|
||||
//SubSyncGizmos
|
||||
foreach (var subSync in subSyncs)
|
||||
{
|
||||
if (subSync.precision == CVRSpawnableSubSync.SyncPrecision.Full) continue;
|
||||
if (subSync.transform == null) continue;
|
||||
|
||||
Gizmos.matrix = Matrix4x4.TRS(subSync.transform.parent.position, Quaternion.identity, subSync.transform.parent.lossyScale);
|
||||
|
||||
if (Mathf.Abs(subSync.transform.localPosition.x) > subSync.syncBoundary ||
|
||||
Mathf.Abs(subSync.transform.localPosition.y) > subSync.syncBoundary ||
|
||||
Mathf.Abs(subSync.transform.localPosition.z) > subSync.syncBoundary)
|
||||
{
|
||||
Gizmos.color = Color.red;
|
||||
}
|
||||
else
|
||||
{
|
||||
Gizmos.color = Color.blue;
|
||||
}
|
||||
|
||||
Gizmos.DrawWireCube(Vector3.zero, Vector3.one * subSync.syncBoundary * 2f);
|
||||
}
|
||||
}
|
||||
|
||||
private void DestroyProp()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
if (GetComponent<CVRBuilderSpawnable>() != null)
|
||||
{
|
||||
Invoke("DestroyThis", 0);
|
||||
}
|
||||
else if (GetComponent<CVRAssetInfo>() == null)
|
||||
{
|
||||
CVRAssetInfo info = gameObject.AddComponent<CVRAssetInfo>();
|
||||
info.type = CVRAssetInfo.AssetType.Spawnable;
|
||||
}
|
||||
}
|
||||
void DestroyThis() {
|
||||
DestroyImmediate(this);
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class CVRSpawnableValue
|
||||
{
|
||||
public string name;
|
||||
public float startValue;
|
||||
|
||||
public enum UpdatedBy
|
||||
{
|
||||
None = 0,
|
||||
SystemTime = 1,
|
||||
WorldTime = 2,
|
||||
SpawnerPositionX = 3,
|
||||
SpawnerPositionY = 4,
|
||||
SpawnerPositionZ = 5,
|
||||
SpawnerDistance = 6,
|
||||
SpawnerLookDirectionX = 7,
|
||||
SpawnerLookDirectionY = 8,
|
||||
SpawnerLookDirectionZ = 9,
|
||||
SpawnerLeftHandDirectionX = 10,
|
||||
SpawnerLeftHandDirectionY = 11,
|
||||
SpawnerLeftHandDirectionZ = 12,
|
||||
SpawnerRightHandDirectionX = 13,
|
||||
SpawnerRightHandDirectionY = 14,
|
||||
SpawnerRightHandDirectionZ = 15,
|
||||
SpawnerLeftGrip = 16,
|
||||
SpawnerRightGrip = 17,
|
||||
SpawnerLeftTrigger = 18,
|
||||
SpawnerRightTrigger = 19,
|
||||
OwnerLeftGrip = 20,
|
||||
OwnerRightGrip = 21,
|
||||
OwnerLeftTrigger = 22,
|
||||
OwnerRightTrigger = 23,
|
||||
OwnerCurrentGrip = 24,
|
||||
OwnerCurrentTrigger = 25,
|
||||
OwnerOppositeGrip = 26,
|
||||
OwnerOppositeTrigger = 27
|
||||
}
|
||||
|
||||
public UpdatedBy updatedBy = UpdatedBy.None;
|
||||
|
||||
public enum UpdateMethod
|
||||
{
|
||||
Override = 1,
|
||||
AddToDefault = 2,
|
||||
AddToCurrent = 3,
|
||||
SubtractFromDefault = 4,
|
||||
SubtractFromCurrent = 5,
|
||||
MultiplyWithDefault = 6,
|
||||
DefaultDividedByCurrent = 7,
|
||||
}
|
||||
|
||||
public UpdateMethod updateMethod = UpdateMethod.Override;
|
||||
|
||||
public Animator animator;
|
||||
|
||||
public string animatorParameterName;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class CVRSpawnableSubSync
|
||||
{
|
||||
public Transform transform;
|
||||
|
||||
[Flags]
|
||||
public enum SyncFlags
|
||||
{
|
||||
TransformX = 1 << 1,
|
||||
TransformY = 1 << 2,
|
||||
TransformZ = 1 << 3,
|
||||
RotationX = 1 << 4,
|
||||
RotationY = 1 << 5,
|
||||
RotationZ = 1 << 6
|
||||
}
|
||||
|
||||
public SyncFlags syncedValues;
|
||||
|
||||
public enum SyncPrecision
|
||||
{
|
||||
Quarter = 1,
|
||||
Half = 2,
|
||||
Full = 4
|
||||
}
|
||||
|
||||
public SyncPrecision precision = SyncPrecision.Full;
|
||||
|
||||
public float syncBoundary = 0.5f;
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRSpawnable.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRSpawnable.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a37fd8d654d5c2840a0ab3a5ad65a5ae
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
221
Assets/ABI.CCK/Components/CVRSpawnableTrigger.cs
Executable file
221
Assets/ABI.CCK/Components/CVRSpawnableTrigger.cs
Executable file
|
@ -0,0 +1,221 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRSpawnableTrigger : MonoBehaviour
|
||||
{
|
||||
public Vector3 areaSize = new Vector3(0.05f, 0.05f, 0.05f);
|
||||
public Vector3 areaOffset = Vector3.zero;
|
||||
public int settingIndex = -1;
|
||||
public float settingValue = 0;
|
||||
|
||||
public bool useAdvancedTrigger = false;
|
||||
|
||||
public string[] allowedTypes = new string[0];
|
||||
public bool allowParticleInteraction = false;
|
||||
|
||||
public List<CVRSpawnableTriggerTask> enterTasks = new List<CVRSpawnableTriggerTask>();
|
||||
public List<CVRSpawnableTriggerTask> exitTasks = new List<CVRSpawnableTriggerTask>();
|
||||
|
||||
public List<CVRSpawnableTriggerTaskStay> stayTasks = new List<CVRSpawnableTriggerTaskStay>();
|
||||
|
||||
public enum SampleDirection
|
||||
{
|
||||
XPositive,
|
||||
XNegative,
|
||||
YPositive,
|
||||
YNegative,
|
||||
ZPositive,
|
||||
ZNegative
|
||||
}
|
||||
|
||||
public SampleDirection sampleDirection = SampleDirection.XPositive;
|
||||
|
||||
public void Trigger()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void EnterTrigger()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ExitTrigger()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void StayTrigger(float percent = 0f)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
if (isActiveAndEnabled)
|
||||
{
|
||||
Gizmos.color = Color.cyan;
|
||||
Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, transform.lossyScale);
|
||||
Gizmos.matrix = rotationMatrix;
|
||||
Gizmos.DrawCube(areaOffset, areaSize);
|
||||
|
||||
Vector3 bounds = new Vector3(areaSize.x * 0.5f, areaSize.y * 0.5f, areaSize.z * 0.5f);
|
||||
|
||||
if (stayTasks.Count > 0)
|
||||
{
|
||||
Gizmos.DrawWireCube(areaOffset, areaSize);
|
||||
|
||||
switch (sampleDirection)
|
||||
{
|
||||
case SampleDirection.XPositive:
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(bounds.x, 0f, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, -bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(bounds.x, 0f, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(bounds.x, bounds.y, 0f) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, -bounds.z) + areaOffset,
|
||||
new Vector3(bounds.x, bounds.y, 0f) + areaOffset
|
||||
);
|
||||
break;
|
||||
case SampleDirection.XNegative:
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, 0f, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(bounds.x, -bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, 0f, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, bounds.y, 0f) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(bounds.x, bounds.y, -bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, bounds.y, 0f) + areaOffset
|
||||
);
|
||||
break;
|
||||
case SampleDirection.YPositive:
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, -bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(0f, bounds.y, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(bounds.x, -bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(0f, bounds.y, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, -bounds.y, -bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, bounds.y, 0f) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, -bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, bounds.y, 0f) + areaOffset
|
||||
);
|
||||
break;
|
||||
case SampleDirection.YNegative:
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(0f, -bounds.y, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(0f, -bounds.y, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, -bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, -bounds.y, 0f) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, -bounds.y, 0f) + areaOffset
|
||||
);
|
||||
break;
|
||||
case SampleDirection.ZPositive:
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, -bounds.z) + areaOffset,
|
||||
new Vector3(0f, bounds.y, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(bounds.x, bounds.y, -bounds.z) + areaOffset,
|
||||
new Vector3(0f, bounds.y, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, -bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, 0f, bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, -bounds.y, -bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, 0f, bounds.z) + areaOffset
|
||||
);
|
||||
break;
|
||||
case SampleDirection.ZNegative:
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(0f, bounds.y, -bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(0f, bounds.y, -bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, 0f, -bounds.z) + areaOffset
|
||||
);
|
||||
Gizmos.DrawLine(
|
||||
new Vector3(-bounds.x, -bounds.y, bounds.z) + areaOffset,
|
||||
new Vector3(-bounds.x, 0f, -bounds.z) + areaOffset
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class CVRSpawnableTriggerTask
|
||||
{
|
||||
public int settingIndex = -1;
|
||||
public float settingValue = 0f;
|
||||
public float delay = 0f;
|
||||
public float holdTime = 0f;
|
||||
|
||||
public enum UpdateMethod
|
||||
{
|
||||
Override = 1,
|
||||
Add = 2,
|
||||
Subtract = 3,
|
||||
Toggle = 4
|
||||
}
|
||||
|
||||
public CVRSpawnableTriggerTask.UpdateMethod updateMethod = UpdateMethod.Override;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class CVRSpawnableTriggerTaskStay
|
||||
{
|
||||
public int settingIndex = -1;
|
||||
public float minValue = 0f;
|
||||
public float maxValue = 1f;
|
||||
|
||||
public enum UpdateMethod
|
||||
{
|
||||
SetFromPosition = 1,
|
||||
Add = 2,
|
||||
Subtract = 3,
|
||||
}
|
||||
|
||||
public CVRSpawnableTriggerTaskStay.UpdateMethod updateMethod = UpdateMethod.SetFromPosition;
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRSpawnableTrigger.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRSpawnableTrigger.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 81194749cc874e87b95c7b486517c3a9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
62
Assets/ABI.CCK/Components/CVRTexturePropertyParser.cs
Executable file
62
Assets/ABI.CCK/Components/CVRTexturePropertyParser.cs
Executable file
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRTexturePropertyParser : MonoBehaviour
|
||||
{
|
||||
public enum TextureType
|
||||
{
|
||||
LocalTexture = 0,
|
||||
GlobalTexture = 1,
|
||||
}
|
||||
|
||||
public TextureType textureType = TextureType.LocalTexture;
|
||||
|
||||
public RenderTexture texture;
|
||||
public string globalTextureName = "";
|
||||
|
||||
public List<CVRTexturePropertyParserTask> tasks = new List<CVRTexturePropertyParserTask>();
|
||||
|
||||
private void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class CVRTexturePropertyParserTask
|
||||
{
|
||||
public int x = 0;
|
||||
public int y = 0;
|
||||
|
||||
public enum Channel
|
||||
{
|
||||
r = 0,
|
||||
g = 1,
|
||||
b = 2,
|
||||
a = 3,
|
||||
}
|
||||
public Channel channel = Channel.r;
|
||||
|
||||
private Vector4[] conversionTable = new Vector4[]
|
||||
{
|
||||
new Vector4(1, 0, 0, 0),
|
||||
new Vector4(0, 1, 0, 0),
|
||||
new Vector4(0, 0, 1, 0),
|
||||
new Vector4(0, 0, 0, 1)
|
||||
};
|
||||
|
||||
public float minValue = 0f;
|
||||
public float maxValue = 1f;
|
||||
|
||||
public GameObject target;
|
||||
public Component component;
|
||||
|
||||
public string propertyName = "";
|
||||
public int typeIndex = 0;
|
||||
public int targetIndex = 0;
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRTexturePropertyParser.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRTexturePropertyParser.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fdc0f8cf4e404413977612cac1108d7d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
14
Assets/ABI.CCK/Components/CVRTimelineSync.cs
Executable file
14
Assets/ABI.CCK/Components/CVRTimelineSync.cs
Executable file
|
@ -0,0 +1,14 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRTimelineSync : MonoBehaviour
|
||||
{
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRTimelineSync.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRTimelineSync.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 033a340a5f41c1c48a61aa232aed0d90
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
19
Assets/ABI.CCK/Components/CVRToggleStatePointer.cs
Executable file
19
Assets/ABI.CCK/Components/CVRToggleStatePointer.cs
Executable file
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRToggleStatePointer : CVRPointer
|
||||
{
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
if (isActiveAndEnabled)
|
||||
{
|
||||
Gizmos.color = Color.green;
|
||||
Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one);
|
||||
Gizmos.matrix = rotationMatrix;
|
||||
Gizmos.DrawSphere(Vector3.zero, 0.015f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRToggleStatePointer.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRToggleStatePointer.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8febb0153c9243548ea59bfe9324f222
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
28
Assets/ABI.CCK/Components/CVRToggleStateTrigger.cs
Executable file
28
Assets/ABI.CCK/Components/CVRToggleStateTrigger.cs
Executable file
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRToggleStateTrigger : MonoBehaviour
|
||||
{
|
||||
public Vector3 areaSize = new Vector3(0.05f, 0.05f, 0.05f);
|
||||
public Vector3 areaOffset = Vector3.zero;
|
||||
public int toggleStateID = 0;
|
||||
|
||||
public void Trigger()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
if (isActiveAndEnabled)
|
||||
{
|
||||
Gizmos.color = Color.green;
|
||||
Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, transform.lossyScale);
|
||||
Gizmos.matrix = rotationMatrix;
|
||||
Gizmos.DrawCube(areaOffset, areaSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRToggleStateTrigger.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRToggleStateTrigger.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1c2f975c96e645cfaf787ac523660602
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
330
Assets/ABI.CCK/Components/CVRTranslatable.cs
Executable file
330
Assets/ABI.CCK/Components/CVRTranslatable.cs
Executable file
|
@ -0,0 +1,330 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
#endif
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
#if CCK_ADDIN_TRANSLATABLE_TMP
|
||||
using TMPro;
|
||||
#endif
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRTranslatable : MonoBehaviour
|
||||
{
|
||||
|
||||
public List<ObjectTranslatable_t> Translatables = new List<ObjectTranslatable_t>();
|
||||
|
||||
[System.Serializable]
|
||||
public class ObjectTranslatable_t
|
||||
{
|
||||
public TranslatableType Type = TranslatableType.Text;
|
||||
public List<Translation_t> Translations = new List<Translation_t>();
|
||||
#if CCK_ADDIN_TRANSLATABLE_TMP
|
||||
public TMP_Text TmpText;
|
||||
#endif
|
||||
public Text Text;
|
||||
public AudioSource Source;
|
||||
public string FallbackLanguage = "en";
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public ReorderableList reorderableList;
|
||||
public Translation_t entity;
|
||||
|
||||
public ReorderableList GetList()
|
||||
{
|
||||
if (reorderableList == null)
|
||||
{
|
||||
reorderableList = new ReorderableList(Translations, typeof(Translation_t),
|
||||
true, true, true, true);
|
||||
reorderableList.drawHeaderCallback = OnDrawHeader;
|
||||
reorderableList.drawElementCallback = OnDrawElement;
|
||||
reorderableList.elementHeightCallback = OnHeightElement;
|
||||
reorderableList.onAddCallback = OnAdd;
|
||||
reorderableList.onChangedCallback = OnChanged;
|
||||
}
|
||||
|
||||
return reorderableList;
|
||||
}
|
||||
|
||||
private void OnDrawElement(Rect rect, int index, bool isactive, bool isfocused)
|
||||
{
|
||||
if (index > Translations.Count) return;
|
||||
entity = Translations[index];
|
||||
|
||||
rect.y += 2;
|
||||
rect.x += 12;
|
||||
rect.width -= 12;
|
||||
Rect _rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight);
|
||||
|
||||
EditorGUI.LabelField(_rect, "Language");
|
||||
_rect.x += 100;
|
||||
_rect.width = rect.width - 100;
|
||||
|
||||
var selectedIndex = CVRTranslatable.Languages.Keys.ToList().FindIndex(match => match == entity.Language);
|
||||
|
||||
selectedIndex = EditorGUI.Popup(_rect, selectedIndex, CVRTranslatable.Languages.Values.ToArray());
|
||||
|
||||
entity.Language = CVRTranslatable.Languages.Keys.ToArray()[selectedIndex];
|
||||
|
||||
rect.y += EditorGUIUtility.singleLineHeight * 1.25f;
|
||||
_rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight *
|
||||
(Type==TranslatableType.AudioClip||Type==TranslatableType.GameObject?1f:3f));
|
||||
|
||||
EditorGUI.LabelField(_rect, Type==TranslatableType.AudioClip?"Audio Clip":(Type==TranslatableType.GameObject?"Object":"Text"));
|
||||
_rect.x += 100;
|
||||
_rect.width = rect.width - 100;
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case TranslatableType.Text:
|
||||
#if CCK_ADDIN_TRANSLATABLE_TMP
|
||||
case TranslatableType.TextMeshPro:
|
||||
#endif
|
||||
entity.Text = EditorGUI.TextArea(_rect, entity.Text);
|
||||
break;
|
||||
case TranslatableType.AudioClip:
|
||||
entity.Clip = (AudioClip) EditorGUI.ObjectField(_rect, entity.Clip, typeof(AudioClip));
|
||||
break;
|
||||
case TranslatableType.GameObject:
|
||||
entity.Object = (GameObject) EditorGUI.ObjectField(_rect, entity.Object, typeof(GameObject), true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private float OnHeightElement(int index)
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight * (Type==TranslatableType.AudioClip||Type==TranslatableType.GameObject?2.5f:5f);
|
||||
}
|
||||
|
||||
private void OnChanged(ReorderableList list)
|
||||
{
|
||||
//EditorUtility.SetDirty(target);
|
||||
}
|
||||
|
||||
private void OnAdd(ReorderableList list)
|
||||
{
|
||||
Translations.Add(new Translation_t());
|
||||
}
|
||||
|
||||
private void OnDrawHeader(Rect rect)
|
||||
{
|
||||
Rect _rect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight);
|
||||
|
||||
GUI.Label(_rect, "Translations");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class Translation_t
|
||||
{
|
||||
public string Language = "en";
|
||||
public string Text;
|
||||
public AudioClip Clip;
|
||||
public GameObject Object;
|
||||
}
|
||||
|
||||
public enum TranslatableType
|
||||
{
|
||||
AudioClip = 0,
|
||||
Text = 1,
|
||||
#if CCK_ADDIN_TRANSLATABLE_TMP
|
||||
TextMeshPro = 2,
|
||||
#endif
|
||||
GameObject = 3
|
||||
}
|
||||
|
||||
public static Dictionary<string, string> Languages = new Dictionary<string, string>()
|
||||
{
|
||||
{"ab", "Abkhazian"},
|
||||
{"aa", "Afar"},
|
||||
{"af", "Afrikaans"},
|
||||
{"ak", "Akan"},
|
||||
{"sq", "Albanian"},
|
||||
{"am", "Amharic"},
|
||||
{"ar", "Arabic"},
|
||||
{"an", "Aragonese"},
|
||||
{"hy", "Armenian"},
|
||||
{"as", "Assamese"},
|
||||
{"av", "Avaric"},
|
||||
{"ae", "Avestan"},
|
||||
{"ay", "Aymara"},
|
||||
{"az", "Azerbaijani"},
|
||||
{"bm", "Bambara"},
|
||||
{"ba", "Bashkir"},
|
||||
{"eu", "Basque"},
|
||||
{"be", "Belarusian"},
|
||||
{"bn", "Bengali"},
|
||||
{"bh", "Bihari languages"},
|
||||
{"bi", "Bislama"},
|
||||
{"bs", "Bosnian"},
|
||||
{"br", "Breton"},
|
||||
{"bg", "Bulgarian"},
|
||||
{"my", "Burmese"},
|
||||
{"ca", "Catalan, Valencian"},
|
||||
{"ch", "Chamorro"},
|
||||
{"ce", "Chechen"},
|
||||
{"ny", "Chichewa, Chewa, Nyanja"},
|
||||
{"zh", "Chinese"},
|
||||
{"cv", "Chuvash"},
|
||||
{"kw", "Cornish"},
|
||||
{"co", "Corsican"},
|
||||
{"cr", "Cree"},
|
||||
{"hr", "Croatian"},
|
||||
{"cs", "Czech"},
|
||||
{"da", "Danish"},
|
||||
{"dv", "Divehi, Dhivehi, Maldivian"},
|
||||
{"nl", "Dutch, Flemish"},
|
||||
{"dz", "Dzongkha"},
|
||||
{"en", "English"},
|
||||
{"eo", "Esperanto"},
|
||||
{"et", "Estonian"},
|
||||
{"ee", "Ewe"},
|
||||
{"fo", "Faroese"},
|
||||
{"fj", "Fijian"},
|
||||
{"fi", "Finnish"},
|
||||
{"fr", "French"},
|
||||
{"ff", "Fulah"},
|
||||
{"gl", "Galician"},
|
||||
{"ka", "Georgian"},
|
||||
{"de", "German"},
|
||||
{"el", "Greek, Modern(1453–)"},
|
||||
{"gn", "Guarani"},
|
||||
{"gu", "Gujarati"},
|
||||
{"ht", "Haitian, Haitian Kreol"},
|
||||
{"ha", "Hausa"},
|
||||
{"he", "Hebrew"},
|
||||
{"hz", "Herero"},
|
||||
{"hi", "Hindi"},
|
||||
{"ho", "Hiri Motu"},
|
||||
{"hu", "Hungarian"},
|
||||
{"ia", "Interlingua (International Auxiliary Language Association)"},
|
||||
{"id", "Indonesian"},
|
||||
{"ie", "Interlingue, Occidental"},
|
||||
{"ga", "Irish"},
|
||||
{"ig", "Igbo"},
|
||||
{"ik", "Inupiaq"},
|
||||
{"io", "Ido"},
|
||||
{"is", "Icelandic"},
|
||||
{"it", "Italian"},
|
||||
{"iu", "Inuktitut"},
|
||||
{"ja", "Japanese"},
|
||||
{"jv", "Javanese"},
|
||||
{"kl", "Kalaallisut, Greenlandic"},
|
||||
{"kn", "Kannada"},
|
||||
{"kr", "Kanuri"},
|
||||
{"ks", "Kashmiri"},
|
||||
{"kk", "Kazakh"},
|
||||
{"km", "Central Khmer"},
|
||||
{"ki", "Kikuyu, Gikuyu"},
|
||||
{"rw", "Kinyarwanda"},
|
||||
{"ky", "Kirghiz, Kyrgyz"},
|
||||
{"kv", "Komi"},
|
||||
{"kg", "Kongo"},
|
||||
{"ko", "Korean"},
|
||||
{"ku", "Kurdish"},
|
||||
{"kj", "Kuanyama, Kwanyama"},
|
||||
{"la", "Latin"},
|
||||
{"lb", "Luxembourgish, Letzeburgesch"},
|
||||
{"lg", "Ganda"},
|
||||
{"li", "Limburgan, Limburger, Limburgish"},
|
||||
{"ln", "Lingala"},
|
||||
{"lo", "Lao"},
|
||||
{"lt", "Lithuanian"},
|
||||
{"lu", "Luba-Katanga"},
|
||||
{"lv", "Latvian"},
|
||||
{"gv", "Manx"},
|
||||
{"mk", "Macedonian"},
|
||||
{"mg", "Malagasy"},
|
||||
{"ms", "Malay"},
|
||||
{"ml", "Malayalam"},
|
||||
{"mt", "Maltese"},
|
||||
{"mi", "Maori"},
|
||||
{"mr", "Marathi"},
|
||||
{"mh", "Marshallese"},
|
||||
{"mn", "Mongolian"},
|
||||
{"na", "Nauru"},
|
||||
{"nv", "Navajo, Navaho"},
|
||||
{"nd", "North Ndebele"},
|
||||
{"ne", "Nepali"},
|
||||
{"ng", "Ndonga"},
|
||||
{"nb", "Norwegian Bokmål"},
|
||||
{"nn", "Norwegian Nynorsk"},
|
||||
{"no", "Norwegian"},
|
||||
{"ii", "Sichuan Yi, Nuosu"},
|
||||
{"nr", "South Ndebele"},
|
||||
{"oc", "Occitan"},
|
||||
{"oj", "Ojibwa"},
|
||||
{"cu", "Church Slavic, Old Slavonic, Church Slavonic, Old Bulgarian, Old Church Slavonic"},
|
||||
{"om", "Oromo"},
|
||||
{"or", "Oriya"},
|
||||
{"os", "Ossetian, Ossetic"},
|
||||
{"pa", "Panjabi, Punjabi"},
|
||||
{"pi", "Pali"},
|
||||
{"fa", "Persian"},
|
||||
{"pl", "Polish"},
|
||||
{"ps", "Pashto, Pushto"},
|
||||
{"pt", "Portuguese"},
|
||||
{"qu", "Quechua"},
|
||||
{"rm", "Romansh"},
|
||||
{"rn", "Rundi"},
|
||||
{"ro", "Romanian, Moldavian, Moldovan"},
|
||||
{"ru", "Russian"},
|
||||
{"sa", "Sanskrit"},
|
||||
{"sc", "Sardinian"},
|
||||
{"sd", "Sindhi"},
|
||||
{"se", "Northern, Sami"},
|
||||
{"sh", "Serbo-Croatian"},
|
||||
{"sm", "Samoan"},
|
||||
{"sg", "Sango"},
|
||||
{"sr", "Serbian"},
|
||||
{"gd", "Gaelic, Scottish Gaelic"},
|
||||
{"sn", "Shona"},
|
||||
{"si", "Sinhala, Sinhalese"},
|
||||
{"sk", "Slovak"},
|
||||
{"sl", "Slovenian"},
|
||||
{"so", "Somali"},
|
||||
{"st", "Southern Sotho"},
|
||||
{"es", "Spanish, Castilian"},
|
||||
{"su", "Sundanese"},
|
||||
{"sw", "Swahili"},
|
||||
{"ss", "Swati"},
|
||||
{"sv", "Swedish"},
|
||||
{"ta", "Tamil"},
|
||||
{"te", "Telugu"},
|
||||
{"tg", "Tajik"},
|
||||
{"th", "Thai"},
|
||||
{"ti", "Tigrinya"},
|
||||
{"bo", "Tibetan"},
|
||||
{"tk", "Turkmen"},
|
||||
{"tl", "Tagalog"},
|
||||
{"tn", "Tswana"},
|
||||
{"to", "Tonga (Tonga Islands)"},
|
||||
{"tr", "Turkish"},
|
||||
{"ts", "Tsonga"},
|
||||
{"tt", "Tatar"},
|
||||
{"tw", "Twi"},
|
||||
{"ty", "Tahitian"},
|
||||
{"ug", "Uighur, Uyghur"},
|
||||
{"uk", "Ukrainian"},
|
||||
{"ur", "Urdu"},
|
||||
{"uz", "Uzbek"},
|
||||
{"ve", "Venda"},
|
||||
{"vi", "Vietnamese"},
|
||||
{"vo", "Volapük"},
|
||||
{"wa", "Walloon"},
|
||||
{"cy", "Welsh"},
|
||||
{"wo", "Wolof"},
|
||||
{"fy", "Western Frisian"},
|
||||
{"xh", "Xhosa"},
|
||||
{"yi", "Yiddish"},
|
||||
{"yo", "Yoruba"},
|
||||
{"za", "Zhuang, Chuang"},
|
||||
{"zu", "Zulu"}
|
||||
};
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRTranslatable.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRTranslatable.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: efde026722d2ae34782f3d4876e9ca31
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
69
Assets/ABI.CCK/Components/CVRVariableBuffer.cs
Executable file
69
Assets/ABI.CCK/Components/CVRVariableBuffer.cs
Executable file
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Analytics;
|
||||
|
||||
#pragma warning disable
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRVariableBuffer : MonoBehaviour
|
||||
{
|
||||
public float defaultValue = 0f;
|
||||
|
||||
[HideInInspector]
|
||||
public float value = 0f;
|
||||
|
||||
[HideInInspector]
|
||||
public List<CVRInteractable> affectedInteractables = new List<CVRInteractable>();
|
||||
private bool sendUpdate = true;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
value = defaultValue;
|
||||
}
|
||||
|
||||
public void AddInteracteable(CVRInteractable interactable)
|
||||
{
|
||||
if (!affectedInteractables.Contains(interactable))
|
||||
{
|
||||
affectedInteractables.Add(interactable);
|
||||
}
|
||||
|
||||
RemoveOrphans();
|
||||
}
|
||||
|
||||
private void RemoveOrphans()
|
||||
{
|
||||
var interactablesToRemove = new List<CVRInteractable>();
|
||||
|
||||
foreach (var interactable in affectedInteractables)
|
||||
{
|
||||
var included = false;
|
||||
|
||||
if (interactable == null) continue;
|
||||
|
||||
foreach (var action in interactable.actions)
|
||||
{
|
||||
if (action.varBufferVal == this) included = true;
|
||||
if (action.varBufferVal2 == this) included = true;
|
||||
foreach (var operation in action.operations)
|
||||
{
|
||||
if (operation.varBufferVal == this) included = true;
|
||||
if (operation.varBufferVal2 == this) included = true;
|
||||
if (operation.varBufferVal3 == this) included = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!included) interactablesToRemove.Add(interactable);
|
||||
}
|
||||
|
||||
foreach (var interactable in interactablesToRemove)
|
||||
{
|
||||
affectedInteractables.Remove(interactable);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetValue(float _value){}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRVariableBuffer.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRVariableBuffer.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 83327aad153c4576ba164cc0f0c0d3d1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
280
Assets/ABI.CCK/Components/CVRVideoPlayer.cs
Executable file
280
Assets/ABI.CCK/Components/CVRVideoPlayer.cs
Executable file
|
@ -0,0 +1,280 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditorInternal;
|
||||
#endif
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class CVRVideoPlayer : MonoBehaviour
|
||||
{
|
||||
public enum AudioMode
|
||||
{
|
||||
// Direct2D in CCK = 1
|
||||
Direct = 2,
|
||||
AudioSource = 3,
|
||||
RoomScale = 4,
|
||||
}
|
||||
|
||||
[HideInInspector]
|
||||
public string playerId;
|
||||
|
||||
public AudioMode audioPlaybackMode = AudioMode.Direct;
|
||||
public AudioSource customAudioSource;
|
||||
public List<VideoPlayerAudioSource> roomScaleAudioSources;
|
||||
[Range(0,1)] public float playbackVolume = 1f;
|
||||
public bool syncEnabled = true;
|
||||
[Range(0.5f,2)] public float localPlaybackSpeed = 1.0f;
|
||||
public CVRVideoPlayerPlaylistEntity playOnAwakeObject;
|
||||
|
||||
public RenderTexture ProjectionTexture;
|
||||
public bool interactiveUI = true;
|
||||
public bool autoplay;
|
||||
public List<Text> subtitleTextComponents;
|
||||
|
||||
public List<CVRVideoPlayerPlaylist> entities = new List<CVRVideoPlayerPlaylist>();
|
||||
|
||||
[SerializeField]
|
||||
public UnityEvent startedPlayback;
|
||||
[SerializeField]
|
||||
public UnityEvent finishedPlayback;
|
||||
[SerializeField]
|
||||
public UnityEvent pausedPlayback;
|
||||
[SerializeField]
|
||||
public UnityEvent setUrl;
|
||||
|
||||
public Transform videoPlayerUIPosition;
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
if (videoPlayerUIPosition == null || !interactiveUI) return;
|
||||
|
||||
Gizmos.color = Color.white;
|
||||
Matrix4x4 rotationMatrix = Matrix4x4.TRS(videoPlayerUIPosition.position, videoPlayerUIPosition.rotation, videoPlayerUIPosition.lossyScale);
|
||||
Gizmos.matrix = rotationMatrix;
|
||||
Gizmos.DrawWireCube(new Vector3(0, 0.62f, 0), new Vector3(2.22f, 1.24f, 0f));
|
||||
Gizmos.DrawLine(new Vector3(-1.11f, 1.11f, 0f), new Vector3(1.11f, 1.11f, 0f));
|
||||
Gizmos.DrawLine(new Vector3(-0.78f, 1.24f, 0f), new Vector3(-0.78f, 1.11f, 0f));
|
||||
|
||||
Gizmos.DrawLine(new Vector3(-0.3f, 0.75f, 0f), new Vector3(-0.3f, 0.25f, 0f));
|
||||
Gizmos.DrawLine(new Vector3(-0.3f, 0.75f, 0f), new Vector3(0.3f, 0.5f, 0f));
|
||||
Gizmos.DrawLine(new Vector3(-0.3f, 0.25f, 0f), new Vector3(0.3f, 0.5f, 0f));
|
||||
|
||||
var scale = videoPlayerUIPosition.lossyScale;
|
||||
scale.Scale(new Vector3(1f, 1f, 0f));
|
||||
rotationMatrix = Matrix4x4.TRS(videoPlayerUIPosition.position, videoPlayerUIPosition.rotation, scale);
|
||||
Gizmos.matrix = rotationMatrix;
|
||||
Gizmos.DrawWireSphere(new Vector3(1.04f, 1.174f, 0), 0.05f);
|
||||
Gizmos.DrawWireSphere(new Vector3(0.94f, 1.174f, 0), 0.05f);
|
||||
Gizmos.DrawWireSphere(new Vector3(0.84f, 1.174f, 0), 0.05f);
|
||||
Gizmos.DrawWireSphere(new Vector3(0.74f, 1.174f, 0), 0.05f);
|
||||
Gizmos.DrawWireSphere(new Vector3(0.64f, 1.174f, 0), 0.05f);
|
||||
}
|
||||
|
||||
public void Play() {}
|
||||
public void Pause() {}
|
||||
public void Previous() {}
|
||||
public void Next() {}
|
||||
public void SetUrl(string url) {}
|
||||
public void SetNetworkSync(bool sync) {}
|
||||
public void SetAudioMode(AudioMode mode) {}
|
||||
public void SetAudioMode(int mode) => SetAudioMode((AudioMode)mode);
|
||||
|
||||
}
|
||||
|
||||
public enum AudioChannelMaskFlags : int
|
||||
{
|
||||
FrontLeft = 0x1,
|
||||
FrontRight = 0x2,
|
||||
FrontCenter = 0x4,
|
||||
LowFrequency = 0x8,
|
||||
BackLeft = 0x10,
|
||||
BackRight = 0x20,
|
||||
SideLeft = 0x200,
|
||||
SideRight = 0x400,
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class VideoPlayerAudioSource
|
||||
{
|
||||
public AudioChannelMaskFlags type;
|
||||
public AudioSource audioSource;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class CVRVideoPlayerPlaylist
|
||||
{
|
||||
public string playlistThumbnailUrl;
|
||||
public string playlistTitle;
|
||||
public List<CVRVideoPlayerPlaylistEntity> playlistVideos = new List<CVRVideoPlayerPlaylistEntity>();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
private CVRVideoPlayerPlaylistEntity entity;
|
||||
public ReorderableList list;
|
||||
public bool isCollapsed;
|
||||
private CVRVideoPlayer videoPlayer;
|
||||
|
||||
public void OnDrawHeader(Rect rect)
|
||||
{
|
||||
Rect _rect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight);
|
||||
|
||||
GUI.Label(_rect, "Playlist - Videos");
|
||||
}
|
||||
|
||||
public void OnDrawElement(Rect rect, int index, bool isactive, bool isfocused)
|
||||
{
|
||||
if (index > playlistVideos.Count) return;
|
||||
entity = playlistVideos[index];
|
||||
|
||||
rect.y += 2;
|
||||
rect.x += 12;
|
||||
rect.width -= 12;
|
||||
Rect _rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight);
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
bool isCollapsed = EditorGUI.Foldout(_rect, entity.isCollapsed, "Title", true);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(videoPlayer, "Video Expand");
|
||||
entity.isCollapsed = isCollapsed;
|
||||
}
|
||||
|
||||
_rect.x += 80;
|
||||
_rect.width = rect.width - 80;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
string videoTitle = EditorGUI.TextField(_rect, entity.videoTitle);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(videoPlayer, "Video Title");
|
||||
entity.videoTitle = videoTitle;
|
||||
}
|
||||
|
||||
if (!entity.isCollapsed) return;
|
||||
|
||||
rect.y += EditorGUIUtility.singleLineHeight * 1.25f;
|
||||
_rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight);
|
||||
|
||||
EditorGUI.LabelField(_rect, "Video Url");
|
||||
_rect.x += 80;
|
||||
_rect.width = rect.width - 80;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
string videoUrl = EditorGUI.TextField(_rect, entity.videoUrl);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(videoPlayer, "Video Url");
|
||||
entity.videoUrl = videoUrl;
|
||||
}
|
||||
|
||||
rect.y += EditorGUIUtility.singleLineHeight * 1.25f;
|
||||
_rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight);
|
||||
|
||||
EditorGUI.LabelField(_rect, "Thumbnail Url");
|
||||
_rect.x += 80;
|
||||
_rect.width = rect.width - 80;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
string thumbnailUrl = EditorGUI.TextField(_rect, entity.thumbnailUrl);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(videoPlayer, "Video Thumbnail Url");
|
||||
entity.thumbnailUrl = thumbnailUrl;
|
||||
}
|
||||
|
||||
rect.y += EditorGUIUtility.singleLineHeight * 1.25f;
|
||||
_rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight);
|
||||
|
||||
EditorGUI.LabelField(_rect, "Start");
|
||||
_rect.x += 80;
|
||||
_rect.width = rect.width - 80;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
int introEndInSeconds = EditorGUI.IntField(_rect, entity.introEndInSeconds);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(videoPlayer, "Video Intro End");
|
||||
entity.introEndInSeconds = introEndInSeconds;
|
||||
}
|
||||
|
||||
rect.y += EditorGUIUtility.singleLineHeight * 1.25f;
|
||||
_rect = new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight);
|
||||
|
||||
EditorGUI.LabelField(_rect, "End");
|
||||
_rect.x += 80;
|
||||
_rect.width = rect.width - 80;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
int creditsStartInSeconds = EditorGUI.IntField(_rect, entity.creditsStartInSeconds);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(videoPlayer, "Video Credits Start");
|
||||
entity.creditsStartInSeconds = creditsStartInSeconds;
|
||||
}
|
||||
|
||||
rect.y += EditorGUIUtility.singleLineHeight * 1.25f;
|
||||
_rect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight);
|
||||
|
||||
if (GUI.Button(_rect, "Set as Play On Awake Object"))
|
||||
{
|
||||
videoPlayer.playOnAwakeObject = entity;
|
||||
}
|
||||
}
|
||||
|
||||
public float OnHeightElement(int index)
|
||||
{
|
||||
if (index > playlistVideos.Count) return EditorGUIUtility.singleLineHeight * 1.25f;
|
||||
entity = playlistVideos[index];
|
||||
|
||||
if(!entity.isCollapsed) return EditorGUIUtility.singleLineHeight * 1.25f;
|
||||
|
||||
return EditorGUIUtility.singleLineHeight * 7.5f;
|
||||
}
|
||||
|
||||
public void OnAdd(ReorderableList reorderableList)
|
||||
{
|
||||
Undo.RecordObject(videoPlayer, "Add Video Entry");
|
||||
playlistVideos.Add(null);
|
||||
}
|
||||
|
||||
public void OnChanged(ReorderableList reorderableList)
|
||||
{
|
||||
Undo.RecordObject(videoPlayer, "Video List changed");
|
||||
}
|
||||
|
||||
public ReorderableList GetReorderableList(CVRVideoPlayer player)
|
||||
{
|
||||
videoPlayer = player;
|
||||
|
||||
if (list == null)
|
||||
{
|
||||
list = new ReorderableList(playlistVideos, typeof(CVRVideoPlayerPlaylistEntity), true, true, true,
|
||||
true);
|
||||
list.drawHeaderCallback = OnDrawHeader;
|
||||
list.drawElementCallback = OnDrawElement;
|
||||
list.elementHeightCallback = OnHeightElement;
|
||||
list.onAddCallback = OnAdd;
|
||||
list.onChangedCallback = OnChanged;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class CVRVideoPlayerPlaylistEntity
|
||||
{
|
||||
public string videoUrl;
|
||||
public string videoTitle;
|
||||
public int introEndInSeconds;
|
||||
public int creditsStartInSeconds;
|
||||
public string thumbnailUrl;
|
||||
public bool isCollapsed;
|
||||
}
|
||||
|
||||
}
|
11
Assets/ABI.CCK/Components/CVRVideoPlayer.cs.meta
Executable file
11
Assets/ABI.CCK/Components/CVRVideoPlayer.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dd6327bf7e514821af46379fd775e356
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue