upgrade CCK to v3.5
This commit is contained in:
parent
6fe98b333d
commit
3005cfc8aa
43 changed files with 1213 additions and 289 deletions
209
Assets/ABI.CCK/Components/AnimatorDriver.cs
Executable file
209
Assets/ABI.CCK/Components/AnimatorDriver.cs
Executable file
|
@ -0,0 +1,209 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class AnimatorDriver : StateMachineBehaviour
|
||||
{
|
||||
public List<AnimatorDriverTask> EnterTasks = new List<AnimatorDriverTask>();
|
||||
public List<AnimatorDriverTask> ExitTasks = new List<AnimatorDriverTask>();
|
||||
|
||||
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
{
|
||||
foreach (var task in EnterTasks)
|
||||
{
|
||||
task.Execute(animator);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
{
|
||||
foreach (var task in ExitTasks)
|
||||
{
|
||||
task.Execute(animator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class AnimatorDriverTask
|
||||
{
|
||||
public enum Operator
|
||||
{
|
||||
Set,
|
||||
Addition,
|
||||
Subtraction,
|
||||
Multiplication,
|
||||
Division,
|
||||
Modulo,
|
||||
Power,
|
||||
Log,
|
||||
Equal,
|
||||
NotEqual,
|
||||
LessThen,
|
||||
LessEqual,
|
||||
MoreThen,
|
||||
MoreEqual
|
||||
}
|
||||
|
||||
public enum SourceType
|
||||
{
|
||||
Static,
|
||||
Parameter,
|
||||
Random
|
||||
}
|
||||
|
||||
public enum ParameterType
|
||||
{
|
||||
None,
|
||||
Float,
|
||||
Int,
|
||||
Bool,
|
||||
Trigger
|
||||
}
|
||||
|
||||
public ParameterType targetType = ParameterType.None;
|
||||
public string targetName = "";
|
||||
|
||||
public Operator op = Operator.Set;
|
||||
|
||||
public SourceType aType = SourceType.Static;
|
||||
public float aValue = 0f;
|
||||
public float aMax = 1f;
|
||||
public ParameterType aParamType;
|
||||
public string aName = "";
|
||||
|
||||
public SourceType bType = SourceType.Static;
|
||||
public float bValue = 0f;
|
||||
public float bMax = 1f;
|
||||
public ParameterType bParamType;
|
||||
public string bName = "";
|
||||
|
||||
public void Execute(Animator animator)
|
||||
{
|
||||
float valA = 0f;
|
||||
float valB = 0f;
|
||||
float res = 0f;
|
||||
|
||||
switch (aType)
|
||||
{
|
||||
case SourceType.Static:
|
||||
valA = aValue;
|
||||
break;
|
||||
case SourceType.Random:
|
||||
valA = Random.Range(aValue, aMax);
|
||||
break;
|
||||
case SourceType.Parameter:
|
||||
switch (aParamType)
|
||||
{
|
||||
default:
|
||||
valA = 0f;
|
||||
break;
|
||||
case ParameterType.Bool:
|
||||
valA = animator.GetBool(aName) ? 1f : 0f;
|
||||
break;
|
||||
case ParameterType.Float:
|
||||
valA = animator.GetFloat(aName);
|
||||
break;
|
||||
case ParameterType.Int:
|
||||
valA = animator.GetInteger(aName);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (op == Operator.Set)
|
||||
{
|
||||
res = valA;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (bType)
|
||||
{
|
||||
case SourceType.Static:
|
||||
valB = bValue;
|
||||
break;
|
||||
case SourceType.Random:
|
||||
valB = Random.Range(bValue, aMax);
|
||||
break;
|
||||
case SourceType.Parameter:
|
||||
switch (aParamType)
|
||||
{
|
||||
default:
|
||||
valB = 0f;
|
||||
break;
|
||||
case ParameterType.Bool:
|
||||
valB = animator.GetBool(bName) ? 1f : 0f;
|
||||
break;
|
||||
case ParameterType.Float:
|
||||
valB = animator.GetFloat(bName);
|
||||
break;
|
||||
case ParameterType.Int:
|
||||
valB = animator.GetInteger(bName);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case Operator.Addition:
|
||||
res = valA + valB;
|
||||
break;
|
||||
case Operator.Subtraction:
|
||||
res = valA - valB;
|
||||
break;
|
||||
case Operator.Multiplication:
|
||||
res = valA * valB;
|
||||
break;
|
||||
case Operator.Division:
|
||||
res = valA / valB;
|
||||
break;
|
||||
case Operator.Modulo:
|
||||
res = valA % valB;
|
||||
break;
|
||||
case Operator.Power:
|
||||
res = Mathf.Pow(valA, valB);
|
||||
break;
|
||||
case Operator.Log:
|
||||
res = Mathf.Log(valA, valB);
|
||||
break;
|
||||
case Operator.Equal:
|
||||
res = valA == valB ? 1f : 0f;
|
||||
break;
|
||||
case Operator.NotEqual:
|
||||
res = valA != valB ? 1f : 0f;
|
||||
break;
|
||||
case Operator.LessThen:
|
||||
res = valA < valB ? 1f : 0f;
|
||||
break;
|
||||
case Operator.LessEqual:
|
||||
res = valA <= valB ? 1f : 0f;
|
||||
break;
|
||||
case Operator.MoreThen:
|
||||
res = valA > valB ? 1f : 0f;
|
||||
break;
|
||||
case Operator.MoreEqual:
|
||||
res = valA >= valB ? 1f : 0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (targetType)
|
||||
{
|
||||
case ParameterType.Bool:
|
||||
animator.SetBool(targetName, res >= 0.5f);
|
||||
break;
|
||||
case ParameterType.Trigger:
|
||||
if (res >= 0.5f) animator.SetTrigger(targetName);
|
||||
break;
|
||||
case ParameterType.Float:
|
||||
animator.SetFloat(targetName, res);
|
||||
break;
|
||||
case ParameterType.Int:
|
||||
animator.SetInteger(targetName, (int) res);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/AnimatorDriver.cs.meta
Executable file
11
Assets/ABI.CCK/Components/AnimatorDriver.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6007a7c7844c4bcc994fd9111bf4d5a5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -17,5 +17,8 @@ namespace ABI.CCK.Components
|
|||
|
||||
public AssetType type;
|
||||
public string objectId;
|
||||
|
||||
[HideInInspector]
|
||||
public string randomNum;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
|
@ -10,6 +11,7 @@ namespace ABI.CCK.Components
|
|||
{
|
||||
Bone = 1,
|
||||
Tracker = 2,
|
||||
SnappingPoint = 4,
|
||||
}
|
||||
|
||||
public AttachmentType attachmentType;
|
||||
|
@ -52,6 +54,8 @@ namespace ABI.CCK.Components
|
|||
}
|
||||
|
||||
public TrackerType trackerType = 0;
|
||||
|
||||
public List<string> snappingPointTypes = new List<string>();
|
||||
|
||||
public bool useFixedPositionOffset = false;
|
||||
public bool useFixedRotationOffset = false;
|
||||
|
|
|
@ -37,6 +37,8 @@ namespace ABI.CCK.Components
|
|||
|
||||
public CVRAvatarVisemeMode visemeMode = CVRAvatarVisemeMode.Visemes;
|
||||
|
||||
public int visemeSmoothing = 50;
|
||||
|
||||
public string[] visemeBlendshapes = new string[15];
|
||||
|
||||
[Space] [Header("Avatar customization")] [Space]
|
||||
|
@ -82,8 +84,8 @@ namespace ABI.CCK.Components
|
|||
FlashingLights = 16,
|
||||
Violence = 32,
|
||||
Gore = 64,
|
||||
//Suggestive = 128,
|
||||
//Nudity = 256,
|
||||
Suggestive = 128,
|
||||
Nudity = 256,
|
||||
Horror = 512
|
||||
}
|
||||
|
||||
|
|
|
@ -123,6 +123,11 @@ namespace ABI.CCK.Components
|
|||
Alpha7 = KeyCode.Alpha7,
|
||||
Alpha8 = KeyCode.Alpha8,
|
||||
Alpha9 = KeyCode.Alpha9,
|
||||
LeftShift = KeyCode.LeftShift,
|
||||
RightShift = KeyCode.RightShift,
|
||||
LeftControl = KeyCode.LeftControl,
|
||||
RightControl = KeyCode.RightControl,
|
||||
Space = KeyCode.Space,
|
||||
InputHorizontalNegative = 10000,
|
||||
InputHorizontalPositive = 10001,
|
||||
InputVerticalNegative = 10002,
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace ABI.CCK.Components
|
|||
DisplayWorldDetailPage = 13,
|
||||
DisplayInstanceDetailPage = 14,
|
||||
DisplayAvatarDetailPage = 15,
|
||||
DisplaySpawnableDetailPage = 37,
|
||||
SitAtPosition = 16,
|
||||
MethodCall = 21,
|
||||
SetSpawnableValue = 22,
|
||||
|
|
|
@ -24,12 +24,15 @@ namespace ABI.CCK.Components
|
|||
|
||||
[Header("Events")]
|
||||
public UnityEvent playerDownEvent = new UnityEvent();
|
||||
public UnityEvent playerHitEvent = new UnityEvent();
|
||||
public UnityEvent playerRespawnEvent = new UnityEvent();
|
||||
public UnityEvent playerRevitalizeEvent = new UnityEvent();
|
||||
|
||||
[Header("PVP Events")]
|
||||
public UnityEvent playerDownedEvent = new UnityEvent();
|
||||
public UnityEvent downedAnotherPlayerEvent = new UnityEvent();
|
||||
public UnityEvent playerGotHitEvent = new UnityEvent();
|
||||
public UnityEvent hitAnotherPlayerEvent = new UnityEvent();
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
|
|
|
@ -103,5 +103,7 @@ namespace ABI.CCK.Components
|
|||
public UnityEvent teamLeaveEvent = new UnityEvent();
|
||||
public UnityEvent teamWinRoundEvent = new UnityEvent();
|
||||
public UnityEvent teamWinGameEvent = new UnityEvent();
|
||||
public UnityEvent teamMemberReadyEvent = new UnityEvent();
|
||||
public UnityEvent teamMemberUnReadyEvent = new UnityEvent();
|
||||
}
|
||||
}
|
|
@ -25,6 +25,15 @@ namespace ABI.CCK.Components
|
|||
public FiringMode firingMode = FiringMode.HalfAuto;
|
||||
public float firingRate = 1f;
|
||||
public float reloadTime = 1f;
|
||||
|
||||
public enum HitDetection
|
||||
{
|
||||
Particle = 0,
|
||||
Raycast = 1,
|
||||
}
|
||||
|
||||
public HitDetection hitDetection = HitDetection.Particle;
|
||||
public LayerMask hitMask = (1 << 0) | (1 << 8);
|
||||
|
||||
public void Shoot()
|
||||
{
|
||||
|
|
|
@ -11,11 +11,16 @@ namespace ABI.CCK.Components
|
|||
{
|
||||
Destroy = 0,
|
||||
RespawnAfterTime = 1,
|
||||
RespawnOnRoundStart = 2,
|
||||
RespawnOnRoundEnd = 3,
|
||||
RespawnOnGameStart = 4,
|
||||
RespawnOnGameEnd = 5,
|
||||
}
|
||||
[Header("Down Behavior")]
|
||||
public DownBehavior downBehavior = DownBehavior.Destroy;
|
||||
public float respawnTime = 10f;
|
||||
public Transform respawnPoint;
|
||||
public GameInstanceController connectedGameInstance;
|
||||
|
||||
[Header("Events")]
|
||||
public UnityEvent downEvent = new UnityEvent();
|
||||
|
|
20
Assets/ABI.CCK/Components/PlayerMaterialParser.cs
Executable file
20
Assets/ABI.CCK/Components/PlayerMaterialParser.cs
Executable file
|
@ -0,0 +1,20 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class PlayerMaterialParser : MonoBehaviour
|
||||
{
|
||||
public Material targetMaterial;
|
||||
|
||||
public string playerRootPositions = "_PlayerRootPositions";
|
||||
public string playerHipPositions = "_PlayerHipPositions";
|
||||
public string playerHeadPositions = "_PlayerHeadPositions";
|
||||
public string playerLeftHandPositions = "_PlayerLeftHandPositions";
|
||||
public string playerRightHandPositions = "_PlayerRightHandPositions";
|
||||
public string playerChestPositions = "_PlayerChestPositions";
|
||||
public string playerLeftFootPositions = "_PlayerLeftFootPositions";
|
||||
public string playerRightFootPositions = "_PlayerRightFootPositions";
|
||||
}
|
||||
}
|
11
Assets/ABI.CCK/Components/PlayerMaterialParser.cs.meta
Executable file
11
Assets/ABI.CCK/Components/PlayerMaterialParser.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5256473d683a24743ab8a6b352997437
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
27
Assets/ABI.CCK/Components/SpawnablePickupMarker.cs
Executable file
27
Assets/ABI.CCK/Components/SpawnablePickupMarker.cs
Executable file
|
@ -0,0 +1,27 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace ABI.CCK.Components
|
||||
{
|
||||
public class SpawnablePickupMarker : MonoBehaviour
|
||||
{
|
||||
public string spawnableGuid;
|
||||
|
||||
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/SpawnablePickupMarker.cs.meta
Executable file
11
Assets/ABI.CCK/Components/SpawnablePickupMarker.cs.meta
Executable file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: eff309c86b8103c45a87cf57553d787f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 8d4eaf52fbae23548874e96ac0d52276, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue