add some extra assets FX and SFX
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NobleMuffins.LimbHacker
|
||||
{
|
||||
public abstract class AbstractHackDecisionMaker : MonoBehaviour
|
||||
{
|
||||
public abstract bool ShouldHack(string joint);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ebabc4cd40e94187b63d947f0fc3b42
|
||||
timeCreated: 1464179993
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Integrations/LimbHacker-master/Components/AbstractHackDecisionMaker.cs
|
||||
uploadId: 889948
|
||||
@@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NobleMuffins.LimbHacker
|
||||
{
|
||||
public abstract class AbstractSliceHandler : MonoBehaviour
|
||||
{
|
||||
public virtual void handleSlice (GameObject[] results)
|
||||
{
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
public virtual bool cloneAlternate (Dictionary<string, bool> hierarchyPresence)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 66a32b063468a4a3e98026538aa9e370
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Integrations/LimbHacker-master/Components/AbstractSliceHandler.cs
|
||||
uploadId: 889948
|
||||
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ffb733fbd886c4e76a6ea9222cfec159
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Integrations/LimbHacker-master/Components/Attachable
|
||||
Slicer.prefab
|
||||
uploadId: 889948
|
||||
@@ -0,0 +1,268 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using NobleMuffins.LimbHacker.Guts;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace NobleMuffins.LimbHacker
|
||||
{
|
||||
public class Hackable : MonoBehaviour, ISliceable
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public InfillMode infillMode = InfillMode.Sloppy;
|
||||
|
||||
public bool ignoreUpdateLastObjectSpeed;
|
||||
|
||||
public bool ignoreDestroyOriginalObject;
|
||||
|
||||
public bool setCustomIDOnSliceSpieces;
|
||||
|
||||
public string randomString = "";
|
||||
|
||||
public bool destructionPending = false;
|
||||
|
||||
[Space]
|
||||
[Header ("Parts To Slice Settings")]
|
||||
[Space]
|
||||
|
||||
public Transform [] severables = new Transform [0];
|
||||
|
||||
[Space]
|
||||
[Header ("Events Settings")]
|
||||
[Space]
|
||||
|
||||
public UnityEvent eventsOnIgnoreDestroyOriginalObject;
|
||||
|
||||
[Space]
|
||||
[Header ("Components")]
|
||||
[Space]
|
||||
|
||||
public surfaceToSlice mainSurfaceToSlice;
|
||||
|
||||
public GameObject objectToSlice;
|
||||
|
||||
public UnityEngine.Object alternatePrefab = null;
|
||||
|
||||
public Material infillMaterial = null;
|
||||
|
||||
|
||||
public Dictionary<string, float> maximumTiltBySeverableName = new Dictionary<string, float> ();
|
||||
|
||||
bool valuesInitialized;
|
||||
|
||||
bool updateLastObjectSpeed;
|
||||
Vector3 lastSpeed = Vector3.zero;
|
||||
|
||||
|
||||
public string getRandomString ()
|
||||
{
|
||||
return randomString;
|
||||
}
|
||||
|
||||
public void setRandomString (string newValue)
|
||||
{
|
||||
if (randomString.Equals ("")) {
|
||||
randomString = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
public void initializeValues ()
|
||||
{
|
||||
if (objectToSlice == null) {
|
||||
objectToSlice = gameObject;
|
||||
}
|
||||
|
||||
foreach (Transform bodyPart in severables) {
|
||||
if (bodyPart != null) {
|
||||
ChildOfHackable referencer = bodyPart.GetComponent<ChildOfHackable> ();
|
||||
|
||||
if (referencer == null)
|
||||
referencer = bodyPart.gameObject.AddComponent<ChildOfHackable> ();
|
||||
|
||||
referencer.parentHackable = this;
|
||||
}
|
||||
}
|
||||
|
||||
valuesInitialized = true;
|
||||
}
|
||||
|
||||
void checkInitializeValues ()
|
||||
{
|
||||
if (!valuesInitialized) {
|
||||
initializeValues ();
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<SliceEventArgs> Sliced;
|
||||
|
||||
public void Slice (Vector3 positionInWorldSpace, Vector3 normalInWorldSpace)
|
||||
{
|
||||
if (destructionPending) {
|
||||
return;
|
||||
}
|
||||
|
||||
var decisionMaker = objectToSlice.GetComponent<AbstractHackDecisionMaker> ();
|
||||
|
||||
string jointName = null;
|
||||
|
||||
float rootTipProgression = 0f;
|
||||
|
||||
if (LimbHackerAgent.DetermineSlice (this, positionInWorldSpace, ref jointName, ref rootTipProgression) && (decisionMaker == null || decisionMaker.ShouldHack (jointName))) {
|
||||
LimbHackerAgent.instance.SeverByJoint (objectToSlice, jointName, rootTipProgression, normalInWorldSpace);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleSlice (GameObject [] results, Vector4 planeInWorldSpace, Vector3 focalPointInWorldSpace)
|
||||
{
|
||||
bool originalRemainsAfterSlice = false;
|
||||
|
||||
for (int i = 0; i < results.Length; i++)
|
||||
originalRemainsAfterSlice |= results [i] == objectToSlice;
|
||||
|
||||
destructionPending = !originalRemainsAfterSlice;
|
||||
|
||||
AbstractSliceHandler [] handlers = objectToSlice.GetComponents<AbstractSliceHandler> ();
|
||||
|
||||
foreach (AbstractSliceHandler handler in handlers) {
|
||||
handler.handleSlice (results);
|
||||
}
|
||||
|
||||
if (Sliced != null) {
|
||||
Sliced (this, new SliceEventArgs (new Plane (planeInWorldSpace, planeInWorldSpace.w), focalPointInWorldSpace, results));
|
||||
|
||||
if (!ignoreUpdateLastObjectSpeed) {
|
||||
if (updateLastObjectSpeed && lastSpeed != Vector3.zero) {
|
||||
|
||||
for (int i = 0; i < results.Length; i++) {
|
||||
if (results [i] != null) {
|
||||
|
||||
Component [] currentRigidbody = results [i].GetComponentsInChildren (typeof (Rigidbody));
|
||||
foreach (Rigidbody child in currentRigidbody) {
|
||||
if (child.gameObject.activeInHierarchy) {
|
||||
child.linearVelocity = lastSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
// print (results [i].name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
updateLastObjectSpeed = false;
|
||||
|
||||
lastSpeed = Vector3.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool cloneAlternate (Dictionary<string, bool> hierarchyPresence)
|
||||
{
|
||||
if (alternatePrefab == null) {
|
||||
return false;
|
||||
} else {
|
||||
AbstractSliceHandler [] handlers = objectToSlice.GetComponents<AbstractSliceHandler> ();
|
||||
|
||||
bool result = false;
|
||||
|
||||
if (handlers.Length == 0) {
|
||||
result = true;
|
||||
} else {
|
||||
foreach (AbstractSliceHandler handler in handlers) {
|
||||
result |= handler.cloneAlternate (hierarchyPresence);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Queue<PendingSlice> pendingSlices = new Queue<PendingSlice> ();
|
||||
|
||||
bool sliceWaitingToFinish;
|
||||
|
||||
Vector3 normalInWorldSpace;
|
||||
|
||||
private List<GameObject> suppressUntilContactCeases = new List<GameObject> ();
|
||||
|
||||
class PendingSlice
|
||||
{
|
||||
public PendingSlice (Vector3 _point, ISliceable _target)
|
||||
{
|
||||
point = _point;
|
||||
target = _target;
|
||||
}
|
||||
|
||||
public readonly Vector3 point;
|
||||
public readonly ISliceable target;
|
||||
}
|
||||
|
||||
|
||||
void LateUpdate ()
|
||||
{
|
||||
if (sliceWaitingToFinish) {
|
||||
while (pendingSlices.Count > 0) {
|
||||
PendingSlice pendingSlice = pendingSlices.Dequeue ();
|
||||
|
||||
var component = pendingSlice.target as MonoBehaviour;
|
||||
|
||||
if (component != null) {
|
||||
var targetGameObject = component.gameObject;
|
||||
|
||||
if (suppressUntilContactCeases.Contains (targetGameObject) == false) {
|
||||
|
||||
pendingSlice.target.Sliced += PendingSlice_target_Sliced;
|
||||
|
||||
pendingSlice.target.Slice (pendingSlice.point, normalInWorldSpace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sliceWaitingToFinish = false;
|
||||
|
||||
ContactCeased (objectToSlice);
|
||||
}
|
||||
}
|
||||
|
||||
void PendingSlice_target_Sliced (object sender, SliceEventArgs e)
|
||||
{
|
||||
if (e.Parts.Length > 1) {
|
||||
suppressUntilContactCeases.AddRange (e.Parts);
|
||||
}
|
||||
}
|
||||
|
||||
private void ContactCeased (GameObject other)
|
||||
{
|
||||
if (suppressUntilContactCeases.Contains (other)) {
|
||||
suppressUntilContactCeases.Remove (other);
|
||||
}
|
||||
}
|
||||
|
||||
public void activateSlice (GameObject objectToSlice, Vector3 point, Vector3 newNormalInWorldSpaceValue,
|
||||
bool updateLastObjectSpeedValue, Vector3 lastSpeedValue)
|
||||
{
|
||||
checkInitializeValues ();
|
||||
|
||||
ISliceable sliceable = objectToSlice.GetComponent (typeof (ISliceable)) as ISliceable;
|
||||
|
||||
if (sliceable != null) {
|
||||
pendingSlices.Enqueue (new PendingSlice (point, sliceable));
|
||||
|
||||
normalInWorldSpace = newNormalInWorldSpaceValue;
|
||||
|
||||
sliceWaitingToFinish = true;
|
||||
|
||||
updateLastObjectSpeed = updateLastObjectSpeedValue;
|
||||
lastSpeed = lastSpeedValue;
|
||||
}
|
||||
}
|
||||
|
||||
public void setDestructionPending (bool state)
|
||||
{
|
||||
destructionPending = state;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6dd56a8ae574e4fd492ffaed7fb8e357
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Integrations/LimbHacker-master/Components/Hackable.cs
|
||||
uploadId: 889948
|
||||
@@ -0,0 +1,63 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NobleMuffins.LimbHacker
|
||||
{
|
||||
[RequireComponent(typeof(Hackable))]
|
||||
public class ToRagdollOrNot : AbstractSliceHandler
|
||||
{
|
||||
public enum Operator { And, Or };
|
||||
public enum Presentness { Equals, Not };
|
||||
|
||||
public Operator groupRule = Operator.And;
|
||||
public Presentness totalityRule = Presentness.Not;
|
||||
|
||||
public Transform[] bones;
|
||||
|
||||
public override bool cloneAlternate(Dictionary<string, bool> hierarchyPresence)
|
||||
{
|
||||
List<bool> relevantStates = new List<bool>(bones.Length);
|
||||
|
||||
foreach (Transform t in bones)
|
||||
{
|
||||
string key = t.name;
|
||||
|
||||
if (hierarchyPresence.ContainsKey(key))
|
||||
{
|
||||
relevantStates.Add(hierarchyPresence[key]);
|
||||
}
|
||||
}
|
||||
|
||||
bool totality = false;
|
||||
|
||||
if (groupRule == Operator.And)
|
||||
{
|
||||
totality = true;
|
||||
foreach (bool b in relevantStates)
|
||||
{
|
||||
totality &= b;
|
||||
}
|
||||
}
|
||||
else if (groupRule == Operator.Or)
|
||||
{
|
||||
totality = false;
|
||||
foreach (bool b in relevantStates)
|
||||
{
|
||||
totality |= b;
|
||||
}
|
||||
}
|
||||
|
||||
if (totalityRule == Presentness.Not)
|
||||
{
|
||||
totality = !totality;
|
||||
}
|
||||
|
||||
return totality;
|
||||
}
|
||||
|
||||
public override void handleSlice(GameObject[] results)
|
||||
{
|
||||
//Do nothing.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4bd7131eac6c14639b7b531425a23c8c
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Integrations/LimbHacker-master/Components/ToRagdollOrNot.cs
|
||||
uploadId: 889948
|
||||
Reference in New Issue
Block a user