add some extra assets FX and SFX
This commit is contained in:
@@ -13,8 +13,9 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Combat System/Melee Combat System/Slice
|
||||
System/cuttingModeSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -24,6 +24,9 @@ public class runtimeShatterRecursive : MonoBehaviour
|
||||
public bool useCustomShatterPosition;
|
||||
public Transform customShatterPosition;
|
||||
|
||||
public bool useRandomRadiusOnShatterPosition;
|
||||
public float randomRadiusOnShatter;
|
||||
|
||||
[Space]
|
||||
[Header ("Tag and Layer Settings")]
|
||||
[Space]
|
||||
@@ -120,6 +123,13 @@ public class runtimeShatterRecursive : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void addObjectsToShatter (GameObject newObject)
|
||||
{
|
||||
if (!objectsToShatter.Contains (newObject)) {
|
||||
objectsToShatter.Add (newObject);
|
||||
}
|
||||
}
|
||||
|
||||
public GameObject [] randomShatterSingle (GameObject objectToShatter)
|
||||
{
|
||||
Vector3 shatterPosition = objectToShatter.transform.position;
|
||||
@@ -128,6 +138,13 @@ public class runtimeShatterRecursive : MonoBehaviour
|
||||
shatterPosition = customShatterPosition.position;
|
||||
}
|
||||
|
||||
if (useRandomRadiusOnShatterPosition) {
|
||||
Vector2 circlePosition = Random.insideUnitCircle * randomRadiusOnShatter;
|
||||
Vector3 newSpawnPosition = new Vector3 (circlePosition.x, circlePosition.y, 0);
|
||||
shatterPosition += newSpawnPosition;
|
||||
}
|
||||
|
||||
|
||||
GameObject [] shatters = sliceSystemUtils.shatterObject (objectToShatter, shatterPosition, crossSectionMaterial);
|
||||
|
||||
if (shatters != null && shatters.Length > 0) {
|
||||
|
||||
@@ -13,8 +13,9 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Combat System/Melee Combat System/Slice
|
||||
System/runtimeShatterRecursive.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -5,241 +5,247 @@ using UnityEngine.Events;
|
||||
|
||||
public class simpleSliceSystem : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public bool sliceEnabled = true;
|
||||
public bool sliceEnabled = true;
|
||||
|
||||
public GameObject objectToSlice;
|
||||
public GameObject objectToSlice;
|
||||
|
||||
public GameObject alternatePrefab;
|
||||
public GameObject alternatePrefab;
|
||||
|
||||
public Material infillMaterial;
|
||||
public Material infillMaterial;
|
||||
|
||||
public surfaceToSlice mainSurfaceToSlice;
|
||||
public surfaceToSlice mainSurfaceToSlice;
|
||||
|
||||
public Transform[] severables = new Transform[0];
|
||||
public Transform [] severables = new Transform [0];
|
||||
|
||||
[Space]
|
||||
[Header ("Slice Ragdoll Settings")]
|
||||
[Space]
|
||||
[Space]
|
||||
[Header ("Slice Ragdoll Settings")]
|
||||
[Space]
|
||||
|
||||
public string prefabsPath = "";
|
||||
public string prefabsPath = "";
|
||||
|
||||
public Material sliceMaterial;
|
||||
public Material sliceMaterial;
|
||||
|
||||
public bool setTagOnSkeletonRigidbodies = true;
|
||||
public bool setTagOnSkeletonRigidbodies = true;
|
||||
|
||||
public string tagOnSkeletonRigidbodies = "box";
|
||||
public string tagOnSkeletonRigidbodies = "box";
|
||||
|
||||
[Space]
|
||||
[Header ("Physics Settings")]
|
||||
[Space]
|
||||
[Space]
|
||||
[Header ("Physics Settings")]
|
||||
[Space]
|
||||
|
||||
public bool ignoreUpdateLastObjectSpeed;
|
||||
public bool ignoreUpdateLastObjectSpeed;
|
||||
|
||||
[Space]
|
||||
[Header ("Other Settings")]
|
||||
[Space]
|
||||
[Space]
|
||||
[Header ("Other Settings")]
|
||||
[Space]
|
||||
|
||||
public bool ignoreDestroyOriginalObject;
|
||||
public bool ignoreDestroyOriginalObject;
|
||||
|
||||
public UnityEvent eventsOnIgnoreDestroyOriginalObject;
|
||||
public UnityEvent eventsOnIgnoreDestroyOriginalObject;
|
||||
|
||||
[Space]
|
||||
[Space]
|
||||
|
||||
public bool setCustomIDOnSliceSpieces;
|
||||
public bool setCustomIDOnSliceSpieces;
|
||||
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
|
||||
public bool showDebugPrint;
|
||||
public bool sliceInitialized;
|
||||
public bool showDebugPrint;
|
||||
public bool sliceInitialized;
|
||||
|
||||
const string glyphs = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
const string glyphs = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
string randomString = "";
|
||||
string randomString = "";
|
||||
|
||||
|
||||
public string getRandomString ()
|
||||
{
|
||||
return randomString;
|
||||
}
|
||||
public string getRandomString ()
|
||||
{
|
||||
return randomString;
|
||||
}
|
||||
|
||||
public void setRandomString (string newValue)
|
||||
{
|
||||
if (randomString.Equals ("")) {
|
||||
randomString = newValue;
|
||||
}
|
||||
}
|
||||
public void setRandomString (string newValue)
|
||||
{
|
||||
if (randomString.Equals ("")) {
|
||||
randomString = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
public void setRandomString ()
|
||||
{
|
||||
if (setCustomIDOnSliceSpieces) {
|
||||
if (randomString.Equals ("")) {
|
||||
int charAmount = UnityEngine.Random.Range (10, 20); //set those to the minimum and maximum length of your string
|
||||
public void setRandomString ()
|
||||
{
|
||||
if (setCustomIDOnSliceSpieces) {
|
||||
if (randomString.Equals ("")) {
|
||||
int charAmount = UnityEngine.Random.Range (10, 20); //set those to the minimum and maximum length of your string
|
||||
|
||||
for (int i = 0; i < charAmount; i++) {
|
||||
randomString += glyphs [UnityEngine.Random.Range (0, glyphs.Length)];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < charAmount; i++) {
|
||||
randomString += glyphs [UnityEngine.Random.Range (0, glyphs.Length)];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void destroyAllSlicedPiecesByRandomString ()
|
||||
{
|
||||
if (setCustomIDOnSliceSpieces && randomString != "") {
|
||||
sliceSystemUtils.destroyAllSlicedPiecesByRandomString (randomString, gameObject);
|
||||
}
|
||||
}
|
||||
public void destroyAllSlicedPiecesByRandomString ()
|
||||
{
|
||||
if (setCustomIDOnSliceSpieces && randomString != "") {
|
||||
sliceSystemUtils.destroyAllSlicedPiecesByRandomString (randomString, gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
void Awake ()
|
||||
{
|
||||
if (sliceEnabled) {
|
||||
initializeValuesOnHackableComponent ();
|
||||
}
|
||||
}
|
||||
void Awake ()
|
||||
{
|
||||
if (sliceEnabled) {
|
||||
initializeValuesOnHackableComponent ();
|
||||
}
|
||||
}
|
||||
|
||||
public void initializeValuesOnHackableComponent ()
|
||||
{
|
||||
if (sliceInitialized) {
|
||||
return;
|
||||
}
|
||||
public void initializeValuesOnHackableComponent ()
|
||||
{
|
||||
if (sliceInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
sliceSystemUtils.initializeValuesOnHackableComponent (gameObject, this);
|
||||
|
||||
sliceInitialized = true;
|
||||
}
|
||||
sliceSystemUtils.initializeValuesOnHackableComponent (gameObject, this);
|
||||
|
||||
public void setDestructionPending (bool state)
|
||||
{
|
||||
sliceSystemUtils.setDestructionPending (gameObject, state);
|
||||
}
|
||||
sliceInitialized = true;
|
||||
}
|
||||
|
||||
public void activateSlice (Collider objectCollider, Vector3 newNormalInWorldSpaceValue,
|
||||
Vector3 positionInWorldSpace, Vector3 slicePosition, bool updateLastObjectSpeed, Vector3 lastSpeed)
|
||||
{
|
||||
if (!sliceEnabled) {
|
||||
return;
|
||||
}
|
||||
public void setDestructionPending (bool state)
|
||||
{
|
||||
sliceSystemUtils.setDestructionPending (gameObject, state);
|
||||
}
|
||||
|
||||
Vector3 point = objectCollider.ClosestPointOnBounds (positionInWorldSpace);
|
||||
public void activateSlice (Collider objectCollider, Vector3 newNormalInWorldSpaceValue,
|
||||
Vector3 positionInWorldSpace, Vector3 slicePosition, bool updateLastObjectSpeed, Vector3 lastSpeed)
|
||||
{
|
||||
if (!sliceEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainSurfaceToSlice.useParticlesOnSlice) {
|
||||
Quaternion particlesRotation = Quaternion.LookRotation (newNormalInWorldSpaceValue);
|
||||
Vector3 point = objectCollider.ClosestPointOnBounds (positionInWorldSpace);
|
||||
|
||||
Instantiate (mainSurfaceToSlice.particlesOnSlicePrefab, slicePosition, particlesRotation);
|
||||
}
|
||||
if (mainSurfaceToSlice.useParticlesOnSlice) {
|
||||
Quaternion particlesRotation = Quaternion.LookRotation (newNormalInWorldSpaceValue);
|
||||
|
||||
sliceSystemUtils.sliceCharacter (objectToSlice, point, newNormalInWorldSpaceValue, updateLastObjectSpeed, lastSpeed);
|
||||
Instantiate (mainSurfaceToSlice.particlesOnSlicePrefab, slicePosition, particlesRotation);
|
||||
}
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("Activate Slice on Character " + objectToSlice.name);
|
||||
}
|
||||
}
|
||||
sliceSystemUtils.sliceCharacter (objectToSlice, point, newNormalInWorldSpaceValue, updateLastObjectSpeed, lastSpeed);
|
||||
|
||||
public void searchBodyParts ()
|
||||
{
|
||||
if (objectToSlice == null) {
|
||||
objectToSlice = gameObject;
|
||||
}
|
||||
if (showDebugPrint) {
|
||||
print ("Activate Slice on Character " + objectToSlice.name);
|
||||
}
|
||||
}
|
||||
|
||||
List<GameObject> bodyPartsList = new List<GameObject> ();
|
||||
|
||||
Component[] childrens = objectToSlice.GetComponentsInChildren (typeof(Rigidbody));
|
||||
|
||||
int childrensLength = childrens.Length;
|
||||
|
||||
for (int i = 0; i < childrensLength; i++) {
|
||||
|
||||
Rigidbody child = childrens [i] as Rigidbody;
|
||||
|
||||
Collider currentCollider = child.GetComponent<Collider> ();
|
||||
|
||||
if (currentCollider != null && !currentCollider.isTrigger) {
|
||||
|
||||
bodyPartsList.Add (child.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
severables = new Transform[bodyPartsList.Count];
|
||||
|
||||
for (int i = 0; i < bodyPartsList.Count; i++) {
|
||||
severables [i] = bodyPartsList [i].transform;
|
||||
}
|
||||
|
||||
if (!Application.isPlaying) {
|
||||
updateComponent ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setTagOnBodyParts (string newTag)
|
||||
{
|
||||
for (int i = 0; i < severables.Length; i++) {
|
||||
if (severables [i] != null) {
|
||||
severables [i].tag = newTag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GameObject getMainAlternatePrefab ()
|
||||
{
|
||||
return alternatePrefab;
|
||||
}
|
||||
|
||||
public Transform[] getSeverables ()
|
||||
{
|
||||
return severables;
|
||||
}
|
||||
public void searchBodyParts ()
|
||||
{
|
||||
if (objectToSlice == null) {
|
||||
objectToSlice = gameObject;
|
||||
}
|
||||
|
||||
public void setNewSeverablesList (GameObject newObject)
|
||||
{
|
||||
if (newObject != null) {
|
||||
genericRagdollBuilder currentGenericRagdollBuilder = newObject.GetComponent<genericRagdollBuilder> ();
|
||||
List<GameObject> bodyPartsList = new List<GameObject> ();
|
||||
|
||||
if (currentGenericRagdollBuilder != null) {
|
||||
int bonesCount = currentGenericRagdollBuilder.bones.Count;
|
||||
Component [] childrens = objectToSlice.GetComponentsInChildren (typeof (Rigidbody));
|
||||
|
||||
severables = new Transform[bonesCount];
|
||||
int childrensLength = childrens.Length;
|
||||
|
||||
for (int i = 0; i < bonesCount; i++) {
|
||||
severables [i] = currentGenericRagdollBuilder.bones [i].anchor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < childrensLength; i++) {
|
||||
|
||||
public void createRagdollPrefab ()
|
||||
{
|
||||
if (alternatePrefab == null) {
|
||||
prefabsPath = pathInfoValues.getSliceObjectsPrefabsPath ();
|
||||
Rigidbody child = childrens [i] as Rigidbody;
|
||||
|
||||
alternatePrefab = GKC_Utils.createSliceRagdollPrefab (objectToSlice, prefabsPath, sliceMaterial, setTagOnSkeletonRigidbodies, tagOnSkeletonRigidbodies);
|
||||
}
|
||||
}
|
||||
Collider currentCollider = child.GetComponent<Collider> ();
|
||||
|
||||
public void setSliceEnabledState (bool state)
|
||||
{
|
||||
sliceEnabled = state;
|
||||
if (currentCollider != null && !currentCollider.isTrigger) {
|
||||
|
||||
if (sliceEnabled) {
|
||||
initializeValuesOnHackableComponent ();
|
||||
}
|
||||
}
|
||||
bodyPartsList.Add (child.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
severables = new Transform [bodyPartsList.Count];
|
||||
|
||||
for (int i = 0; i < bodyPartsList.Count; i++) {
|
||||
severables [i] = bodyPartsList [i].transform;
|
||||
}
|
||||
|
||||
if (!Application.isPlaying) {
|
||||
updateComponent ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setTagOnBodyParts (string newTag)
|
||||
{
|
||||
for (int i = 0; i < severables.Length; i++) {
|
||||
if (severables [i] != null) {
|
||||
severables [i].tag = newTag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setSliceEnabledStateFromEditor (bool state)
|
||||
{
|
||||
sliceEnabled = state;
|
||||
public GameObject getMainAlternatePrefab ()
|
||||
{
|
||||
return alternatePrefab;
|
||||
}
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
public Transform [] getSeverables ()
|
||||
{
|
||||
return severables;
|
||||
}
|
||||
|
||||
void updateComponent ()
|
||||
{
|
||||
GKC_Utils.updateComponent (this);
|
||||
public void setNewSeverablesList (GameObject newObject)
|
||||
{
|
||||
if (newObject != null) {
|
||||
genericRagdollBuilder currentGenericRagdollBuilder = newObject.GetComponent<genericRagdollBuilder> ();
|
||||
|
||||
GKC_Utils.updateDirtyScene ("Update Simple Slice System " + gameObject.name, gameObject);
|
||||
}
|
||||
if (currentGenericRagdollBuilder != null) {
|
||||
int bonesCount = currentGenericRagdollBuilder.bones.Count;
|
||||
|
||||
severables = new Transform [bonesCount];
|
||||
|
||||
for (int i = 0; i < bonesCount; i++) {
|
||||
severables [i] = currentGenericRagdollBuilder.bones [i].anchor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void createRagdollPrefab ()
|
||||
{
|
||||
if (alternatePrefab == null) {
|
||||
prefabsPath = pathInfoValues.getSliceObjectsPrefabsPath ();
|
||||
|
||||
alternatePrefab = GKC_Utils.createSliceRagdollPrefab (objectToSlice, prefabsPath, sliceMaterial, setTagOnSkeletonRigidbodies, tagOnSkeletonRigidbodies);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSliceEnabledState (bool state)
|
||||
{
|
||||
sliceEnabled = state;
|
||||
|
||||
if (sliceEnabled) {
|
||||
initializeValuesOnHackableComponent ();
|
||||
}
|
||||
}
|
||||
|
||||
public void setMainSurfaceToSlice (surfaceToSlice newSurface)
|
||||
{
|
||||
mainSurfaceToSlice = newSurface;
|
||||
}
|
||||
|
||||
//EDITOR FUNCTIONS
|
||||
public void setSliceEnabledStateFromEditor (bool state)
|
||||
{
|
||||
sliceEnabled = state;
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
|
||||
void updateComponent ()
|
||||
{
|
||||
GKC_Utils.updateComponent (this);
|
||||
|
||||
GKC_Utils.updateDirtyScene ("Update Simple Slice System " + gameObject.name, gameObject);
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,9 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Combat System/Melee Combat System/Slice
|
||||
System/simpleSliceSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -394,6 +394,8 @@ public class sliceSystem : MonoBehaviour
|
||||
|
||||
currentSurfaceToSlice.checkEventBeforeSlice ();
|
||||
|
||||
currentSurfaceToSlice.checkEventsOnIgnoreDestroyOriginalObject ();
|
||||
|
||||
currentSurfaceToSlice.getMainSimpleSliceSystem ().activateSlice (objectCollider, positionInWorldSpace,
|
||||
normalInWorldSpace, slicePosition, updateLastObjectSpeed, lastSpeed);
|
||||
|
||||
@@ -418,6 +420,8 @@ public class sliceSystem : MonoBehaviour
|
||||
|
||||
currentSurfaceToSlice.checkEventBeforeSlice ();
|
||||
|
||||
currentSurfaceToSlice.checkEventsOnIgnoreDestroyOriginalObject ();
|
||||
|
||||
obj = currentSurfaceToSlice.getMainSurfaceToSlice ();
|
||||
|
||||
sliceSystemUtils.sliceObject (currentCutPosition, obj, currentCutUp, crossSectionMaterial, ref objectSliced, ref object1, ref object2);
|
||||
@@ -542,6 +546,11 @@ public class sliceSystem : MonoBehaviour
|
||||
}
|
||||
|
||||
obj.SetActive (false);
|
||||
|
||||
if (currentSurfaceToSlice.useEventToSendNewSlicedParts) {
|
||||
currentSurfaceToSlice.eventToSendNewSlicedParts.Invoke (object1);
|
||||
currentSurfaceToSlice.eventToSendNewSlicedParts.Invoke (object2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,9 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Combat System/Melee Combat System/Slice
|
||||
System/sliceSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -2,84 +2,84 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
//using EzySlice;
|
||||
using EzySlice;
|
||||
|
||||
//using NobleMuffins.LimbHacker.Guts;
|
||||
//using NobleMuffins.LimbHacker;
|
||||
using NobleMuffins.LimbHacker.Guts;
|
||||
using NobleMuffins.LimbHacker;
|
||||
|
||||
public class sliceSystemUtils : MonoBehaviour
|
||||
{
|
||||
|
||||
public static void sliceObject (Vector3 slicePosition, GameObject objectToSlice, Vector3 cutDirection, Material crossSectionMaterial, ref bool objectSliced, ref GameObject object1, ref GameObject object2)
|
||||
{
|
||||
//SlicedHull hull = objectToSlice.SliceObject (slicePosition, cutDirection, crossSectionMaterial);
|
||||
SlicedHull hull = objectToSlice.SliceObject (slicePosition, cutDirection, crossSectionMaterial);
|
||||
|
||||
//if (hull != null) {
|
||||
if (hull != null) {
|
||||
|
||||
// objectSliced = true;
|
||||
objectSliced = true;
|
||||
|
||||
// object1 = hull.CreateLowerHull (objectToSlice, crossSectionMaterial);
|
||||
// object2 = hull.CreateUpperHull (objectToSlice, crossSectionMaterial);
|
||||
//}
|
||||
object1 = hull.CreateLowerHull (objectToSlice, crossSectionMaterial);
|
||||
object2 = hull.CreateUpperHull (objectToSlice, crossSectionMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
public static surfaceToSlice getSurfaceToSlice (GameObject currentSurface)
|
||||
{
|
||||
//ChildOfHackable currentChildOfHackable = currentSurface.GetComponent<ChildOfHackable> ();
|
||||
ChildOfHackable currentChildOfHackable = currentSurface.GetComponent<ChildOfHackable> ();
|
||||
|
||||
//if (currentChildOfHackable != null) {
|
||||
// return currentChildOfHackable.parentHackable.mainSurfaceToSlice;
|
||||
//}
|
||||
if (currentChildOfHackable != null) {
|
||||
return currentChildOfHackable.parentHackable.mainSurfaceToSlice;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void initializeValuesOnHackableComponent (GameObject objectToUse, simpleSliceSystem currentSimpleSliceSystem)
|
||||
{
|
||||
//Hackable currentHackable = objectToUse.GetComponent<Hackable> ();
|
||||
Hackable currentHackable = objectToUse.GetComponent<Hackable> ();
|
||||
|
||||
//if (currentHackable == null) {
|
||||
// currentHackable = objectToUse.AddComponent<Hackable> ();
|
||||
//}
|
||||
if (currentHackable == null) {
|
||||
currentHackable = objectToUse.AddComponent<Hackable> ();
|
||||
}
|
||||
|
||||
//currentHackable.mainSurfaceToSlice = currentSimpleSliceSystem.mainSurfaceToSlice;
|
||||
currentHackable.mainSurfaceToSlice = currentSimpleSliceSystem.mainSurfaceToSlice;
|
||||
|
||||
//currentHackable.alternatePrefab = currentSimpleSliceSystem.getMainAlternatePrefab ();
|
||||
currentHackable.alternatePrefab = currentSimpleSliceSystem.getMainAlternatePrefab ();
|
||||
|
||||
//currentHackable.objectToSlice = currentSimpleSliceSystem.objectToSlice;
|
||||
currentHackable.objectToSlice = currentSimpleSliceSystem.objectToSlice;
|
||||
|
||||
//currentHackable.infillMaterial = currentSimpleSliceSystem.infillMaterial;
|
||||
currentHackable.infillMaterial = currentSimpleSliceSystem.infillMaterial;
|
||||
|
||||
//currentHackable.severables = currentSimpleSliceSystem.getSeverables ();
|
||||
currentHackable.severables = currentSimpleSliceSystem.getSeverables ();
|
||||
|
||||
//currentHackable.ignoreUpdateLastObjectSpeed = currentSimpleSliceSystem.ignoreUpdateLastObjectSpeed;
|
||||
currentHackable.ignoreUpdateLastObjectSpeed = currentSimpleSliceSystem.ignoreUpdateLastObjectSpeed;
|
||||
|
||||
//currentHackable.ignoreDestroyOriginalObject = currentSimpleSliceSystem.ignoreDestroyOriginalObject;
|
||||
currentHackable.ignoreDestroyOriginalObject = currentSimpleSliceSystem.ignoreDestroyOriginalObject;
|
||||
|
||||
//currentHackable.eventsOnIgnoreDestroyOriginalObject = currentSimpleSliceSystem.eventsOnIgnoreDestroyOriginalObject;
|
||||
currentHackable.eventsOnIgnoreDestroyOriginalObject = currentSimpleSliceSystem.eventsOnIgnoreDestroyOriginalObject;
|
||||
|
||||
//currentHackable.setCustomIDOnSliceSpieces = currentSimpleSliceSystem.setCustomIDOnSliceSpieces;
|
||||
currentHackable.setCustomIDOnSliceSpieces = currentSimpleSliceSystem.setCustomIDOnSliceSpieces;
|
||||
|
||||
//if (currentSimpleSliceSystem.setCustomIDOnSliceSpieces) {
|
||||
// currentSimpleSliceSystem.setRandomString ();
|
||||
if (currentSimpleSliceSystem.setCustomIDOnSliceSpieces) {
|
||||
currentSimpleSliceSystem.setRandomString ();
|
||||
|
||||
// currentHackable.setRandomString (currentSimpleSliceSystem.getRandomString ());
|
||||
//}
|
||||
currentHackable.setRandomString (currentSimpleSliceSystem.getRandomString ());
|
||||
}
|
||||
|
||||
//currentHackable.initializeValues ();
|
||||
currentHackable.initializeValues ();
|
||||
}
|
||||
|
||||
public static void setDestructionPending (GameObject objectToUse, bool state)
|
||||
{
|
||||
//Hackable currentHackable = objectToUse.GetComponent<Hackable> ();
|
||||
Hackable currentHackable = objectToUse.GetComponent<Hackable> ();
|
||||
|
||||
//if (currentHackable == null) {
|
||||
// currentHackable = objectToUse.AddComponent<Hackable> ();
|
||||
//}
|
||||
if (currentHackable == null) {
|
||||
currentHackable = objectToUse.AddComponent<Hackable> ();
|
||||
}
|
||||
|
||||
//if (currentHackable != null) {
|
||||
// currentHackable.setDestructionPending (state);
|
||||
//}
|
||||
if (currentHackable != null) {
|
||||
currentHackable.setDestructionPending (state);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sliceCharacter (GameObject objectToSlice, Vector3 point, Vector3 newNormalInWorldSpaceValue,
|
||||
@@ -89,46 +89,46 @@ public class sliceSystemUtils : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
//Hackable currentHackable = objectToSlice.GetComponent<Hackable> ();
|
||||
Hackable currentHackable = objectToSlice.GetComponent<Hackable> ();
|
||||
|
||||
//if (currentHackable != null) {
|
||||
// currentHackable.activateSlice (objectToSlice, point, newNormalInWorldSpaceValue, updateLastObjectSpeed, lastSpeed);
|
||||
//}
|
||||
if (currentHackable != null) {
|
||||
currentHackable.activateSlice (objectToSlice, point, newNormalInWorldSpaceValue, updateLastObjectSpeed, lastSpeed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static GameObject[] shatterObject (GameObject obj, Vector3 shatterPosition, Material crossSectionMaterial = null, bool shaterActive = true)
|
||||
{
|
||||
//if (shaterActive) {
|
||||
// return obj.SliceInstantiate (getRandomPlane (shatterPosition, obj.transform.localScale),
|
||||
// new TextureRegion (0.0f, 0.0f, 1.0f, 1.0f),
|
||||
// crossSectionMaterial);
|
||||
//}
|
||||
if (shaterActive) {
|
||||
return obj.SliceInstantiate (getRandomPlane (shatterPosition, obj.transform.localScale),
|
||||
new TextureRegion (0.0f, 0.0f, 1.0f, 1.0f),
|
||||
crossSectionMaterial);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
//public static EzySlice.Plane getRandomPlane (Vector3 positionOffset, Vector3 scaleOffset)
|
||||
//{
|
||||
// Vector3 randomPosition = Random.insideUnitSphere;
|
||||
// Vector3 randomDirection = Random.insideUnitSphere.normalized;
|
||||
public static EzySlice.Plane getRandomPlane (Vector3 positionOffset, Vector3 scaleOffset)
|
||||
{
|
||||
Vector3 randomPosition = Random.insideUnitSphere;
|
||||
Vector3 randomDirection = Random.insideUnitSphere.normalized;
|
||||
|
||||
// return new EzySlice.Plane (randomPosition, randomDirection);
|
||||
//}
|
||||
return new EzySlice.Plane (randomPosition, randomDirection);
|
||||
}
|
||||
|
||||
public static void destroyAllSlicedPiecesByRandomString (string stringValue, GameObject mainObjectToIgnore)
|
||||
{
|
||||
//Hackable[] HackableList = FindObjectsOfType<Hackable> ();
|
||||
Hackable[] HackableList = FindObjectsOfType<Hackable> ();
|
||||
|
||||
//int HackableListLength = HackableList.Length;
|
||||
int HackableListLength = HackableList.Length;
|
||||
|
||||
//for (int i = 0; i < HackableListLength; i++) {
|
||||
// Hackable currentHackable = HackableList [i] as Hackable;
|
||||
for (int i = 0; i < HackableListLength; i++) {
|
||||
Hackable currentHackable = HackableList [i] as Hackable;
|
||||
|
||||
// if (mainObjectToIgnore != currentHackable.gameObject && currentHackable.getRandomString ().Equals (stringValue)) {
|
||||
// Destroy (currentHackable.gameObject);
|
||||
// }
|
||||
//}
|
||||
if (mainObjectToIgnore != currentHackable.gameObject && currentHackable.getRandomString ().Equals (stringValue)) {
|
||||
Destroy (currentHackable.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -220,7 +220,9 @@ public class sliceSystemUtils : MonoBehaviour
|
||||
Debug.DrawRay (rayDirection1, rayDirection2, Color.blue, 5);
|
||||
}
|
||||
|
||||
currentSurfaceToSlice.checkEventBeforeSlice ();
|
||||
currentSurfaceToSlice.checkEventsOnIgnoreDestroyOriginalObject ();
|
||||
|
||||
currentSurfaceToSlice.checkEventBeforeSlice ();
|
||||
|
||||
currentSurfaceToSlice.getMainSimpleSliceSystem ().activateSlice (objectCollider, positionInWorldSpace,
|
||||
normalInWorldSpace, slicePosition, true, lastSpeed);
|
||||
@@ -240,6 +242,8 @@ public class sliceSystemUtils : MonoBehaviour
|
||||
sliceDirection = Quaternion.Euler (Random.Range (0, 361) * sliceForwardDirection) * sliceDirection;
|
||||
}
|
||||
|
||||
currentSurfaceToSlice.checkEventsOnIgnoreDestroyOriginalObject ();
|
||||
|
||||
currentSurfaceToSlice.checkEventBeforeSlice ();
|
||||
|
||||
objectToCheck = currentSurfaceToSlice.getMainSurfaceToSlice ();
|
||||
@@ -349,7 +353,12 @@ public class sliceSystemUtils : MonoBehaviour
|
||||
}
|
||||
|
||||
objectToCheck.SetActive (false);
|
||||
}
|
||||
|
||||
if (currentSurfaceToSlice.useEventToSendNewSlicedParts) {
|
||||
currentSurfaceToSlice.eventToSendNewSlicedParts.Invoke (object1);
|
||||
currentSurfaceToSlice.eventToSendNewSlicedParts.Invoke (object2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,9 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Combat System/Melee Combat System/Slice
|
||||
System/sliceSystemUtils.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
Reference in New Issue
Block a user