plantilla base para movimiento básico
This commit is contained in:
Robii Aragon
2026-02-05 05:07:55 -08:00
parent ed7b223c04
commit fd87a6ffd5
14441 changed files with 13711084 additions and 20 deletions

View File

@@ -0,0 +1,517 @@
using UnityEngine;
using System;
using System.Collections.Generic;
using System.Collections;
public class BezierSpline : MonoBehaviour
{
public List<splinePointInfo> splinePointList = new List<splinePointInfo> ();
public List<Transform> lookDirectionList = new List<Transform> ();
public int selectedIndex = -1;
public float directionScale = 0.5f;
public float newPointOffset = 0.2f;
public float newPointBezierOffset = 0.2f;
public float handleSize = 0.04f;
public float pickSize = 0.06f;
public bool showGizmo;
public bool showLookDirectionGizmo;
public float lookDirectionGizmoRadius = 0.05f;
public float lookDirectionArrowLength = 1;
public enum BezierControlPointMode
{
Aligned,
Free,
Mirrored
}
[SerializeField]
public List<Vector3> points = new List<Vector3> ();
[SerializeField]
public List<BezierControlPointMode> modes = new List<BezierControlPointMode> ();
[SerializeField]
private bool loop;
public bool Loop {
get {
return loop;
}
set {
loop = value;
if (value == true) {
modes [modes.Count - 1] = modes [0];
SetControlPoint (0, points [0]);
}
}
}
public int ControlPointCount {
get {
return points.Count;
}
}
public Vector3 GetControlPoint (int index)
{
return points [index];
}
public void SetControlPoint (int index, Vector3 point)
{
if (index % 3 == 0) {
Vector3 delta = point - points [index];
if (loop) {
if (index == 0) {
points [1] += delta;
points [points.Count - 2] += delta;
points [points.Count - 1] = point;
} else if (index == points.Count - 1) {
points [0] = point;
points [1] += delta;
points [index - 1] += delta;
} else {
points [index - 1] += delta;
points [index + 1] += delta;
}
} else {
if (index > 0) {
points [index - 1] += delta;
}
if (index + 1 < points.Count) {
points [index + 1] += delta;
}
}
}
points [index] = point;
EnforceMode (index);
}
public BezierControlPointMode GetControlPointMode (int index)
{
return modes [(index + 1) / 3];
}
public void SetControlPointMode (int index, BezierControlPointMode mode)
{
int modeIndex = (index + 1) / 3;
modes [modeIndex] = mode;
if (loop) {
if (modeIndex == 0) {
modes [modes.Count - 1] = mode;
} else if (modeIndex == modes.Count - 1) {
modes [0] = mode;
}
}
EnforceMode (index);
}
private void EnforceMode (int index)
{
int modeIndex = (index + 1) / 3;
BezierControlPointMode mode = modes [modeIndex];
if (mode == BezierControlPointMode.Free || !loop && (modeIndex == 0 || modeIndex == modes.Count - 1)) {
return;
}
int middleIndex = modeIndex * 3;
int fixedIndex, enforcedIndex;
if (index <= middleIndex) {
fixedIndex = middleIndex - 1;
if (fixedIndex < 0) {
fixedIndex = points.Count - 2;
}
enforcedIndex = middleIndex + 1;
if (enforcedIndex >= points.Count) {
enforcedIndex = 1;
}
} else {
fixedIndex = middleIndex + 1;
if (fixedIndex >= points.Count) {
fixedIndex = 1;
}
enforcedIndex = middleIndex - 1;
if (enforcedIndex < 0) {
enforcedIndex = points.Count - 2;
}
}
Vector3 middle = points [middleIndex];
Vector3 enforcedTangent = middle - points [fixedIndex];
if (mode == BezierControlPointMode.Aligned) {
enforcedTangent = enforcedTangent.normalized * GKC_Utils.distance (middle, points [enforcedIndex]);
}
points [enforcedIndex] = middle + enforcedTangent;
}
public int CurveCount {
get {
return (points.Count - 1) / 3;
}
}
public Vector3 GetPoint (float t)
{
int i;
if (t >= 1f) {
t = 1f;
i = points.Count - 4;
} else {
t = Mathf.Clamp01 (t) * CurveCount;
i = (int)t;
t -= i;
i *= 3;
}
return transform.TransformPoint (GetPoint (points [i], points [i + 1], points [i + 2], points [i + 3], t));
}
public Vector3 GetLookDirection (float t)
{
t = Mathf.Clamp01 (t) * CurveCount;
int i = (int)t;
//print (i);
if (i >= lookDirectionList.Count) {
i = lookDirectionList.Count - 1;
}
return lookDirectionList [i].localEulerAngles;
}
public Transform GetLookTransform (float t)
{
t = Mathf.Clamp01 (t) * CurveCount;
int i = (int)t;
//print (i);
if (i >= lookDirectionList.Count) {
i = lookDirectionList.Count - 1;
}
return lookDirectionList [i];
}
public int getPointIndex (float t)
{
t = Mathf.Clamp01 (t) * CurveCount;
int i = (int)t;
return i;
}
public Vector3 GetVelocity (float t)
{
int i;
if (t >= 1f) {
t = 1f;
i = points.Count - 4;
} else {
t = Mathf.Clamp01 (t) * CurveCount;
i = (int)t;
t -= i;
i *= 3;
}
return transform.TransformPoint (GetFirstDerivative (points [i], points [i + 1], points [i + 2], points [i + 3], t)) - transform.position;
}
public Vector3 GetDirection (float t)
{
return GetVelocity (t).normalized;
}
public void setInitialSplinePoint (Vector3 position)
{
points [0] = transform.InverseTransformPoint (position);
}
public void setFinalSplinePoint (Vector3 position)
{
points [points.Count - 1] = transform.InverseTransformPoint (position);
}
public static Vector3 GetPoint (Vector3 p0, Vector3 p1, Vector3 p2, float t)
{
t = Mathf.Clamp01 (t);
float oneMinusT = 1f - t;
return oneMinusT * oneMinusT * p0 + 2f * oneMinusT * t * p1 + t * t * p2;
}
public static Vector3 GetFirstDerivative (Vector3 p0, Vector3 p1, Vector3 p2, float t)
{
return 2f * (1f - t) * (p1 - p0) + 2f * t * (p2 - p1);
}
public static Vector3 GetPoint (Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float t)
{
t = Mathf.Clamp01 (t);
float OneMinusT = 1f - t;
return OneMinusT * OneMinusT * OneMinusT * p0 + 3f * OneMinusT * OneMinusT * t * p1 + 3f * OneMinusT * t * t * p2 + t * t * t * p3;
}
public static Vector3 GetFirstDerivative (Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float t)
{
t = Mathf.Clamp01 (t);
float oneMinusT = 1f - t;
return 3f * oneMinusT * oneMinusT * (p1 - p0) + 6f * oneMinusT * t * (p2 - p1) + 3f * t * t * (p3 - p2);
}
public float AccuracyToStepSize (float accuracy)
{
if (accuracy <= 0f) {
return 0.2f;
}
return Mathf.Clamp (1f / accuracy, 0.001f, 0.2f);
}
public Vector3 FindNearestPointTo (Vector3 worldPos, float accuracy = 100f, int secondPassIterations = 7, float secondPassExtents = 0.025f)
{
float normalizedT;
return FindNearestPointTo (worldPos, out normalizedT, accuracy, secondPassIterations, secondPassExtents);
}
public Vector3 FindNearestPointTo (Vector3 worldPos, out float normalizedT, float accuracy = 100f, int secondPassIterations = 7, float secondPassExtents = 0.025f)
{
Vector3 result = Vector3.zero;
normalizedT = -1f;
float step = AccuracyToStepSize (accuracy);
float minDistance = Mathf.Infinity;
for (float i = 0f; i < 1f; i += step) {
Vector3 thisPoint = GetPoint (i);
float thisDistance = (worldPos - thisPoint).sqrMagnitude;
if (thisDistance < minDistance) {
minDistance = thisDistance;
result = thisPoint;
normalizedT = i;
}
}
if (secondPassIterations > 0) {
float minT = normalizedT - secondPassExtents;
float maxT = normalizedT + secondPassExtents;
for (int i = 0; i < secondPassIterations; i++) {
float leftT = (minT + normalizedT) * 0.5f;
float rightT = (maxT + normalizedT) * 0.5f;
Vector3 leftPoint = GetPoint (leftT);
Vector3 rightPoint = GetPoint (rightT);
float leftDistance = (worldPos - leftPoint).sqrMagnitude;
float rightDistance = (worldPos - rightPoint).sqrMagnitude;
if (leftDistance < minDistance && leftDistance < rightDistance) {
minDistance = leftDistance;
result = leftPoint;
maxT = normalizedT;
normalizedT = leftT;
} else if (rightDistance < minDistance && rightDistance < leftDistance) {
minDistance = rightDistance;
result = rightPoint;
minT = normalizedT;
normalizedT = rightT;
} else {
minT = leftT;
maxT = rightT;
}
}
}
return result;
}
//EDITOR FUNCTIONS
public void setSelectedIndex (int index)
{
selectedIndex = index;
updateComponent ();
}
public void AddCurve (int index, bool addingAtTheEnd)
{
Vector3 point = points [index - 1];
float currentOffset = newPointOffset;
point.z += currentOffset;
points.Insert (index, point);
point.z += currentOffset;
points.Insert (index + 1, point);
point.z += currentOffset;
points.Insert (index + 2, point);
modes.Add (modes [modes.Count - 1]);
EnforceMode (index - 4);
if (loop) {
points [index - 1] = points [0];
modes [modes.Count - 1] = modes [0];
EnforceMode (0);
}
if (addingAtTheEnd) {
selectedIndex = points.Count - 1;
} else {
selectedIndex = index + 2;
}
updateComponent ();
}
public void removeCurve (int index)
{
if (index % 3 == 0) {
if (points.Count > 4) {
if (index == points.Count - 1) {
points.RemoveAt (index);
points.RemoveAt (index - 1);
points.RemoveAt (index - 2);
if (index == 3) {
selectedIndex = 0;
} else {
selectedIndex = index - 3;
}
} else {
if (index == 0) {
points.RemoveAt (index + 2);
points.RemoveAt (index + 1);
points.RemoveAt (index);
selectedIndex = 0;
} else {
points.RemoveAt (index + 1);
points.RemoveAt (index);
points.RemoveAt (index - 1);
selectedIndex = index;
}
}
modes.RemoveAt (index / 3);
if (points.Count == 4) {
Loop = false;
}
} else {
print ("At least two points must be configured for the spline");
}
} else {
print ("This point can't be removed");
}
updateComponent ();
}
public void Reset ()
{
points.Clear ();
float currentOffset = newPointOffset;
points.Add (new Vector3 (0f, 0f, currentOffset));
points.Add (new Vector3 (0f, 0f, currentOffset * 2));
points.Add (new Vector3 (0f, 0f, currentOffset * 3));
points.Add (new Vector3 (0f, 0f, currentOffset * 4));
modes.Clear ();
modes.Add (BezierControlPointMode.Aligned);
modes.Add (BezierControlPointMode.Aligned);
selectedIndex = 0;
updateComponent ();
}
public void alignLookDirection (bool adjustPositionAndRotation)
{
int pointIndex = 0;
for (int j = 0; j < lookDirectionList.Count; j++) {
Vector3 newPosition = Vector3.zero;
if (pointIndex <= points.Count - 1) {
newPosition = points [pointIndex];
}
lookDirectionList [j].localPosition = newPosition;
if (adjustPositionAndRotation) {
lookDirectionList [j].localRotation = Quaternion.identity;
}
pointIndex += 3;
}
updateComponent ();
}
public void updateComponent ()
{
GKC_Utils.updateComponent (this);
}
void OnDrawGizmos ()
{
if (!showGizmo) {
return;
}
if (GKC_Utils.isCurrentSelectionActiveGameObject (gameObject)) {
DrawGizmos ();
}
}
void OnDrawGizmosSelected ()
{
DrawGizmos ();
}
void DrawGizmos ()
{
if (showGizmo) {
if (showLookDirectionGizmo) {
for (int i = 0; i < lookDirectionList.Count; i++) {
if (lookDirectionList [i] != null) {
Gizmos.color = Color.yellow;
Gizmos.DrawSphere (lookDirectionList [i].position, lookDirectionGizmoRadius);
GKC_Utils.drawGizmoArrow (lookDirectionList [i].position, lookDirectionList [i].forward * lookDirectionArrowLength, Color.yellow, 0.2f, 20);
}
}
}
}
}
[System.Serializable]
public class splinePointInfo
{
public string Name;
public Vector3 point;
public BezierControlPointMode mode;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 6e305511e07ef2143ae2d55c0e69b33f
timeCreated: 1560380013
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/BezierSpline.cs
uploadId: 814740

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: c8a36270c206ef0419be5eeae1424687
folderAsset: yes
timeCreated: 1538634973
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,837 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using System.Text.RegularExpressions;
public class consoleMode : MonoBehaviour
{
public bool consoleModeEnabled = true;
public List<commandInfo> commandInfoList = new List<commandInfo> ();
public GameObject consoleWindow;
public Transform commandTextParent;
public RectTransform commandTextParentRectTransform;
public Text currentConsoleCommandText;
public string incorrectCommandMessage;
public float lineSpacingAmount;
public inputManager input;
public playerInputManager playerInput;
public bool consoleOpened;
public menuPause pauseManager;
public playerController playerControllerManager;
public ScrollRect commandListScrollRect;
public Transform spawnPosition;
public float maxRadiusToInstantiate;
public float deletingTextRate = 0.3f;
public float startDeletingTimeAmount = 0.5f;
public List<string> allowedKeysList = new List<string> ();
public gameManager mainGameManager;
public bool showDebugPrint;
public string tabKeyName = "tab";
public string deleteKeyName = "delete";
public string spaceKeyName = "space";
public string backSpaceKeyName = "backspace";
public string returnKeyName = "return";
public string enterKeyName = "enter";
public string leftShiftKeyName = "leftshift";
public string downArrowKeyName = "downarrow";
public string upArrowKeyName = "uparrow";
public string alphaKeyName = "alpha";
public string capslockKeyName = "capslock";
List<GameObject> commandTextGameObjectList = new List<GameObject> ();
string currentKeyPressed;
string originalKeyPressed;
string currentTextWritten;
string previousTextWritten;
bool capsLockActivated;
prefabsManager mainPrefabsManager;
int numberOfLines;
bool arrowKeyPressed;
List<string> previousCommandList = new List<string> ();
int previousCommandListIndex;
bool canStartDeletingText;
bool deletingText;
float lastTimeDeletePressed;
float lastTimeDeletingText;
bool autocompletingCommand;
int currentAutocompleteCommandIndex;
string currentAutocompleteCommandFound = "";
Coroutine scrollRectCoroutine;
Coroutine consoleCoroutine;
bool prefabsManagerLocated;
void Start ()
{
if (consoleWindow.activeSelf) {
consoleWindow.SetActive (false);
}
}
public void stopUpdateConsoleCoroutine ()
{
if (consoleCoroutine != null) {
StopCoroutine (consoleCoroutine);
}
}
IEnumerator updateConsoleCoroutine ()
{
var waitTime = new WaitForSeconds (0.00001f);
while (true) {
// void Update ()
// {
if (consoleOpened) {
currentKeyPressed = input.getKeyPressed (inputManager.buttonType.getKeyDown, true);
if (currentKeyPressed != "") {
checkKeyPressed (currentKeyPressed);
if (currentKeyPressed.ToLower ().Equals (deleteKeyName) || currentKeyPressed.ToLower ().Equals (backSpaceKeyName)) {
deletingText = true;
lastTimeDeletePressed = Time.time;
}
}
currentKeyPressed = input.getKeyPressed (inputManager.buttonType.getKeyUp, true);
if (currentKeyPressed != "") {
if (currentKeyPressed.ToLower ().Equals (leftShiftKeyName)) {
capsLockActivated = !capsLockActivated;
}
if (currentKeyPressed.ToLower ().Equals (deleteKeyName) || currentKeyPressed.ToLower ().Equals (backSpaceKeyName)) {
stopDeletingText ();
}
}
if (deletingText) {
if (canStartDeletingText) {
if (Time.time > lastTimeDeletingText + deletingTextRate) {
if (currentTextWritten.Length > 0) {
currentTextWritten = currentTextWritten.Remove (currentTextWritten.Length - 1, 1);
}
currentConsoleCommandText.text = "> " + currentTextWritten;
lastTimeDeletingText = Time.time;
}
} else {
if (Time.time > lastTimeDeletePressed + startDeletingTimeAmount) {
canStartDeletingText = true;
}
}
}
}
yield return waitTime;
}
}
public void checkKeyPressed (string keyPressed)
{
originalKeyPressed = keyPressed;
keyPressed = keyPressed.ToLower ();
if (!allowedKeysList.Contains (keyPressed)) {
return;
}
bool checkPass = false;
if (keyPressed.Contains (alphaKeyName)) {
keyPressed = keyPressed.Substring (keyPressed.Length - 1);
originalKeyPressed = keyPressed;
}
//check if the arrow keys have been pressed
if (keyPressed.Equals (upArrowKeyName) || keyPressed.Equals (downArrowKeyName)) {
if (previousCommandList.Count > 0) {
if (arrowKeyPressed) {
if (keyPressed.Equals (upArrowKeyName)) {
previousCommandListIndex--;
if (previousCommandListIndex < 0) {
previousCommandListIndex = 0;
}
} else {
previousCommandListIndex++;
if (previousCommandListIndex > previousCommandList.Count - 1) {
previousCommandListIndex = previousCommandList.Count - 1;
}
}
}
arrowKeyPressed = true;
if (showDebugPrint) {
print ("index " + previousCommandListIndex);
}
currentTextWritten = "";
originalKeyPressed = previousCommandList [previousCommandListIndex];
} else {
originalKeyPressed = "";
}
}
if (keyPressed.Equals (tabKeyName)) {
if (currentTextWritten.Length == 0) {
return;
}
string commandToSearch = currentTextWritten;
if (currentAutocompleteCommandFound != "") {
commandToSearch = currentAutocompleteCommandFound;
}
bool commandFound = false;
string commandToSearchToLower = commandToSearch.ToLower ();
int commandToSearchLength = commandToSearch.Length;
for (int i = 0; i < commandInfoList.Count; i++) {
if (!commandFound && commandToSearchLength <= commandInfoList [i].Name.Length &&
commandToSearchToLower.Equals (commandInfoList [i].Name.ToLower ().Substring (0, commandToSearchLength))) {
if ((autocompletingCommand && i > currentAutocompleteCommandIndex) || !autocompletingCommand) {
originalKeyPressed = commandInfoList [i].Name;
if (commandInfoList [i].containsAmount || commandInfoList [i].containsBool || commandInfoList [i].containsName) {
originalKeyPressed += " ";
}
commandFound = true;
currentAutocompleteCommandIndex = i;
}
}
}
if (!commandFound) {
return;
}
if (currentAutocompleteCommandFound.Equals ("")) {
currentAutocompleteCommandFound = currentTextWritten;
}
currentTextWritten = "";
autocompletingCommand = true;
string currentAutocompleteCommandFoundToLower = currentAutocompleteCommandFound.ToLower ();
int currentAutocompleteCommandFoundLength = currentAutocompleteCommandFound.Length;
if (showDebugPrint) {
print (currentAutocompleteCommandFound + " " + currentAutocompleteCommandIndex);
}
if (currentAutocompleteCommandIndex < commandInfoList.Count - 1) {
bool commandFoundAgain = false;
for (int i = currentAutocompleteCommandIndex + 1; i < commandInfoList.Count; i++) {
if (currentAutocompleteCommandFoundToLower.Equals (commandInfoList [i].Name.ToLower ().Substring (0, currentAutocompleteCommandFoundLength))) {
commandFoundAgain = true;
}
}
if (showDebugPrint) {
print (commandFoundAgain);
}
if (!commandFoundAgain) {
autocompletingCommand = false;
}
} else {
autocompletingCommand = false;
}
} else {
resetAutocompleteParameters ();
}
//add the an space
if (keyPressed.Equals (spaceKeyName)) {
currentTextWritten += " ";
}
//delete the last character
else if (keyPressed.Equals (deleteKeyName) || keyPressed.Equals (backSpaceKeyName)) {
if (currentTextWritten.Length > 0) {
currentTextWritten = currentTextWritten.Remove (currentTextWritten.Length - 1);
}
}
//check the current word added
else if (keyPressed.Equals (enterKeyName) || keyPressed.Equals (returnKeyName)) {
checkPass = true;
}
//check if the caps are being using
else if (keyPressed.Equals (capslockKeyName) || keyPressed.Equals (leftShiftKeyName)) {
capsLockActivated = !capsLockActivated;
return;
}
//add the current key pressed to the password
else {
if (capsLockActivated) {
originalKeyPressed = originalKeyPressed.ToUpper ();
} else {
originalKeyPressed = originalKeyPressed.ToLower ();
}
currentTextWritten += originalKeyPressed;
}
currentConsoleCommandText.text = "> " + currentTextWritten;
//the enter key has been pressed, so check if the current text written is the correct password
if (checkPass) {
previousTextWritten = currentTextWritten.ToLower ();
checkCurrentCommand (currentTextWritten);
currentTextWritten = "";
}
setScrollRectPosition (Vector3.up * (lineSpacingAmount * numberOfLines));
}
public void resetAutocompleteParameters ()
{
autocompletingCommand = false;
currentAutocompleteCommandIndex = 0;
currentAutocompleteCommandFound = "";
}
public bool checkCurrentCommand (string currentCommand)
{
if (currentCommand.Equals ("")) {
createNewCommandText ("> ");
return false;
}
arrowKeyPressed = false;
previousCommandList.Add (currentCommand);
previousCommandListIndex = previousCommandList.Count - 1;
resetAutocompleteParameters ();
createNewCommandText ("> " + currentCommand);
currentCommand = currentCommand.ToLower ();
for (int i = 0; i < commandInfoList.Count; i++) {
string commandName = commandInfoList [i].Name.ToLower ();
bool commandFound = false;
if (commandName.Equals (currentCommand)) {
commandFound = true;
}
if (!commandFound && (commandInfoList [i].containsAmount || commandInfoList [i].containsBool || commandInfoList [i].containsName)) {
if (currentCommand.Contains (commandName)) {
commandFound = true;
}
}
if (commandFound) {
//check the parameters of the command
string nameParameter = "";
bool incorrectCommand = false;
if (commandInfoList [i].containsName) {
nameParameter = currentCommand.Replace (commandInfoList [i].Name.ToLower () + " ", "");
if (nameParameter.Length == 0) {
incorrectCommand = true;
} else {
int amount = 0;
string[] digits = Regex.Split (currentCommand, @"\D+");
foreach (string value in digits) {
if (int.TryParse (value, out amount)) {
incorrectCommand = true;
}
}
}
}
int amountValue = 0;
if (commandInfoList [i].containsAmount) {
bool numberFound = false;
string[] digits = Regex.Split (currentCommand, @"\D+");
foreach (string value in digits) {
if (int.TryParse (value, out amountValue)) {
if (showDebugPrint) {
Debug.Log (value);
}
numberFound = true;
}
}
if (commandInfoList [i].containsName) {
nameParameter = nameParameter.Replace (amountValue.ToString (), "");
if (nameParameter.Length > 0) {
nameParameter = nameParameter.Remove (nameParameter.Length - 1, 1);
}
}
incorrectCommand = !numberFound;
}
bool boolValue = false;
if (commandInfoList [i].containsBool) {
bool boolFound = false;
if (currentCommand.Contains ("true")) {
boolValue = true;
boolFound = true;
} else if (currentCommand.Contains ("false")) {
boolFound = true;
}
if (showDebugPrint) {
print (boolValue);
}
incorrectCommand = !boolFound;
}
//if the command is not correctly written, show the incorrect message and stop
if (incorrectCommand) {
createNewCommandText (commandInfoList [i].incorrectParametersText);
return false;
}
//execute the event with the proper parameter
if (commandInfoList [i].eventSendValues) {
if (commandInfoList [i].containsAmount) {
commandInfoList [i].eventToCallAmount.Invoke ((float)amountValue);
}
if (commandInfoList [i].containsBool) {
commandInfoList [i].eventToCallBool.Invoke (boolValue);
}
if (showDebugPrint) {
print (nameParameter);
}
if (commandInfoList [i].containsName) {
commandInfoList [i].eventToCallName.Invoke (nameParameter);
}
} else {
if (commandInfoList [i].eventToCall.GetPersistentEventCount () > 0) {
commandInfoList [i].eventToCall.Invoke ();
}
}
createNewCommandText (commandInfoList [i].commandExecutedText);
return true;
}
}
createNewCommandText (incorrectCommandMessage);
return false;
}
public void createNewCommandText (string commandContent)
{
if (commandContent.Equals ("")) {
return;
}
GameObject newConsoleCommnadGameObject = (GameObject)Instantiate (currentConsoleCommandText.gameObject, Vector3.zero, Quaternion.identity);
newConsoleCommnadGameObject.transform.SetParent (commandTextParent);
newConsoleCommnadGameObject.transform.localScale = Vector3.one;
newConsoleCommnadGameObject.GetComponent<Text> ().text = commandContent;
commandTextGameObjectList.Add (newConsoleCommnadGameObject);
currentConsoleCommandText.transform.SetSiblingIndex (commandTextParent.childCount - 1);
currentConsoleCommandText.text = ">";
numberOfLines++;
setScrollRectPosition (Vector3.up * (lineSpacingAmount * numberOfLines));
}
public void setScrollRectPosition (Vector3 position)
{
if (scrollRectCoroutine != null) {
StopCoroutine (scrollRectCoroutine);
}
scrollRectCoroutine = StartCoroutine (setScrollRectPositionCoroutine (position));
}
IEnumerator setScrollRectPositionCoroutine (Vector3 position)
{
commandListScrollRect.vertical = false;
//yield return new WaitForSeconds (0.01f);
commandTextParentRectTransform.localPosition = position;
yield return new WaitForSeconds (0.01f);
commandListScrollRect.vertical = true;
}
public void showCommandList ()
{
for (int i = 0; i < commandInfoList.Count; i++) {
createNewCommandText (commandInfoList [i].Name + " -> " + commandInfoList [i].description);
}
}
public void clearCommandList ()
{
for (int i = 0; i < commandTextGameObjectList.Count; i++) {
if (commandTextGameObjectList [i] != null) {
Destroy (commandTextGameObjectList [i]);
}
}
setScrollRectPosition (Vector3.zero);
numberOfLines = 0;
previousCommandList.Clear ();
previousCommandListIndex = 0;
}
public void openOrCloseConsoleMode (bool state)
{
if (consoleOpened == state) {
return;
}
consoleOpened = state;
stopUpdateConsoleCoroutine ();
if (consoleOpened) {
bool inputManagerLocated = input != null;
if (!inputManagerLocated) {
input = inputManager.Instance;
inputManagerLocated = input != null;
}
if (!inputManagerLocated) {
input = FindObjectOfType<inputManager> ();
input.getComponentInstanceOnApplicationPlaying ();
inputManagerLocated = input != null;
}
consoleCoroutine = StartCoroutine (updateConsoleCoroutine ());
}
consoleWindow.SetActive (consoleOpened);
pauseManager.showOrHideCursor (consoleOpened);
pauseManager.setHeadBobPausedState (consoleOpened);
pauseManager.changeCursorState (!consoleOpened);
playerControllerManager.changeScriptState (!consoleOpened);
pauseManager.openOrClosePlayerMenu (consoleOpened, null, false);
pauseManager.usingDeviceState (consoleOpened);
mainGameManager.setGamePauseState (consoleOpened);
playerInput.setPlayerInputEnabledState (!consoleOpened);
stopDeletingText ();
pauseManager.setIngameMenuOpenedState ("Console Mode", consoleOpened, true);
}
public void stopDeletingText ()
{
deletingText = false;
canStartDeletingText = false;
}
public void checkPrefabsManager ()
{
if (!prefabsManagerLocated) {
mainPrefabsManager = GKC_Utils.addPrefabsManagerToScene ();
prefabsManagerLocated = mainPrefabsManager != null;
}
}
public void spawnObject ()
{
bool objectToSpawnFound = false;
checkPrefabsManager ();
if (prefabsManagerLocated) {
string objectToSpawnName = previousTextWritten.Replace ("spawn", "");
int amountToSpawn = 0;
if (objectToSpawnName.Length == 0) {
return;
}
string[] digits = Regex.Split (objectToSpawnName, @"\D+");
foreach (string value in digits) {
if (int.TryParse (value, out amountToSpawn)) {
if (showDebugPrint) {
Debug.Log (value);
}
}
}
objectToSpawnName = objectToSpawnName.Replace (amountToSpawn.ToString (), "");
if (objectToSpawnName.Length == 0 || objectToSpawnName.Length < 3) {
return;
}
objectToSpawnName = objectToSpawnName.Remove (0, 1);
objectToSpawnName = objectToSpawnName.Remove (objectToSpawnName.Length - 1, 1);
if (showDebugPrint) {
print (objectToSpawnName);
}
GameObject objectToSpawn = mainPrefabsManager.getPrefabGameObject (objectToSpawnName);
if (objectToSpawn != null) {
for (int i = 0; i < amountToSpawn; i++) {
Vector3 positionToSpawn = spawnPosition.position;
positionToSpawn += Random.insideUnitSphere * maxRadiusToInstantiate;
float extraOffset = mainPrefabsManager.getPrefabSpawnOffset (objectToSpawnName);
if (extraOffset != 0) {
positionToSpawn += spawnPosition.forward * extraOffset;
}
spawnGameObject (objectToSpawn, positionToSpawn, spawnPosition.rotation);
objectToSpawnFound = true;
}
}
} else {
print ("WARNING: No prefabs manager component has been found in the scene, make sure this elements has been adde to the level");
}
if (!objectToSpawnFound) {
createNewCommandText ("That object doesn't exist");
}
}
public void showSpawnObjectsList ()
{
checkPrefabsManager ();
if (prefabsManagerLocated) {
for (int i = 0; i < mainPrefabsManager.prefabTypeInfoList.Count; i++) {
for (int j = 0; j < mainPrefabsManager.prefabTypeInfoList [i].prefabInfoList.Count; j++) {
createNewCommandText (mainPrefabsManager.prefabTypeInfoList [i].prefabInfoList [j].Name);
}
}
}
}
public void spawnGameObject (GameObject objectToSpawn, Vector3 position, Quaternion rotation)
{
GameObject newConsoleCommnadGameObject = (GameObject)Instantiate (objectToSpawn, position, rotation);
newConsoleCommnadGameObject.transform.position = position;
}
public void killAllEnemies ()
{
killCharacters (false);
}
public void killAllCharacters ()
{
killCharacters (true);
}
void killCharacters (bool killAllCharacters)
{
health[] healthList = FindObjectsOfType (typeof(health)) as health[];
for (int i = 0; i < healthList.Length; i++) {
if (!healthList [i].isDead ()) {
bool canKillCharacter = false;
if (killAllCharacters) {
canKillCharacter = true;
} else {
if (!healthList [i].gameObject.CompareTag ("Player")) {
canKillCharacter = true;
}
if (!healthList [i].gameObject.CompareTag ("friend")) {
canKillCharacter = true;
}
}
if (canKillCharacter) {
healthList [i].killByButton ();
}
}
}
}
public void destroyAllVehicles ()
{
vehicleHUDManager[] vehicleHUDManagerList = FindObjectsOfType (typeof(vehicleHUDManager)) as vehicleHUDManager[];
for (int i = 0; i < vehicleHUDManagerList.Length; i++) {
vehicleHUDManagerList [i].destroyVehicle ();
}
}
public void inputActivateConsoleMode ()
{
if (!consoleModeEnabled) {
return;
}
if (pauseManager.isOpenOrClosePlayerOpenMenuByNamePaused ()) {
return;
}
openOrCloseConsoleMode (!consoleOpened);
}
public void setConsoleModeEnabledState (bool state)
{
consoleModeEnabled = state;
}
//EDITOR FUNCTIONS
public void addCommand ()
{
commandInfo newCommandInfo = new commandInfo ();
newCommandInfo.Name = "New Command";
commandInfoList.Add (newCommandInfo);
updateComponent ();
}
public void setConsoleModeEnabledStateFromEditor (bool state)
{
setConsoleModeEnabledState (state);
updateComponent ();
}
public void updateComponent ()
{
GKC_Utils.updateComponent (this);
GKC_Utils.updateDirtyScene ("Updating console mode", gameObject);
}
[System.Serializable]
public class commandInfo
{
public string Name;
[TextArea (1, 10)] public string description;
[TextArea (1, 10)] public string commandExecutedText;
[TextArea (1, 10)] public string incorrectParametersText;
public UnityEvent eventToCall;
public bool eventSendValues;
public bool containsAmount;
public bool containsBool;
public bool containsName;
[System.Serializable]
public class eventToCallWithAmount : UnityEvent<float>
{
}
[SerializeField] public eventToCallWithAmount eventToCallAmount;
[System.Serializable]
public class eventToCallWithBool : UnityEvent<bool>
{
}
[SerializeField] public eventToCallWithBool eventToCallBool;
[System.Serializable]
public class eventToCallWithName : UnityEvent<string>
{
}
[SerializeField] public eventToCallWithName eventToCallName;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: c34be7477a2f82d4681121653117b588
timeCreated: 1529976949
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/Console Mode/consoleMode.cs
uploadId: 814740

View File

@@ -0,0 +1,405 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class FloatingObject : objectOnWater
{
[Header ("Main Settings")]
[Space]
[SerializeField]
private bool calculateDensity = false;
public float density = 0.75f;
[SerializeField]
private float maxDensity = 0;
[SerializeField]
private float minDensity = 0;
[SerializeField]
[Range (0f, 1f)]
private float normalizedVoxelSize = 0.5f;
[SerializeField]
private float dragInWater = 1f;
[SerializeField]
private float angularDragInWater = 1f;
public bool updateBoundsValuesFromCollider = true;
public Bounds bounds;
[Space]
[Header ("Gravity Settings")]
[Space]
public bool updateGravityFroceFromWaterVolume = true;
public Vector3 gravityForce = new Vector3 (0, -9.8f, 0);
[Space]
[Header ("Debug")]
[Space]
public bool showGizmo;
public bool objectOnWaterActive;
public bool externalForcesActive;
public Vector3 externalForcesValue;
public bool externalRotationForceActive;
public float externalRotationForce;
public Vector3 externalRotationForcePoint;
public Vector3 currentRotationAxis;
public bool initialValuesAssigned;
public bool applyBuoyancyActive = true;
public Vector3 maxBuoyancyForce;
[Space]
public waterSurfaceSystem mainWaterSurfaceSystem;
[Space]
[Header ("Event Settings")]
[Space]
public bool useEventsOnEnterExitWater;
public UnityEvent eventonEnterWater;
public UnityEvent eventOnExitWater;
[Space]
[Header ("Components")]
[Space]
public Collider mainCollider;
public Rigidbody mainRigidbody;
public MeshFilter mainMeshFilter;
[HideInInspector] public Transform mainWaterSurfaceSystemTransform;
private float initialDrag;
private float initialAngularDrag;
private Vector3 voxelSize;
private Vector3 [] voxels;
int voxelsLength;
Coroutine updateCoroutine;
float originalDensity;
public void stopUpdateCoroutine ()
{
if (updateCoroutine != null) {
StopCoroutine (updateCoroutine);
}
}
IEnumerator updateSystemCoroutine ()
{
var waitTime = new WaitForFixedUpdate ();
while (true) {
updateSystem ();
yield return waitTime;
}
}
void updateSystem ()
{
if (objectOnWaterActive) {
if (applyBuoyancyActive && voxelsLength > 0) {
updateMaxBuoyancyForce ();
Vector3 forceAtSingleVoxel = maxBuoyancyForce / voxelsLength;
float voxelHeight = bounds.size.y * normalizedVoxelSize;
float submergedVolume = 0f;
Vector3 upDirection = mainWaterSurfaceSystemTransform.up;
for (int i = 0; i < voxelsLength; i++) {
Vector3 worldPoint = transform.TransformPoint (voxels [i]);
float waterLevel = mainWaterSurfaceSystem.GetWaterLevel (worldPoint);
float deepLevel = waterLevel - worldPoint.y + (voxelHeight / 2f); // How deep is the voxel
float submergedFactor = Mathf.Clamp (deepLevel / voxelHeight, 0f, 1f); // 0 - voxel is fully out of the water, 1 - voxel is fully submerged
submergedVolume += submergedFactor;
Vector3 surfaceNormal = mainWaterSurfaceSystem.GetSurfaceNormal (worldPoint);
Quaternion surfaceRotation = Quaternion.FromToRotation (upDirection, surfaceNormal);
surfaceRotation = Quaternion.Slerp (surfaceRotation, Quaternion.identity, submergedFactor);
Vector3 finalVoxelForce = surfaceRotation * (submergedFactor * forceAtSingleVoxel);
mainRigidbody.AddForceAtPosition (finalVoxelForce, worldPoint);
if (showGizmo) {
Debug.DrawLine (worldPoint, worldPoint + finalVoxelForce.normalized, Color.blue);
}
}
submergedVolume /= voxelsLength; // 0 - object is fully out of the water, 1 - object is fully submerged
mainRigidbody.linearDamping = Mathf.Lerp (initialDrag, dragInWater, submergedVolume);
mainRigidbody.angularDamping = Mathf.Lerp (initialAngularDrag, angularDragInWater, submergedVolume);
if (externalForcesActive) {
mainRigidbody.AddForce (externalForcesValue);
externalForcesActive = false;
}
if (externalRotationForceActive) {
if (currentRotationAxis.magnitude != 0) {
transform.RotateAround (externalRotationForcePoint, currentRotationAxis, externalRotationForce);
}
// mainRigidbody.AddTorque (externalRotationForce * currentRotationAxis);
externalRotationForceActive = false;
}
}
checkObjectStateOnWater ();
}
}
public void setWaterVolumeState (waterSurfaceSystem newWaterSurfaceSystem, bool state)
{
objectOnWaterActive = state;
if (state) {
mainWaterSurfaceSystem = newWaterSurfaceSystem;
if (!initialValuesAssigned) {
initialDrag = mainRigidbody.linearDamping;
initialAngularDrag = mainRigidbody.angularDamping;
if (calculateDensity) {
if (mainMeshFilter == null) {
mainMeshFilter = GetComponent<MeshFilter> ();
}
float objectVolume = mainWaterSurfaceSystem.CalculateVolume_Mesh (mainMeshFilter.mesh, mainMeshFilter.transform);
setNewDensity (mainRigidbody.mass / objectVolume);
}
if (originalDensity == 0) {
originalDensity = density;
}
initialValuesAssigned = true;
}
if (updateGravityFroceFromWaterVolume) {
gravityForce = newWaterSurfaceSystem.getGravityForce ();
}
if (updateBoundsValuesFromCollider) {
bounds = mainCollider.bounds;
}
mainWaterSurfaceSystemTransform = mainWaterSurfaceSystem.transform;
if (voxels == null) {
voxels = CutIntoVoxels ();
}
voxelsLength = voxels.Length;
updateMaxBuoyancyForce ();
updateCoroutine = StartCoroutine (updateSystemCoroutine ());
} else {
stopUpdateCoroutine ();
mainWaterSurfaceSystem = null;
}
checkObjectStateOnWaterEnterOrExit (state);
if (useEventsOnEnterExitWater) {
if (state) {
eventonEnterWater.Invoke ();
} else {
eventOnExitWater.Invoke ();
}
}
}
public void setNewGravityForce (Vector3 newValues)
{
gravityForce = newValues;
}
public override bool isObjectOnWaterActive ()
{
return objectOnWaterActive;
}
public override void updateExternalForces (Vector3 newValues, bool externalForcesActiveValue)
{
externalForcesActive = externalForcesActiveValue;
externalForcesValue = newValues;
}
public override void updateExternalRotationForces (float rotationAmount, Vector3 rotationAxis,
Vector3 externalRotationForcePointValue)
{
externalRotationForceActive = true;
externalRotationForce = rotationAmount;
externalRotationForcePoint = externalRotationForcePointValue;
currentRotationAxis = rotationAxis;
}
public override void setNewDensity (float newValue)
{
density = newValue;
if (maxDensity != 0) {
density = Mathf.Clamp (density, minDensity, maxDensity);
}
}
public override void addOrRemoveDensity (float newValue)
{
density += newValue;
if (maxDensity != 0) {
density = Mathf.Clamp (density, minDensity, maxDensity);
}
}
public override float getDensity ()
{
return density;
}
public override void setOriginalDensity ()
{
setNewDensity (originalDensity);
}
private Vector3 CalculateMaxBuoyancyForce ()
{
float objectVolume = mainRigidbody.mass / density;
return mainWaterSurfaceSystem.getDensity () * objectVolume * -gravityForce;
}
public void updateMaxBuoyancyForce ()
{
maxBuoyancyForce = CalculateMaxBuoyancyForce ();
}
private Vector3 [] CutIntoVoxels ()
{
Quaternion initialRotation = transform.rotation;
transform.rotation = Quaternion.identity;
Bounds bounds = mainCollider.bounds;
voxelSize.x = bounds.size.x * normalizedVoxelSize;
voxelSize.y = bounds.size.y * normalizedVoxelSize;
voxelSize.z = bounds.size.z * normalizedVoxelSize;
int voxelsCountForEachAxis = Mathf.RoundToInt (1f / normalizedVoxelSize);
List<Vector3> voxels = new List<Vector3> (voxelsCountForEachAxis * voxelsCountForEachAxis * voxelsCountForEachAxis);
for (int i = 0; i < voxelsCountForEachAxis; i++) {
for (int j = 0; j < voxelsCountForEachAxis; j++) {
for (int k = 0; k < voxelsCountForEachAxis; k++) {
float pX = bounds.min.x + voxelSize.x * (0.5f + i);
float pY = bounds.min.y + voxelSize.y * (0.5f + j);
float pZ = bounds.min.z + voxelSize.z * (0.5f + k);
Vector3 point = new Vector3 (pX, pY, pZ);
if (mainWaterSurfaceSystem.IsPointInsideCollider (point, mainCollider, ref bounds)) {
voxels.Add (transform.InverseTransformPoint (point));
}
}
}
}
transform.rotation = initialRotation;
return voxels.ToArray ();
}
public void setApplyBuoyancyActiveState (bool state)
{
applyBuoyancyActive = state;
}
public virtual void checkObjectStateOnWater ()
{
}
public virtual void checkObjectStateOnWaterEnterOrExit (bool state)
{
}
public Collider getMainCollider ()
{
return mainCollider;
}
void OnDrawGizmos ()
{
if (!showGizmo) {
return;
}
if (GKC_Utils.isCurrentSelectionActiveGameObject (gameObject)) {
DrawGizmos ();
}
}
void OnDrawGizmosSelected ()
{
DrawGizmos ();
}
void DrawGizmos ()
{
if (showGizmo) {
if (voxelsLength > 0) {
for (int i = 0; i < voxelsLength; i++) {
Gizmos.color = Color.magenta - new Color (0f, 0f, 0f, 0.75f);
Gizmos.DrawCube (transform.TransformPoint (voxels [i]), 0.8f * voxelSize);
}
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: e5bcb62d8542a2b42a7097c204280143
timeCreated: 1673260982
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/FloatingObject.cs
uploadId: 814740

View File

@@ -0,0 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FloatingObjectSocket : MonoBehaviour
{
public FloatingObject mainFloatingObject;
public FloatingObject getFloatingObject ()
{
return mainFloatingObject;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: b3f08a4add3ffd14192d06efac86735d
timeCreated: 1674660197
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/FloatingObjectSocket.cs
uploadId: 814740

View File

@@ -0,0 +1,176 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
public class GKCUIManager : MonoBehaviour
{
public bool managerEnabled = true;
public List<UIElementInfo> UIElementInfoList = new List<UIElementInfo> ();
public string objectSearcherName;
public List<string> objectSearchResultList = new List<string> ();
public bool searchObjectsActive;
public void enableAllUIElement ()
{
enableOrDisableAllUIElement (true);
}
public void disableAllUIElement ()
{
enableOrDisableAllUIElement (false);
}
public void enableOrDisableAllUIElement (bool state)
{
for (int i = 0; i < UIElementInfoList.Count; i++) {
enableOrDisableUIElement (UIElementInfoList[i].Name, state);
}
}
public void enableUIElement (string objectName)
{
enableOrDisableUIElement (objectName, true);
}
public void disableUIElement (string objectName)
{
enableOrDisableUIElement (objectName, false);
}
public void enableOrDisableUIElement (string objectName, bool state)
{
if (!managerEnabled) {
return;
}
int elementIndex = UIElementInfoList.FindIndex (a => a.Name.Equals (objectName));
if (elementIndex > -1) {
UIElementInfo currentUIElementInfo = UIElementInfoList [elementIndex];
currentUIElementInfo.elementActive = state;
if (currentUIElementInfo.UIGameObject != null) {
if (currentUIElementInfo.UIGameObject.activeSelf != state) {
currentUIElementInfo.UIGameObject.SetActive (state);
}
}
if (state) {
currentUIElementInfo.eventToEnableUIGameObject.Invoke ();
} else {
currentUIElementInfo.envetToDisableUIGameObject.Invoke ();
}
updateComponent ();
}
}
public void clearObjectsSearcResultList ()
{
objectSearchResultList.Clear ();
objectSearcherName = "";
searchObjectsActive = false;
}
public void showObjectsBySearchName ()
{
if (objectSearcherName != null && objectSearcherName != "") {
objectSearchResultList.Clear ();
searchObjectsActive = true;
string currentTextToSearch = objectSearcherName;
if (currentTextToSearch != "") {
currentTextToSearch = currentTextToSearch.ToLower ();
int UIElementInfoListCount = UIElementInfoList.Count;
for (int i = 0; i < UIElementInfoListCount; i++) {
UIElementInfo currentUIElementInfo = UIElementInfoList [i];
if (currentUIElementInfo.Name != "") {
string objectName = currentUIElementInfo.Name.ToLower ();
if (objectName.Contains (currentTextToSearch) ||
objectName.Equals (currentTextToSearch)) {
if (!objectSearchResultList.Contains (currentUIElementInfo.Name)) {
objectSearchResultList.Add (currentUIElementInfo.Name);
}
}
if (currentUIElementInfo.useMoreNameTagsToSearch) {
int moreNameTagsToSearchListCount = currentUIElementInfo.moreNameTagsToSearchList.Count;
for (int j = 0; j < moreNameTagsToSearchListCount; j++) {
string objectTagName = currentUIElementInfo.moreNameTagsToSearchList [j].ToLower ();
if (objectTagName.Contains (currentTextToSearch) ||
objectTagName.Equals (currentTextToSearch)) {
if (!objectSearchResultList.Contains (currentUIElementInfo.Name)) {
objectSearchResultList.Add (currentUIElementInfo.Name);
}
}
}
}
}
}
}
}
}
public void selectObjectByName (string objectName)
{
int curretIndex = UIElementInfoList.FindIndex (s => s.Name.Equals (objectName));
if (curretIndex > -1) {
selectObjectByIndex (curretIndex);
}
}
public void selectObjectByIndex (int index)
{
UIElementInfo currentUIElementInfo = UIElementInfoList [index];
if (currentUIElementInfo.UIGameObject != null) {
GKC_Utils.setActiveGameObjectInEditor (currentUIElementInfo.UIGameObject);
}
}
void updateComponent ()
{
GKC_Utils.updateComponent (this);
GKC_Utils.updateDirtyScene ("Update UI Manager", gameObject);
}
[System.Serializable]
public class UIElementInfo
{
public string Name;
public bool useMoreNameTagsToSearch;
public List<string> moreNameTagsToSearchList = new List<string> ();
public bool elementActive = true;
public GameObject UIGameObject;
public UnityEvent eventToEnableUIGameObject;
public UnityEvent envetToDisableUIGameObject;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 74d411d2eb1819142935f15ef610428c
timeCreated: 1672478520
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/GKCUIManager.cs
uploadId: 814740

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: e5cc096a83dbcd44a8b1482fc91c53d3
timeCreated: 1502561059
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/GKC_Utils.cs
uploadId: 814740

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 68798b315557aa74797623522935633b
folderAsset: yes
timeCreated: 1626771452
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,848 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
using UnityEngine.Events;
public class scannerSystem : MonoBehaviour
{
[Header ("Main Setting")]
[Space]
public bool scannerSystemEnabled;
public bool infiniteScanDistance;
public float scanDistance;
public bool scanDistanceAffectedByZoom;
public float scanDistanceExtraWithZoom;
public LayerMask layer;
public bool ignoreChangeToFirstPersonEnabled;
public bool removeLocatedObjectIfDisabledOnScene = true;
[Space]
[Header ("Camera Settings")]
[Space]
public float initialCameraFov;
public float zoomCameraFov;
public float fovChangeSpeed;
public float scanSpeed;
public float scaneIconMovementSpeed;
public bool useMaxDistanceToCameraCenter;
public float maxDistanceToCameraCenter;
public bool useAutoScanner;
[Space]
[Header ("Scanner Messages Settings Settings")]
[Space]
public string scanCompleteString = "SCAN COMPLETED";
public string scanVisorActiveString = "SCAN VISOR ACTIVE";
public string scanningString = "SCANNING...";
public string emptyScannerInfoString = "...";
[Space]
[Header ("Other Settings")]
[Space]
public bool useWeakSpotScanner;
public string scannerAnimationName = "scannerTarget";
[Space]
[Header ("Debug")]
[Space]
public bool holdScannerInputActive;
public GameObject scannedObject;
[Space]
[Header ("Event Settings")]
[Space]
public UnityEvent eventOnScannerEnabled;
public UnityEvent eventOnScannerDisabled;
[Space]
[Header ("Scanner Components")]
[Space]
public GameObject scannerHUD;
public GameObject scanIcon;
public RectTransform scanIconRect;
public Animation iconAnimation;
public RectTransform iconRectTransform;
public GameObject scannerCamera;
public GameObject scannerCameraUI;
public Slider slider;
public Text objectName;
public Text objectInfo;
public Text scanStatus;
public Transform healthInfoParent;
public GameObject healthElement;
public Text objectScannedHealthNameText;
public Text objectScannedHealthAmountText;
public Camera scannerMainCamera;
public playerCamera mainPlayerCamera;
public playerController playerControllerManager;
public Transform mainCameraTransform;
public Camera mainCamera;
bool zoomActive;
bool scannerModeIsActivated;
bool isFirstPersonView;
float originalScannerCameraFov;
float targetScannerCameraFov;
bool lookingObject;
RaycastHit hit;
scanElementInfo currentObjectToScan;
List<healthElementInfo> healtWeakSpotList = new List<healthElementInfo> ();
health currentScannedObjectHealth;
vehicleHUDManager currentScannedVehicle;
GameObject currentGameObjectInScanner;
float distanceToScan;
float originalScanDistance;
Coroutine changeFovCoroutine;
Vector2 mainCanvasSizeDelta;
Vector2 halfMainCanvasSizeDelta;
Vector2 iconPosition2d;
bool usingScreenSpaceCamera;
bool targetOnScreen;
Vector3 screenPoint;
float currentDistanceToTarget;
Vector3 centerScreen;
float screenWidth;
float screenHeight;
bool objectToScanLocated;
void Start ()
{
//get the field of view of the camera
originalScannerCameraFov = scannerMainCamera.fieldOfView;
if (infiniteScanDistance) {
distanceToScan = Mathf.Infinity;
} else {
distanceToScan = scanDistance;
}
originalScanDistance = distanceToScan;
enableOrDisableScannerCameraComponents (false);
mainCanvasSizeDelta = mainPlayerCamera.getMainCanvasSizeDelta ();
halfMainCanvasSizeDelta = mainCanvasSizeDelta * 0.5f;
usingScreenSpaceCamera = mainPlayerCamera.isUsingScreenSpaceCamera ();
if (mainCamera == null) {
mainCamera = mainPlayerCamera.getMainCamera ();
}
}
void FixedUpdate ()
{
if (holdScannerInputActive) {
executeScanner ();
}
if (scannerModeIsActivated) {
screenWidth = Screen.width;
screenHeight = Screen.height;
}
//if there is a scanned object, make the scan icon follow this object in the screen
if (objectToScanLocated && scannedObject != null) {
if (usingScreenSpaceCamera) {
screenPoint = mainCamera.WorldToViewportPoint (scannedObject.transform.position);
targetOnScreen = screenPoint.z > 0 && screenPoint.x > 0 && screenPoint.x < 1 && screenPoint.y > 0 && screenPoint.y < 1;
} else {
screenPoint = mainCamera.WorldToScreenPoint (scannedObject.transform.position);
targetOnScreen = screenPoint.z > 0 && screenPoint.x > 0 && screenPoint.x < screenWidth && screenPoint.y > 0 && screenPoint.y < screenHeight;
}
centerScreen = new Vector3 (screenWidth / 2, screenHeight / 2, 0);
if (useMaxDistanceToCameraCenter) {
currentDistanceToTarget = GKC_Utils.distance (screenPoint, centerScreen);
if (currentDistanceToTarget > maxDistanceToCameraCenter) {
targetOnScreen = false;
}
}
//if the target is visible in the screnn, set the icon position
if (targetOnScreen) {
if (usingScreenSpaceCamera) {
iconPosition2d = new Vector2 ((screenPoint.x * mainCanvasSizeDelta.x) - halfMainCanvasSizeDelta.x, (screenPoint.y * mainCanvasSizeDelta.y) - halfMainCanvasSizeDelta.y);
iconRectTransform.anchoredPosition = Vector2.MoveTowards (iconRectTransform.anchoredPosition, iconPosition2d, Time.deltaTime * scaneIconMovementSpeed);
} else {
scanIcon.transform.position = Vector3.MoveTowards (scanIcon.transform.position, screenPoint, Time.deltaTime * scaneIconMovementSpeed);
}
if (!scanIcon.activeSelf) {
//play the scan icon animation to signal the scannable object
scanIcon.SetActive (true);
iconAnimation [scannerAnimationName].speed = -1;
iconAnimation [scannerAnimationName].time = iconAnimation [scannerAnimationName].length;
iconAnimation.Play (scannerAnimationName);
}
if (useAutoScanner) {
executeScanner ();
}
}
//if the object is off screen, disable the scan icon in the screen
else {
scanIconRect.anchoredPosition = Vector2.zero;
if (scanIcon.activeSelf) {
scanIcon.SetActive (false);
}
reset ();
}
if (removeLocatedObjectIfDisabledOnScene) {
if (!scannedObject.activeSelf || !scannedObject.activeInHierarchy) {
holdScannerInputActive = false;
activateScanner ();
return;
}
}
} else {
objectToScanLocated = false;
}
if (useWeakSpotScanner) {
if (currentScannedObjectHealth != null) {
for (int i = 0; i < healtWeakSpotList.Count; i++) {
if (healtWeakSpotList [i].used) {
if (usingScreenSpaceCamera) {
screenPoint = mainCamera.WorldToViewportPoint (healtWeakSpotList [i].target.position);
targetOnScreen = screenPoint.z > 0 && screenPoint.x > 0 && screenPoint.x < 1 && screenPoint.y > 0 && screenPoint.y < 1;
} else {
screenPoint = mainCamera.WorldToScreenPoint (healtWeakSpotList [i].target.position);
targetOnScreen = screenPoint.z > 0 && screenPoint.x > 0 && screenPoint.x < screenWidth && screenPoint.y > 0 && screenPoint.y < screenHeight;
}
//if the target is visible in the screnn, set the icon position
if (targetOnScreen) {
if (!healtWeakSpotList [i].healthElementGameObject.activeSelf) {
healtWeakSpotList [i].healthElementGameObject.SetActive (true);
}
if (usingScreenSpaceCamera) {
iconPosition2d = new Vector2 ((screenPoint.x * mainCanvasSizeDelta.x) - halfMainCanvasSizeDelta.x, (screenPoint.y * mainCanvasSizeDelta.y) - halfMainCanvasSizeDelta.y);
healtWeakSpotList [i].healthElementRectTransform.anchoredPosition = iconPosition2d;
} else {
healtWeakSpotList [i].healthElementGameObject.transform.position = new Vector3 (screenPoint.x, screenPoint.y, 0);
}
} else {
if (healtWeakSpotList [i].healthElementGameObject.activeSelf) {
healtWeakSpotList [i].healthElementGameObject.SetActive (false);
}
}
}
}
}
if (currentScannedVehicle != null) {
for (int i = 0; i < healtWeakSpotList.Count; i++) {
if (healtWeakSpotList [i].used) {
if (usingScreenSpaceCamera) {
screenPoint = mainCamera.WorldToViewportPoint (healtWeakSpotList [i].target.position);
targetOnScreen = screenPoint.z > 0 && screenPoint.x > 0 && screenPoint.x < 1 && screenPoint.y > 0 && screenPoint.y < 1;
} else {
screenPoint = mainCamera.WorldToScreenPoint (healtWeakSpotList [i].target.position);
targetOnScreen = screenPoint.z > 0 && screenPoint.x > 0 && screenPoint.x < screenWidth && screenPoint.y > 0 && screenPoint.y < screenHeight;
}
//if the target is visible in the screnn, set the icon position
if (targetOnScreen) {
if (!healtWeakSpotList [i].healthElementGameObject.activeSelf) {
healtWeakSpotList [i].healthElementGameObject.SetActive (true);
}
if (usingScreenSpaceCamera) {
iconPosition2d = new Vector2 ((screenPoint.x * mainCanvasSizeDelta.x) - halfMainCanvasSizeDelta.x, (screenPoint.y * mainCanvasSizeDelta.y) - halfMainCanvasSizeDelta.y);
healtWeakSpotList [i].healthElementRectTransform.anchoredPosition = iconPosition2d;
} else {
healtWeakSpotList [i].healthElementGameObject.transform.position = new Vector3 (screenPoint.x, screenPoint.y, 0);
}
} else {
if (healtWeakSpotList [i].healthElementGameObject.activeSelf) {
healtWeakSpotList [i].healthElementGameObject.SetActive (false);
}
}
}
}
}
}
//if the scan mode is enabled, launch a ray from the center of the screen in forward direction, searching a scannable object
if (scannerModeIsActivated) {
Debug.DrawRay (mainCameraTransform.position, mainCameraTransform.forward * distanceToScan, Color.red);
if (Physics.Raycast (mainCameraTransform.position, mainCameraTransform.forward, out hit, distanceToScan, layer)) {
//scannble object detected
if (hit.collider.GetComponent<scanElementInfo> ()) {
//if it the first scannable object found, set as scannedObject
if (scannedObject == null) {
scannedObject = hit.collider.gameObject;
objectToScanLocated = true;
setScannedObjectInfo ();
}
//if there was already another scannable object different from the current found, change it
else if (scannedObject != hit.collider.gameObject) {
scannedObject = hit.collider.gameObject;
objectToScanLocated = true;
setScannedObjectInfo ();
reset ();
}
lookingObject = true;
}
//nothing found
else {
lookingObject = false;
}
}
}
}
public bool playerIsBusy ()
{
if (!playerControllerManager.isUsingDevice () && !playerControllerManager.isUsingSubMenu () && !playerControllerManager.isPlayerMenuActive ()) {
return false;
}
return true;
}
public void activateScanner ()
{
//activate the scanner mode
enableScanner ();
//if the key button is released, reset the info of the scanner
if (scannedObject != null) {
if (slider.value >= slider.maxValue || slider.value != slider.maxValue) {
reset ();
}
}
}
public void executeScanner ()
{
//if there is a scannedObject detected
if (scannedObject != null) {
//check if the info of the object has been already scanned
if (!currentObjectToScan.isScanned ()) {
//in that case, scan the object
scanStatus.text = scanningString;
//while the key is held, increase the slider value
if (currentObjectToScan.useCustomScanSpeed) {
slider.value += Time.deltaTime * currentObjectToScan.customScanSpeed;
} else {
slider.value += Time.deltaTime * scanSpeed;
}
//when the slider reachs its max value
if (slider.value == slider.maxValue) {
//set the object to already scanned
currentObjectToScan.scanObject ();
//get the info of the object
objectChecked ();
}
}
//if the object has been already scanned
else {
//get the info of the object
objectChecked ();
}
}
}
public void setScannedObjectInfo ()
{
currentObjectToScan = scannedObject.GetComponent<scanElementInfo> ();
currentGameObjectInScanner = currentObjectToScan.dataGameObject;
if (useWeakSpotScanner) {
if (currentGameObjectInScanner != null) {
currentScannedObjectHealth = currentGameObjectInScanner.GetComponent<health> ();
if (currentScannedObjectHealth == null) {
characterDamageReceiver currentCharacterDamageReceiver = GetComponent<characterDamageReceiver> ();
if (currentCharacterDamageReceiver != null) {
currentScannedObjectHealth = currentCharacterDamageReceiver.getHealthManager ();
}
}
if (currentScannedObjectHealth != null) {
if (currentScannedObjectHealth.advancedSettings.weakSpots.Count > 0) {
addHealthWeakSpotList ();
return;
}
}
currentScannedVehicle = currentGameObjectInScanner.GetComponent<vehicleHUDManager> ();
if (currentScannedVehicle == null) {
vehicleDamageReceiver currentVehicleDamageReceiver = currentGameObjectInScanner.GetComponent<vehicleDamageReceiver> ();
currentScannedVehicle = currentVehicleDamageReceiver.getHUDManager ();
}
if (currentScannedVehicle != null) {
if (currentScannedVehicle.advancedSettings.damageReceiverList.Count > 0) {
addHealthWeakSpotList ();
}
}
}
}
}
//get the info from the scannable object, name and description
void objectChecked ()
{
slider.value = slider.maxValue;
objectInfo.text = currentObjectToScan.dataObject.info;
objectName.text = currentObjectToScan.dataObject.name;
scanStatus.text = scanCompleteString;
}
//reset the info of the scanner
void reset ()
{
slider.value = 0;
scanStatus.text = scanVisorActiveString;
objectInfo.text = emptyScannerInfoString;
objectName.text = "";
scannedObject = null;
currentObjectToScan = null;
currentGameObjectInScanner = null;
currentScannedObjectHealth = null;
currentScannedVehicle = null;
if (useWeakSpotScanner) {
disableHealtWeakSpotList ();
}
objectToScanLocated = false;
}
//enable of disable the scanner according to the situation
public void enableScanner ()
{
//if the player is not in aim mode, or the scanner mode is not already enabled, or using a device and the scanner mode is active in the feature manager
if (!playerControllerManager.isPlayerAimingInThirdPerson () && !lookingObject && !playerControllerManager.isUsingDevice () && scannerSystemEnabled
&& mainPlayerCamera.isCameraTypeFree ()) {
//change its state
scannerModeIsActivated = !scannerModeIsActivated;
checkEventsOnEnableDisableScanner ();
//if the scanner mode is enabled, check if the player is in first person mode
if (scannerModeIsActivated) {
isFirstPersonView = mainPlayerCamera.isFirstPersonActive ();
}
//if the player is not in first person mode, change it to that view
if (!isFirstPersonView) {
if (!ignoreChangeToFirstPersonEnabled) {
mainPlayerCamera.changeCameraView ();
}
}
reset ();
if (scanIcon.activeSelf) {
scanIcon.SetActive (false);
}
checkScannerCameraFov ();
}
}
//disable the scanner from other script
public void disableScanner ()
{
scannerModeIsActivated = false;
reset ();
if (scanIcon.activeSelf) {
scanIcon.SetActive (false);
}
checkScannerCameraFov ();
checkEventsOnEnableDisableScanner ();
holdScannerInputActive = false;
}
public void checkEventsOnEnableDisableScanner ()
{
if (scannerModeIsActivated) {
eventOnScannerEnabled.Invoke ();
} else {
eventOnScannerDisabled.Invoke ();
}
}
public void checkScannerCameraFov ()
{
//check if the player set the zoom mode, so if the scanned mode is enabled or disabled the camera fov is correctly changed
if (zoomActive) {
//change the fov of the scanner camera
if (scannerModeIsActivated) {
enableOrDisableScannerZoom (true);
//the scanner mode is enabled when the zoom was enabled
} else {
enableOrDisableScannerZoom (false);
//the scanner mode is disabled when the zoom was enabled
}
} else {
if (scannerModeIsActivated) {
targetScannerCameraFov = initialCameraFov;
} else {
targetScannerCameraFov = originalScannerCameraFov;
}
checkFovCoroutine (targetScannerCameraFov);
}
}
//change the zoom in the scanner camera if the player use the zoom
public void enableOrDisableScannerZoom (bool value)
{
zoomActive = value;
//decrease the fov
if (zoomActive) {
//zoom enabled
targetScannerCameraFov = zoomCameraFov;
} else {
//increase the fov
if (scannerModeIsActivated) {
targetScannerCameraFov = initialCameraFov;
//zoom disabled when the scanner mode was enabled
} else {
targetScannerCameraFov = originalScannerCameraFov;
//zoom disable when the scanner mode was disabled
}
}
if (!zoomActive && mainPlayerCamera.isUsingZoom ()) {
zoomActive = true;
targetScannerCameraFov = mainCamera.fieldOfView;
}
checkScanDistance (value);
checkFovCoroutine (targetScannerCameraFov);
}
public void checkScanDistance (bool value)
{
if (scanDistanceAffectedByZoom) {
if (value) {
distanceToScan += scanDistanceExtraWithZoom;
} else {
distanceToScan = originalScanDistance;
}
}
}
public bool isScannerActivated ()
{
return scannerModeIsActivated;
}
public void checkFovCoroutine (float targetValue)
{
if (changeFovCoroutine != null) {
StopCoroutine (changeFovCoroutine);
}
changeFovCoroutine = StartCoroutine (changeFovValue (targetValue));
}
public IEnumerator changeFovValue (float targetValue)
{
if (scannerModeIsActivated) {
enableOrDisableScannerCameraComponents (true);
}
//if the small screen in the center is enabled, change the fov to the scanner mode, checking also if the player use the zoom mode
while (scannerMainCamera.fieldOfView != targetValue) {
scannerMainCamera.fieldOfView = Mathf.MoveTowards (scannerMainCamera.fieldOfView, targetValue, Time.deltaTime * fovChangeSpeed);
yield return null;
}
if (!scannerModeIsActivated) {
enableOrDisableScannerCameraComponents (false);
}
}
public void enableOrDisableScannerCameraComponents (bool state)
{
enableOrDisableScannerCamera (state);
if (scannerCameraUI.activeSelf != state) {
scannerCameraUI.SetActive (state);
}
if (scannerHUD.activeSelf != state) {
scannerHUD.SetActive (state);
}
}
public void enableOrDisableScannerCamera (bool state)
{
if (pauseEnableOrDisableScannerCameraElement) {
return;
}
if (scannerMainCamera.enabled != state) {
scannerMainCamera.enabled = state;
}
}
public void toggleScannerCameraElement ()
{
enableOrDisableScannerCamera (!scannerMainCamera.enabled);
}
bool pauseEnableOrDisableScannerCameraElement;
public void setPauseEnableOrDisableScannerCameraElementState (bool state)
{
pauseEnableOrDisableScannerCameraElement = state;
}
public void togglePauseEnableOrDisableScannerCameraElementState ()
{
setPauseEnableOrDisableScannerCameraElementState (!pauseEnableOrDisableScannerCameraElement);
}
public void addHealthWeakSpotList ()
{
if (!healthInfoParent.gameObject.activeSelf) {
healthInfoParent.gameObject.SetActive (true);
}
if (currentScannedObjectHealth != null) {
int weakSpotsAmount = currentScannedObjectHealth.advancedSettings.weakSpots.Count;
for (int i = 0; i < weakSpotsAmount; i++) {
if (i < healtWeakSpotList.Count) {
healtWeakSpotList [i].target = currentScannedObjectHealth.advancedSettings.weakSpots [i].spotTransform;
string spotText = "x" + currentScannedObjectHealth.advancedSettings.weakSpots [i].damageMultiplier;
if (currentScannedObjectHealth.advancedSettings.weakSpots [i].killedWithOneShoot) {
spotText = "Death";
}
healtWeakSpotList [i].healthSpot.text = spotText;
healtWeakSpotList [i].used = true;
} else {
GameObject newWeakSpotMesh = (GameObject)Instantiate (healthElement, healthElement.transform.position, Quaternion.identity);
newWeakSpotMesh.transform.SetParent (healthInfoParent);
newWeakSpotMesh.transform.localScale = Vector3.one;
newWeakSpotMesh.transform.localPosition = Vector3.zero;
healthElementInfo newHealthElementInfo = newWeakSpotMesh.GetComponent<weakSpotInfo> ().elementInfo;
newHealthElementInfo.target = currentScannedObjectHealth.advancedSettings.weakSpots [i].spotTransform;
string spotText = "x" + currentScannedObjectHealth.advancedSettings.weakSpots [i].damageMultiplier;
if (currentScannedObjectHealth.advancedSettings.weakSpots [i].killedWithOneShoot) {
spotText = "Death";
}
newHealthElementInfo.healthSpot.text = spotText;
newHealthElementInfo.used = true;
healtWeakSpotList.Add (newHealthElementInfo);
}
}
if (weakSpotsAmount < healtWeakSpotList.Count) {
for (int i = weakSpotsAmount; i < healtWeakSpotList.Count; i++) {
if (healtWeakSpotList [i].healthElementGameObject.activeSelf) {
healtWeakSpotList [i].healthElementGameObject.SetActive (false);
}
healtWeakSpotList [i].used = false;
}
}
objectScannedHealthNameText.text = currentScannedObjectHealth.getCharacterName ();
objectScannedHealthAmountText.text = currentScannedObjectHealth.getCurrentHealthAmount ().ToString ();
}
if (currentScannedVehicle != null) {
int weakSpotsAmount = currentScannedVehicle.advancedSettings.damageReceiverList.Count;
for (int i = 0; i < weakSpotsAmount; i++) {
if (i < healtWeakSpotList.Count) {
healtWeakSpotList [i].target = currentScannedVehicle.advancedSettings.damageReceiverList [i].spotTransform;
string spotText = "x" + currentScannedVehicle.advancedSettings.damageReceiverList [i].damageMultiplier;
if (currentScannedVehicle.advancedSettings.damageReceiverList [i].killedWithOneShoot) {
spotText = "Death";
}
healtWeakSpotList [i].healthSpot.text = spotText;
healtWeakSpotList [i].used = true;
} else {
GameObject newWeakSpotMesh = (GameObject)Instantiate (healthElement, healthElement.transform.position, Quaternion.identity);
newWeakSpotMesh.transform.SetParent (healthInfoParent);
newWeakSpotMesh.transform.localScale = Vector3.one;
newWeakSpotMesh.transform.localPosition = Vector3.zero;
healthElementInfo newHealthElementInfo = newWeakSpotMesh.GetComponent<weakSpotInfo> ().elementInfo;
newHealthElementInfo.target = currentScannedVehicle.advancedSettings.damageReceiverList [i].spotTransform;
string spotText = "x" + currentScannedVehicle.advancedSettings.damageReceiverList [i].damageMultiplier;
if (currentScannedVehicle.advancedSettings.damageReceiverList [i].killedWithOneShoot) {
spotText = "Death";
}
newHealthElementInfo.healthSpot.text = spotText;
newHealthElementInfo.used = true;
healtWeakSpotList.Add (newHealthElementInfo);
}
}
if (weakSpotsAmount < healtWeakSpotList.Count) {
for (int i = weakSpotsAmount; i < healtWeakSpotList.Count; i++) {
if (healtWeakSpotList [i].healthElementGameObject.activeSelf) {
healtWeakSpotList [i].healthElementGameObject.SetActive (false);
}
healtWeakSpotList [i].used = false;
}
}
objectScannedHealthNameText.text = currentScannedVehicle.getVehicleName ();
objectScannedHealthAmountText.text = currentScannedVehicle.getCurrentHealthAmount ().ToString ();
}
}
public void disableHealtWeakSpotList ()
{
for (int i = 0; i < healtWeakSpotList.Count; i++) {
if (healtWeakSpotList [i].healthElementGameObject.activeSelf) {
healtWeakSpotList [i].healthElementGameObject.SetActive (false);
}
healtWeakSpotList [i].used = false;
}
if (healthInfoParent.gameObject.activeSelf) {
healthInfoParent.gameObject.SetActive (false);
}
}
//CALL INPUT FUNCTIONS
public void inputHoldScanner ()
{
if (!scannerSystemEnabled) {
return;
}
if (playerIsBusy ()) {
return;
}
holdScannerInputActive = true;
}
public void inputReleaseScanner ()
{
if (!scannerSystemEnabled) {
return;
}
if (playerIsBusy ()) {
return;
}
if (!mainPlayerCamera.isFirstPersonActive () &&
!mainPlayerCamera.isChangeCameraViewEnabled () &&
!ignoreChangeToFirstPersonEnabled) {
return;
}
holdScannerInputActive = false;
activateScanner ();
}
public void setScannerSystemEnabledState (bool state)
{
scannerSystemEnabled = state;
}
public void setScannerSystemEnabledStateFromEditor (bool state)
{
setScannerSystemEnabledState (state);
updateComponent ();
}
void updateComponent ()
{
GKC_Utils.updateComponent (this);
}
}

View File

@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 8775065c345b44045b198f95c65fcc68
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/Scanner System/scannerSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,53 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class simpleScannerSystem : MonoBehaviour
{
public bool simpleScannerCameraEnabled = true;
public Camera mainCamera;
public LayerMask regularLayerMask;
public LayerMask scannerLayerMask;
public bool cameraActive;
public bool useEventsOnCameraStateChange;
public UnityEvent eventOnCameraActive;
public UnityEvent eventOnCameraDeactivate;
public void enableOrDisableCamera (bool state)
{
if (!simpleScannerCameraEnabled) {
return;
}
if (cameraActive == state) {
return;
}
cameraActive = state;
if (useEventsOnCameraStateChange) {
if (state) {
eventOnCameraActive.Invoke ();
} else {
eventOnCameraDeactivate.Invoke ();
}
}
if (state) {
mainCamera.cullingMask = scannerLayerMask;
} else {
mainCamera.cullingMask = regularLayerMask;
}
}
public void toggleCameraEnabledState ()
{
enableOrDisableCamera (!cameraActive);
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 0c6ff7a78851bf84e9651faaae4c08cd
timeCreated: 1626441585
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/Scanner System/simpleScannerSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,56 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SimpleFPSCounter : MonoBehaviour
{
public bool fpsCounterEnabled = true;
public Text fpsText;
float deltaTime = 0.0f;
bool fpsCounterActive;
void Start ()
{
enableOrDisableFPSCounter (fpsCounterEnabled);
}
void Update ()
{
if (!fpsCounterActive) {
return;
}
deltaTime += (Time.unscaledDeltaTime - deltaTime) * 0.1f;
float msec = deltaTime * 1000.0f;
float fps = 1.0f / deltaTime;
fpsText.text = string.Format ("{0:0.0} ms ({1:0.})", msec, fps);
}
void OnEnable ()
{
if (Application.isPlaying) {
enableOrDisableFPSCounter (true);
}
}
void enableOrDisableFPSCounter (bool state)
{
if (fpsCounterActive == state) {
return;
}
fpsCounterActive = state;
if (fpsText != null) {
if (fpsText.gameObject.activeSelf != fpsCounterActive) {
fpsText.gameObject.SetActive (fpsCounterActive);
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: bca52a07015d0bf49ac9b659fcd95b83
timeCreated: 1560367303
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/SimpleFPSCounter.cs
uploadId: 814740

View File

@@ -0,0 +1,57 @@
using UnityEngine;
public class SplineWalker : MonoBehaviour
{
public enum SplineWalkerMode
{
Once,
Loop,
PingPong
}
public BezierSpline spline;
public float duration;
public bool lookForward;
public SplineWalkerMode mode;
public float progress;
public bool goingForward = true;
private void Update ()
{
if (goingForward) {
progress += Time.deltaTime / duration;
if (progress > 1f) {
if (mode == SplineWalkerMode.Once) {
progress = 1f;
} else if (mode == SplineWalkerMode.Loop) {
progress -= 1f;
} else {
progress = 2f - progress;
goingForward = false;
}
}
} else {
progress -= Time.deltaTime / duration;
if (progress < 0f) {
progress = -progress;
goingForward = true;
}
}
Vector3 position = spline.GetPoint (progress);
transform.localPosition = position;
if (lookForward) {
transform.LookAt (position + spline.GetDirection (progress));
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 76d93995e093cd944812f371bd5a207e
timeCreated: 1560380366
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/SplineWalker.cs
uploadId: 814740

View File

@@ -0,0 +1,40 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
public class UIMouseHoverEvent : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
[Header ("Main Settings")]
[Space]
public bool eventOnTriggerEnterEnabled = true;
public bool eventOnTriggerExitEnabled = true;
[Space]
[Header ("Event Settings")]
[Space]
public UnityEvent eventOnTriggerEnter;
[Space]
public UnityEvent eventOnTriggerExit;
//Detect if the Cursor starts to pass over the GameObject
public void OnPointerEnter (PointerEventData pointerEventData)
{
if (eventOnTriggerEnterEnabled) {
eventOnTriggerEnter.Invoke ();
}
}
//Detect when Cursor leaves the GameObject
public void OnPointerExit (PointerEventData pointerEventData)
{
if (eventOnTriggerExitEnabled) {
eventOnTriggerExit.Invoke ();
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: d3532e3bb57a3774fbf5fbe0a1c9727a
timeCreated: 1559178784
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/UIMouseHoverEvent.cs
uploadId: 814740

View File

@@ -0,0 +1,344 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class addForceToObjectSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool affectToPlayerOnlyOnAIr;
public bool affectOnlyOnParagliderActive;
public float forceAmountOnParaglider;
public float forceAmountCharacters;
public float forceAmountRegularObjects;
public float forceAmountVehicles;
public ForceMode forceModeCharacters;
public ForceMode forceModeRegularObjects;
public ForceMode forceModeVehicles;
public bool addForceInUpdate;
[Space]
[Header ("Detection Settings")]
[Space]
public bool checkPlayerEnabled = true;
public string playerTag = "Player";
public bool checkVehiclesEnabled;
public bool useLayerToCheck;
public LayerMask layerToCheck;
[Space]
[Header ("Wind/Air Settings")]
[Space]
public bool checkWindObjectStateEnabled;
public bool ignoreForcesOnVehicleIfWindActive;
public Transform windDirectionTransform;
public float windForce;
public bool updateWindDirectionOnUpdate;
[Space]
[Header ("Debug")]
[Space]
public List<rigidbodyInfo> rigidbodyInfoList = new List<rigidbodyInfo> ();
public bool objectsDetected;
public bool pauseUpdateForces;
[Space]
[Header ("Components")]
[Space]
public Transform forceDirection;
Vector3 forceDirectionForward;
rigidbodyInfo currentRigidbodyInfo;
void Update ()
{
if (pauseUpdateForces) {
return;
}
if (updateWindDirectionOnUpdate) {
if (objectsDetected) {
forceDirectionForward = forceDirection.forward;
for (int i = 0; i < rigidbodyInfoList.Count; i++) {
currentRigidbodyInfo = rigidbodyInfoList [i];
if (currentRigidbodyInfo.mainRigidbody != null) {
if (currentRigidbodyInfo.isPlayer) {
if (affectToPlayerOnlyOnAIr) {
bool currentPlayerOnAir = !currentRigidbodyInfo.mainExternalControllerBehavior.isCharacterOnGround ();
if (currentPlayerOnAir) {
if (affectOnlyOnParagliderActive) {
currentRigidbodyInfo.mainExternalControllerBehavior.updateExternalForceActiveState (forceDirectionForward, forceAmountOnParaglider);
} else {
currentRigidbodyInfo.mainRigidbody.AddForce (forceAmountCharacters * forceDirectionForward, forceModeCharacters);
}
}
} else {
currentRigidbodyInfo.mainRigidbody.AddForce (forceAmountCharacters * forceDirectionForward, forceModeCharacters);
}
} else if (currentRigidbodyInfo.isVehicle) {
if (!currentRigidbodyInfo.ignoreForcesOnVehicleIfWindActive) {
currentRigidbodyInfo.mainRigidbody.AddForce (forceAmountVehicles * forceDirectionForward, forceModeVehicles);
}
} else {
currentRigidbodyInfo.mainRigidbody.AddForce (forceAmountRegularObjects * forceDirectionForward, forceModeRegularObjects);
}
if (updateWindDirectionOnUpdate) {
if (currentRigidbodyInfo.applyWindOnObject) {
currentRigidbodyInfo.mainWindOnObjectState.setWindDirectionValues (windDirectionTransform.forward);
currentRigidbodyInfo.mainWindOnObjectState.setWindForceValue (windForce);
}
}
}
}
}
}
}
public void setPauseUpdateForcesState (bool state)
{
pauseUpdateForces = state;
}
public void setWindDetectedStateOnAllObjects (bool state)
{
if (updateWindDirectionOnUpdate) {
for (int i = 0; i < rigidbodyInfoList.Count; i++) {
currentRigidbodyInfo = rigidbodyInfoList [i];
if (currentRigidbodyInfo.mainRigidbody != null) {
if (currentRigidbodyInfo.applyWindOnObject) {
currentRigidbodyInfo.mainWindOnObjectState.setWindDetectedState (state);
}
}
}
}
}
public void addNewObject (GameObject newObject)
{
if (useLayerToCheck) {
bool checkObjectResult = false;
if ((1 << newObject.layer & layerToCheck.value) == 1 << newObject.layer) {
checkObjectResult = true;
}
if (!checkObjectResult) {
return;
}
}
if (!checkPlayerEnabled) {
if (newObject.CompareTag (playerTag)) {
return;
}
}
bool isVehicle = false;
if (checkVehiclesEnabled) {
GameObject currentVehicle = applyDamage.getVehicle (newObject);
if (currentVehicle != null) {
isVehicle = true;
newObject = currentVehicle;
}
}
Rigidbody mainRigidbody = newObject.GetComponent<Rigidbody> ();
if (mainRigidbody != null) {
for (int i = 0; i < rigidbodyInfoList.Count; i++) {
if (rigidbodyInfoList [i].mainObject == newObject) {
return;
}
}
rigidbodyInfo newRigidbodyInfo = new rigidbodyInfo ();
newRigidbodyInfo.mainObject = newObject;
newRigidbodyInfo.mainRigidbody = mainRigidbody;
if (newObject.CompareTag (playerTag)) {
newRigidbodyInfo.isPlayer = true;
playerComponentsManager currentPlayerComponentsManager = newObject.GetComponent<playerComponentsManager> ();
if (currentPlayerComponentsManager != null) {
externalControllerBehavior currentExternalControllerBehavior = currentPlayerComponentsManager.getParagliderSystem ();
if (currentExternalControllerBehavior != null) {
newRigidbodyInfo.mainExternalControllerBehavior = currentExternalControllerBehavior;
newRigidbodyInfo.mainExternalControllerBehavior.setExternalForceActiveState (true);
}
}
}
newRigidbodyInfo.isVehicle = isVehicle;
if (checkWindObjectStateEnabled) {
windOnObjectState currentWindOnObjectState = newObject.GetComponent<windOnObjectState> ();
if (currentWindOnObjectState != null) {
newRigidbodyInfo.mainWindOnObjectState = currentWindOnObjectState;
currentWindOnObjectState.setWindDetectedState (true);
currentWindOnObjectState.setWindDirectionValues (windDirectionTransform.forward);
currentWindOnObjectState.setWindForceValue (windForce);
newRigidbodyInfo.applyWindOnObject = true;
if (isVehicle) {
if (ignoreForcesOnVehicleIfWindActive) {
newRigidbodyInfo.ignoreForcesOnVehicleIfWindActive = true;
}
}
}
}
rigidbodyInfoList.Add (newRigidbodyInfo);
objectsDetected = true;
}
}
public void removeObject (GameObject objectToRemove)
{
if (useLayerToCheck) {
bool checkObjectResult = false;
if ((1 << objectToRemove.layer & layerToCheck.value) == 1 << objectToRemove.layer) {
checkObjectResult = true;
}
if (!checkObjectResult) {
return;
}
}
if (checkVehiclesEnabled) {
GameObject currentVehicle = applyDamage.getVehicle (objectToRemove);
if (currentVehicle != null) {
objectToRemove = currentVehicle;
}
}
for (int i = rigidbodyInfoList.Count - 1; i >= 0; i--) {
if (rigidbodyInfoList [i] == null) {
rigidbodyInfoList.RemoveAt (i);
}
}
if (rigidbodyInfoList.Count == 0) {
objectsDetected = false;
}
for (int i = 0; i < rigidbodyInfoList.Count; i++) {
currentRigidbodyInfo = rigidbodyInfoList [i];
if (currentRigidbodyInfo.mainObject == objectToRemove) {
if (currentRigidbodyInfo.isPlayer) {
if (affectOnlyOnParagliderActive && currentRigidbodyInfo.mainExternalControllerBehavior != null) {
currentRigidbodyInfo.mainExternalControllerBehavior.setExternalForceActiveState (false);
}
}
if (checkWindObjectStateEnabled) {
if (currentRigidbodyInfo.applyWindOnObject) {
currentRigidbodyInfo.mainWindOnObjectState.setWindDetectedState (false);
currentRigidbodyInfo.mainWindOnObjectState.setWindDirectionValues (Vector3.zero);
currentRigidbodyInfo.mainWindOnObjectState.setWindForceValue (0);
}
}
rigidbodyInfoList.RemoveAt (i);
if (rigidbodyInfoList.Count == 0) {
objectsDetected = false;
}
return;
}
}
}
public void removeAllObjects ()
{
for (int i = rigidbodyInfoList.Count - 1; i >= 0; i--) {
if (rigidbodyInfoList [i] == null) {
rigidbodyInfoList.RemoveAt (i);
}
}
for (int i = 0; i < rigidbodyInfoList.Count; i++) {
removeObject (rigidbodyInfoList [i].mainObject);
}
rigidbodyInfoList.Clear ();
objectsDetected = false;
}
public void setWindForceValue (float newValue)
{
windForce = newValue;
}
[System.Serializable]
public class rigidbodyInfo
{
public string Name;
public bool isPlayer;
public GameObject mainObject;
public Rigidbody mainRigidbody;
public externalControllerBehavior mainExternalControllerBehavior;
public windOnObjectState mainWindOnObjectState;
public bool isVehicle;
public bool applyWindOnObject;
public bool ignoreForcesOnVehicleIfWindActive;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 797e073af74c0514a987de643a72a856
timeCreated: 1562496999
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/addForceToObjectSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,58 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class animatorTriggerEnterExitEvent : StateMachineBehaviour
{
[Header ("Main Settings")]
[Space]
public bool eventEnabled = true;
public bool eventEnterEnabled = true;
public bool eventExitEnabled = true;
[Space]
[Space]
public string enterEventMessage;
public string enterEventMessageParameter;
[Space]
[Space]
public string exitEventMessage;
public string exitEventMessageParameter;
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
public override void OnStateEnter (Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (eventEnabled && eventEnterEnabled) {
animator.SendMessage (enterEventMessage, enterEventMessageParameter, SendMessageOptions.DontRequireReceiver);
}
}
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
public override void OnStateExit (Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (eventEnabled && eventExitEnabled) {
animator.SendMessage (exitEventMessage, exitEventMessageParameter, SendMessageOptions.DontRequireReceiver);
}
}
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
// override public void OnStateUpdate (Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
// {
// }
// OnStateMove is called right after Animator.OnAnimatorMove(). Code that processes and affects root motion should be implemented here
//override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
//
//}
// OnStateIK is called right after Animator.OnAnimatorIK(). Code that sets up animation IK (inverse kinematics) should be implemented here.
//override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
//
//}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: e9d14b05bef276e4486487d75acc1e0a
timeCreated: 1588220938
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/animatorTriggerEnterExitEvent.cs
uploadId: 814740

View File

@@ -0,0 +1,85 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class animatorTriggerEvent : StateMachineBehaviour
{
[Header ("Main Settings")]
[Space]
public bool eventEnabled = true;
public bool eventOnEnterEnabled = true;
public bool eventOnExitEnabled;
[Space]
public string eventMessage;
[Space]
public bool useMessageParameter = true;
public string eventMessageParameter;
[Space]
[Header ("Remote Animator Trigger Event Settings")]
[Space]
public bool useRemoteAnimatorTriggerEventSystem;
public string RemoteAnimatorTriggerEventName;
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
public override void OnStateEnter (Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (eventEnabled && eventOnEnterEnabled) {
if (useRemoteAnimatorTriggerEventSystem) {
remoteAnimatorEventTriggerSystem currentRemoteAnimatorEventTriggerSystem = animator.GetComponent<remoteAnimatorEventTriggerSystem> ();
if (currentRemoteAnimatorEventTriggerSystem != null) {
currentRemoteAnimatorEventTriggerSystem.callRemoteEvent (RemoteAnimatorTriggerEventName);
}
} else {
if (useMessageParameter) {
animator.SendMessage (eventMessage, eventMessageParameter, SendMessageOptions.DontRequireReceiver);
} else {
animator.SendMessage (eventMessage, SendMessageOptions.DontRequireReceiver);
}
}
}
}
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
public override void OnStateExit (Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (eventEnabled && eventOnExitEnabled) {
if (useRemoteAnimatorTriggerEventSystem) {
remoteAnimatorEventTriggerSystem currentRemoteAnimatorEventTriggerSystem = animator.GetComponent<remoteAnimatorEventTriggerSystem> ();
if (currentRemoteAnimatorEventTriggerSystem != null) {
currentRemoteAnimatorEventTriggerSystem.callRemoteEvent (RemoteAnimatorTriggerEventName);
}
} else {
if (useMessageParameter) {
animator.SendMessage (eventMessage, eventMessageParameter, SendMessageOptions.DontRequireReceiver);
} else {
animator.SendMessage (eventMessage, SendMessageOptions.DontRequireReceiver);
}
}
}
}
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
//override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
//
//}
// OnStateMove is called right after Animator.OnAnimatorMove(). Code that processes and affects root motion should be implemented here
//override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
//
//}
// OnStateIK is called right after Animator.OnAnimatorIK(). Code that sets up animation IK (inverse kinematics) should be implemented here.
//override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
//
//}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: dd5f9eb1dd7cb574ca4497faaa1f69ec
timeCreated: 1570105923
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/animatorTriggerEvent.cs
uploadId: 814740

View File

@@ -0,0 +1,66 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#if UNITY_2019_1_OR_NEWER
using UnityEditor.Presets;
#endif
#endif
public class applyPresetSystem : MonoBehaviour
{
public static void GKCapplyProjectSettings ()
{
#if UNITY_EDITOR
print ("Apply tag manager and input manager presets");
#if UNITY_2019_1_OR_NEWER
Preset mainInputPreset = AssetDatabase.LoadAssetAtPath<Preset> ("Assets/Game Kit Controller/Presets/GKC InputManager.preset");
#endif
SerializedObject mainInputManager = new SerializedObject (AssetDatabase.LoadAllAssetsAtPath ("ProjectSettings/InputManager.asset") [0]);
if (mainInputManager != null) {
Object inputManagerTargetObject = mainInputManager.targetObject;
#if UNITY_2019_1_OR_NEWER
mainInputPreset.ApplyTo (inputManagerTargetObject);
print ("Input manager preset applied");
#endif
}
#if UNITY_2019_1_OR_NEWER
Preset tagManagerPreset = AssetDatabase.LoadAssetAtPath<Preset> ("Assets/Game Kit Controller/Presets/GKC TagManager.preset");
#endif
SerializedObject tagManager = new SerializedObject (AssetDatabase.LoadAllAssetsAtPath ("ProjectSettings/TagManager.asset") [0]);
if (tagManager != null) {
Object tagManagerTargetObject = tagManager.targetObject;
#if UNITY_2019_1_OR_NEWER
tagManagerPreset.ApplyTo (tagManagerTargetObject);
print ("Tag manager preset applied");
#endif
}
#endif
}
}

View File

@@ -0,0 +1,61 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#if UNITY_2019_4_9_OR_NEWER
using UnityEditor.Presets;
#endif
#endif
public class applyPresetSystem : MonoBehaviour
{
public static void GKCapplyProjectSettings ()
{
#if UNITY_EDITOR
print ("Apply tag manager and input manager presets");
#if UNITY_2019_4_9_OR_NEWER
Preset mainInputPreset = AssetDatabase.LoadAssetAtPath<Preset> ("Assets/Game Kit Controller/Presets/GKC InputManager.preset");
#endif
SerializedObject mainInputManager = new SerializedObject (AssetDatabase.LoadAllAssetsAtPath ("ProjectSettings/InputManager.asset") [0]);
if (mainInputManager != null) {
Object inputManagerTargetObject = mainInputManager.targetObject;
#if UNITY_2019_4_9_OR_NEWER
mainInputPreset.ApplyTo (inputManagerTargetObject);
#endif
}
#if UNITY_2019_4_9_OR_NEWER
Preset tagManagerPreset = AssetDatabase.LoadAssetAtPath<Preset> ("Assets/Game Kit Controller/Presets/GKC TagManager.preset");
#endif
SerializedObject tagManager = new SerializedObject (AssetDatabase.LoadAllAssetsAtPath ("ProjectSettings/TagManager.asset") [0]);
if (tagManager != null) {
Object tagManagerTargetObject = tagManager.targetObject;
#if UNITY_2019_4_9_OR_NEWER
tagManagerPreset.ApplyTo (tagManagerTargetObject);
#endif
}
#endif
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 231d3c05dee0b844b823695be1de8c8a
timeCreated: 1669743141
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/applyPresetSystem.cs.bak
uploadId: 814740

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 14a80bed165f9b64cbc005b033561d80
timeCreated: 1658024611
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/applyPresetSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class audioSourceInfo
{
public string audioSourceName;
public AudioSource audioSource;
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 516a6bf8835eb014fb992758d98f5757
timeCreated: 1516497765
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/audioSourceInfo.cs
uploadId: 814740

View File

@@ -0,0 +1,34 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class changeObjectColors : MonoBehaviour
{
bool changeColors;
public List<Material> materials = new List<Material> ();
public List<Color> originalColor = new List<Color> ();
int i, j, k;
float timer = 0;
void Start ()
{
}
void Update ()
{
if (changeColors) {
timer += Time.deltaTime;
for (k = 0; k < materials.Count; k++) {
materials [k].color = Color.Lerp (materials [k].color, originalColor [k], timer / 3);
}
}
}
public void setCurrentColors (List<Material> materialsList, List<Color> originalColorList)
{
materials = materialsList;
originalColor = originalColorList;
changeColors = true;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 30a68d1acc76f954fad427558e1fedd5
timeCreated: 1467074067
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/changeObjectColors.cs
uploadId: 814740

View File

@@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class checkCharactersParentOnDestroy : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool checkCharactersParentOnDestroyEnabled = true;
public Transform mainParent;
void OnDestroy ()
{
if (checkCharactersParentOnDestroyEnabled) {
if (mainParent == null) {
mainParent = transform;
}
Component [] playerControllerList = mainParent.GetComponentsInChildren (typeof (playerController));
foreach (playerController currentPlayerController in playerControllerList) {
currentPlayerController.setPlayerAndCameraAndFBAPivotTransformParent (null);
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 669d6c59347ff2e4c834e854c2db3b4a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/checkCharactersParentOnDestroy.cs
uploadId: 814740

View File

@@ -0,0 +1,379 @@
using UnityEngine;
using System.Collections;
using UnityEngine.Events;
public class checkCollisionType : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool checkCollisionsEnabled = true;
public bool onCollisionEnter;
public bool onCollisionExit;
public bool onTriggerEnter;
public bool onTriggerExit;
public bool onTriggerStay;
[Space]
[Header ("Other Settings")]
[Space]
public GameObject parent;
public GameObject objectToCollide;
[Space]
[Header ("Debug")]
[Space]
public bool active;
public bool showDebugPrint;
[Space]
[Header ("Send Message Functions Settings")]
[Space]
public string onCollisionEnterFunctionName;
public string onCollisionExitFunctionName;
public string onTriggerEnterFunctionName;
public string onTriggerExitFunctionName;
public string onTriggerStayFunctionName;
[Space]
[Header ("Regular Event Settings")]
[Space]
public bool useEvents;
public UnityEvent onCollisionEnterEvent = new UnityEvent ();
public UnityEvent onCollisionExitEvent = new UnityEvent ();
public UnityEvent onTriggerEnterEvent = new UnityEvent ();
public UnityEvent onTriggerExitEvent = new UnityEvent ();
public UnityEvent onTriggerStayEvent = new UnityEvent ();
[Space]
[Header ("Events With Objects Settings")]
[Space]
public bool useOnCollisionEnterEventWithObject;
public eventParameters.eventToCallWithGameObject onCollisionEnterEventWithObject;
public bool useOnCollisionExitEventWithObject;
public eventParameters.eventToCallWithGameObject onCollisionExitEventWithObject;
public bool useOnTriggerEnterEventWithObject;
public eventParameters.eventToCallWithGameObject onTriggerEnterEventWithObject;
public bool useOnTriggerExitEventWithObject;
public eventParameters.eventToCallWithGameObject onTriggerExitEventWithObject;
public bool useOnTriggerStayEventWithObject;
public eventParameters.eventToCallWithGameObject onTriggerStayEventWithObject;
[Space]
[Header ("Events With Collision Settings")]
[Space]
public bool sendOnCollisionEnterInfoEvent;
public eventParameters.eventToCallWithCollision onCollisionEnterInfoEvent;
//a script to check all the type of collisions of an object, and in that case, send a message to another object according to the type of collision
//if you want to use a collision enter, check the bool onCollisionEnter in the editor, set the funcion called in the onCollisionEnterFunctionName string
//and finally set the parent, the object which will receive the function
//also, you can set an specific object to check a collision with that object
//the variable active can be used to check when the collision happens
void Start ()
{
if (parent == null) {
parent = gameObject;
}
}
void OnCollisionEnter (Collision col)
{
if (!checkCollisionsEnabled) {
return;
}
checkOnCollision (col, true);
}
void OnCollisionExit (Collision col)
{
if (!checkCollisionsEnabled) {
return;
}
checkOnCollision (col, false);
}
public void checkOnCollision (Collision col, bool isEnter)
{
if (isEnter) {
if (onCollisionEnter) {
if (objectToCollide != null) {
if (col.gameObject == objectToCollide) {
if (useEvents) {
callEvent (onCollisionEnterEvent);
if (useOnCollisionEnterEventWithObject) {
callEventWithObject (onCollisionEnterEventWithObject, col.gameObject);
}
}
if (onCollisionEnterFunctionName != "") {
parent.SendMessage (onCollisionEnterFunctionName, col.gameObject, SendMessageOptions.DontRequireReceiver);
}
if (sendOnCollisionEnterInfoEvent) {
checkSendOnCollisionEnterInfoEvent (col);
}
active = true;
if (showDebugPrint) {
print ("check On Collision enter");
}
}
} else {
if (useEvents) {
callEvent (onCollisionEnterEvent);
if (useOnCollisionEnterEventWithObject) {
callEventWithObject (onCollisionEnterEventWithObject, col.gameObject);
}
}
if (onCollisionEnterFunctionName != "") {
parent.SendMessage (onCollisionEnterFunctionName, col.gameObject, SendMessageOptions.DontRequireReceiver);
}
if (sendOnCollisionEnterInfoEvent) {
checkSendOnCollisionEnterInfoEvent (col);
}
active = true;
if (showDebugPrint) {
print ("check On Collision enter");
}
}
}
} else {
if (onCollisionExit) {
active = true;
if (useEvents) {
callEvent (onCollisionExitEvent);
if (useOnCollisionExitEventWithObject) {
callEventWithObject (onCollisionExitEventWithObject, col.gameObject);
}
}
if (onCollisionExitFunctionName != "") {
parent.SendMessage (onCollisionExitFunctionName, col.gameObject, SendMessageOptions.DontRequireReceiver);
}
}
}
}
void OnTriggerEnter (Collider col)
{
if (!checkCollisionsEnabled) {
return;
}
checkTrigger (col, true);
}
void OnTriggerExit (Collider col)
{
if (!checkCollisionsEnabled) {
return;
}
checkTrigger (col, false);
}
public void checkTrigger (Collider col, bool isEnter)
{
if (isEnter) {
if (onTriggerEnter) {
if (objectToCollide != null) {
if (col.gameObject == objectToCollide) {
if (useEvents) {
callEvent (onTriggerEnterEvent);
if (useOnTriggerEnterEventWithObject) {
callEventWithObject (onTriggerEnterEventWithObject, col.gameObject);
}
}
if (onTriggerEnterFunctionName != "") {
parent.SendMessage (onTriggerEnterFunctionName, col.gameObject, SendMessageOptions.DontRequireReceiver);
}
active = true;
}
} else {
if (useEvents) {
callEvent (onTriggerEnterEvent);
if (useOnTriggerEnterEventWithObject) {
callEventWithObject (onTriggerEnterEventWithObject, col.gameObject);
}
}
if (onTriggerEnterFunctionName != "") {
parent.SendMessage (onTriggerEnterFunctionName, col.gameObject, SendMessageOptions.DontRequireReceiver);
}
active = true;
}
}
} else {
if (onTriggerExit) {
active = true;
if (useEvents) {
callEvent (onTriggerExitEvent);
if (useOnTriggerExitEventWithObject) {
callEventWithObject (onTriggerExitEventWithObject, col.gameObject);
}
}
if (onTriggerExitFunctionName != "") {
parent.SendMessage (onTriggerExitFunctionName, col.gameObject, SendMessageOptions.DontRequireReceiver);
}
}
}
}
void OnTriggerStay (Collider col)
{
if (!checkCollisionsEnabled) {
return;
}
checkTriggerOnState (col);
}
public void checkTriggerOnState (Collider col)
{
if (onTriggerStay) {
if (objectToCollide != null) {
if (col.gameObject == objectToCollide) {
if (useEvents) {
callEvent (onTriggerStayEvent);
if (useOnTriggerStayEventWithObject) {
callEventWithObject (onTriggerStayEventWithObject, col.gameObject);
}
}
if (onTriggerStayFunctionName != "") {
parent.SendMessage (onTriggerStayFunctionName, col.gameObject, SendMessageOptions.DontRequireReceiver);
}
active = true;
}
} else {
if (useEvents) {
callEvent (onTriggerStayEvent);
if (useOnTriggerStayEventWithObject) {
callEventWithObject (onTriggerStayEventWithObject, col.gameObject);
}
}
if (onTriggerStayFunctionName != "") {
parent.SendMessage (onTriggerStayFunctionName, col.gameObject, SendMessageOptions.DontRequireReceiver);
}
active = true;
}
}
}
public void checkTriggerWithGameObject (GameObject obj, bool isEnter)
{
if (isEnter) {
if (onTriggerEnter) {
if (objectToCollide != null) {
if (obj == objectToCollide) {
if (useEvents) {
callEvent (onTriggerEnterEvent);
if (useOnTriggerEnterEventWithObject) {
callEventWithObject (onTriggerEnterEventWithObject, obj);
}
}
if (onTriggerEnterFunctionName != "") {
parent.SendMessage (onTriggerEnterFunctionName, obj, SendMessageOptions.DontRequireReceiver);
}
active = true;
}
} else {
if (useEvents) {
callEvent (onTriggerEnterEvent);
if (useOnTriggerEnterEventWithObject) {
callEventWithObject (onTriggerEnterEventWithObject, obj);
}
}
if (onTriggerEnterFunctionName != "") {
parent.SendMessage (onTriggerEnterFunctionName, obj, SendMessageOptions.DontRequireReceiver);
}
active = true;
}
}
} else {
if (onTriggerExit) {
active = true;
if (useEvents) {
callEvent (onTriggerExitEvent);
if (useOnTriggerExitEventWithObject) {
callEventWithObject (onTriggerExitEventWithObject, obj);
}
}
if (onTriggerExitFunctionName != "") {
parent.SendMessage (onTriggerExitFunctionName, obj, SendMessageOptions.DontRequireReceiver);
}
}
}
}
public void callEvent (UnityEvent eventToCall)
{
eventToCall.Invoke ();
}
public void callEventWithObject (eventParameters.eventToCallWithGameObject eventToCall, GameObject objectToSend)
{
eventToCall.Invoke (objectToSend);
}
public void setCheckCollisionsEnabledState (bool state)
{
checkCollisionsEnabled = state;
}
public void checkSendOnCollisionEnterInfoEvent (Collision collision)
{
if (sendOnCollisionEnterInfoEvent) {
onCollisionEnterInfoEvent.Invoke (collision);
}
}
}

View File

@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: bfeddfd571ebd674fbb1463d11a09afd
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/checkCollisionType.cs
uploadId: 814740

View File

@@ -0,0 +1,194 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class checkIfCharacterUsingWeaponsToChangeMode : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool checkStateEnabled = true;
public bool checkStateAtStartEnabled;
public float minTimeToCallEventsOnNoCarryingWeapons;
public bool checkStateIfNotAimingFireWeapons;
public bool checkStateIfNotUsingMeleeAttack;
[Space]
[Header ("Debug")]
[Space]
public bool showDebugPrint;
public bool carryingWeapons;
public bool notCarryingWeaponsEventCalled;
public bool coroutineActive;
[Space]
[Header ("Events Settings")]
[Space]
public UnityEvent eventOnNotCarryingWeapons;
[Space]
[Header ("Components")]
[Space]
public playerController mainPlayerController;
Coroutine mainUpdateCoroutine;
float lastTimeNotCarryingWeapons;
bool firstTimeCheck;
bool carryingWeaponsResult;
float lastTimePlayerBusy = 0;
void Start ()
{
if (checkStateAtStartEnabled) {
activateCheck ();
}
}
public void activateCheck ()
{
if (!checkStateEnabled) {
return;
}
stopUpdateCheckCoroutine ();
mainUpdateCoroutine = StartCoroutine (updateCheckCoroutine ());
coroutineActive = true;
if (showDebugPrint) {
print ("activate check weapons state coroutine");
}
}
public void stopCheck ()
{
if (!checkStateEnabled) {
return;
}
stopUpdateCheckCoroutine ();
if (showDebugPrint) {
print ("deactivate check weapons state coroutine");
}
}
public void stopUpdateCheckCoroutine ()
{
if (coroutineActive) {
if (mainUpdateCoroutine != null) {
StopCoroutine (mainUpdateCoroutine);
}
carryingWeapons = false;
carryingWeaponsResult = false;
notCarryingWeaponsEventCalled = false;
coroutineActive = false;
lastTimePlayerBusy = 0;
}
}
IEnumerator updateCheckCoroutine ()
{
var waitTime = new WaitForFixedUpdate ();
while (true) {
yield return waitTime;
updateCheck ();
}
}
void updateCheck ()
{
if (mainPlayerController.isPlayerDriving () ||
mainPlayerController.playerIsBusy () ||
mainPlayerController.isGamePaused () ||
!mainPlayerController.canUseInput ()) {
lastTimePlayerBusy = Time.time;
return;
} else {
if (lastTimePlayerBusy > 0) {
if (Time.time > lastTimePlayerBusy + 0.5f) {
lastTimePlayerBusy = 0;
} else {
return;
}
}
}
carryingWeapons = false;
if (mainPlayerController.isPlayerUsingWeapons ()) {
if (checkStateIfNotAimingFireWeapons) {
if (mainPlayerController.isPlayerAiming ()) {
carryingWeapons = true;
}
} else {
carryingWeapons = true;
}
}
if (checkStateIfNotUsingMeleeAttack) {
if (mainPlayerController.isPlayerMeleeWeaponThrown ()) {
carryingWeapons = true;
}
} else {
if (mainPlayerController.isPlayerUsingMeleeWeapons () || mainPlayerController.isPlayerMeleeWeaponThrown ()) {
carryingWeapons = true;
}
}
if (mainPlayerController.isActionActive ()) {
carryingWeapons = true;
}
if (carryingWeaponsResult != carryingWeapons || !firstTimeCheck) {
carryingWeaponsResult = carryingWeapons;
if (carryingWeaponsResult) {
notCarryingWeaponsEventCalled = false;
} else {
lastTimeNotCarryingWeapons = Time.time;
}
firstTimeCheck = true;
}
if (!carryingWeaponsResult) {
if (!notCarryingWeaponsEventCalled) {
if (Time.time > lastTimeNotCarryingWeapons + minTimeToCallEventsOnNoCarryingWeapons) {
eventOnNotCarryingWeapons.Invoke ();
notCarryingWeaponsEventCalled = true;
if (showDebugPrint) {
print ("not carrying weapon enough time, calling event");
}
}
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 4c791420a78d83d4aafae1acc6d6cd41
timeCreated: 1654477702
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/checkIfCharacterUsingWeaponsToChangeMode.cs
uploadId: 814740

View File

@@ -0,0 +1,60 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class coinPocketSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public int currentCointAmount;
public bool pickCoinsEnabled = true;
[Space]
[Header ("Event Settings")]
[Space]
public UnityEvent eventOnDropAllCoins;
public eventParameters.eventToCallWithInteger eventToSetAmountOfCoins;
public bool useEventsOnPickedCoin;
public UnityEvent eventOnPickedCoin;
public int getCoinAmount ()
{
return currentCointAmount;
}
public void addCoinAmount (int newAmount)
{
currentCointAmount += newAmount;
if (useEventsOnPickedCoin) {
eventOnPickedCoin.Invoke ();
}
}
public void dropAllCoins ()
{
if (currentCointAmount > 0) {
eventToSetAmountOfCoins.Invoke (currentCointAmount);
eventOnDropAllCoins.Invoke ();
currentCointAmount = 0;
}
}
public bool canPickCoins ()
{
return pickCoinsEnabled;
}
public void setPickCoinsEnabledState (bool state)
{
pickCoinsEnabled = state;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 788b0ce17979bc9458bc4e70f99795e2
timeCreated: 1631005735
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/coinPocketSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,522 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
[RequireComponent (typeof (MeshFilter))]
[RequireComponent (typeof (MeshRenderer))]
public class combineMeshSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool useMeshFilterList;
public List<MeshFilter> listMeshFilter;
[Space]
public bool useCustomParentListToGetMeshFilterList;
public List<Transform> customParentListToGetMeshFilterList;
[Space]
[SerializeField]
[Tooltip ("MeshFilters with Meshes which we don't want to combine into one Mesh.")]
private MeshFilter [] meshFiltersToSkip = new MeshFilter [0];
[Space]
[Header ("Other Settings")]
[Space]
public bool createMultiMaterialMesh = false;
public bool combineInactiveChildren = false;
public bool deactivateCombinedChildren = true;
public bool deactivateCombinedChildrenMeshRenderers = false;
public bool generateUVMap = false;
public bool destroyCombinedChildren = false;
[Space]
[Header ("Debug")]
[Space]
public bool showDebugPrint;
[Space]
[Header ("Events Settings")]
[Space]
public bool sendCombinedObjectOnEvent;
public eventParameters.eventToCallWithGameObject eventToSendCombinedObject;
private const int Mesh16BitBufferVertexLimit = 65535;
public bool CreateMultiMaterialMesh
{
get { return createMultiMaterialMesh; }
set { createMultiMaterialMesh = value; }
}
public bool CombineInactiveChildren
{
get { return combineInactiveChildren; }
set { combineInactiveChildren = value; }
}
public bool DeactivateCombinedChildren
{
get { return deactivateCombinedChildren; }
set
{
deactivateCombinedChildren = value;
CheckDeactivateCombinedChildren ();
}
}
public bool DeactivateCombinedChildrenMeshRenderers
{
get { return deactivateCombinedChildrenMeshRenderers; }
set
{
deactivateCombinedChildrenMeshRenderers = value;
CheckDeactivateCombinedChildren ();
}
}
public bool GenerateUVMap
{
get { return generateUVMap; }
set { generateUVMap = value; }
}
public bool DestroyCombinedChildren
{
get { return destroyCombinedChildren; }
set
{
destroyCombinedChildren = value;
CheckDestroyCombinedChildren ();
}
}
private void CheckDeactivateCombinedChildren ()
{
if (deactivateCombinedChildren || deactivateCombinedChildrenMeshRenderers) {
destroyCombinedChildren = false;
}
}
private void CheckDestroyCombinedChildren ()
{
if (destroyCombinedChildren) {
deactivateCombinedChildren = false;
deactivateCombinedChildrenMeshRenderers = false;
}
}
public void CombineMeshes (bool showCreatedMeshInfo)
{
#region Save our parent scale and our Transform and reset it temporarily:
// When we are unparenting and get parent again then sometimes scale is a little bit different so save scale before unparenting:
Vector3 oldScaleAsChild = transform.localScale;
// If we have parent then his scale will affect to our new combined Mesh scale so unparent us:
int positionInParentHierarchy = transform.GetSiblingIndex ();
Transform parent = transform.parent;
transform.parent = null;
// Thanks to this the new combined Mesh will have same position and scale in the world space like its children:
Quaternion oldRotation = transform.rotation;
Vector3 oldPosition = transform.position;
Vector3 oldScale = transform.localScale;
transform.rotation = Quaternion.identity;
transform.position = Vector3.zero;
transform.localScale = Vector3.one;
#endregion Save Transform and reset it temporarily.
#region Combine Meshes into one Mesh:
if (!createMultiMaterialMesh) {
CombineMeshesWithSingleMaterial (showCreatedMeshInfo);
} else {
CombineMeshesWithMutliMaterial (showCreatedMeshInfo);
}
#endregion Combine Meshes into one Mesh.
#region Set old Transform values:
// Bring back the Transform values:
transform.rotation = oldRotation;
transform.position = oldPosition;
transform.localScale = oldScale;
// Get back parent and same hierarchy position:
transform.parent = parent;
transform.SetSiblingIndex (positionInParentHierarchy);
// Set back the scale value as child:
transform.localScale = oldScaleAsChild;
if (sendCombinedObjectOnEvent) {
eventToSendCombinedObject.Invoke (gameObject);
}
if (showDebugPrint) {
print ("objects meshes combined");
}
#endregion Set old Transform values.
}
void checkNullElementsOnListMeshFilter ()
{
for (int i = listMeshFilter.Count - 1; i >= 0; i--) {
if (listMeshFilter [i] == null) {
listMeshFilter.RemoveAt (i);
}
}
}
private MeshFilter [] GetMeshFiltersToCombine ()
{
// Get all MeshFilters belongs to this GameObject and its children:
MeshFilter [] meshFilters = new MeshFilter [0];
if (useMeshFilterList) {
checkNullElementsOnListMeshFilter ();
int listMeshFilterCount = listMeshFilter.Count + 1;
meshFilters = new MeshFilter [listMeshFilterCount];
MeshFilter mainMeshFilter = gameObject.GetComponent<MeshFilter> ();
meshFilters [0] = mainMeshFilter;
for (int i = 0; i < listMeshFilter.Count; i++) {
meshFilters [i + 1] = listMeshFilter [i];
}
} else {
meshFilters = GetComponentsInChildren<MeshFilter> (combineInactiveChildren);
}
// Delete first MeshFilter belongs to this GameObject in meshFiltersToSkip array:
meshFiltersToSkip = meshFiltersToSkip.Where ((meshFilter) => meshFilter != meshFilters [0]).ToArray ();
// Delete null values in meshFiltersToSkip array:
meshFiltersToSkip = meshFiltersToSkip.Where ((meshFilter) => meshFilter != null).ToArray ();
for (int i = 0; i < meshFiltersToSkip.Length; i++) {
meshFilters = meshFilters.Where ((meshFilter) => meshFilter != meshFiltersToSkip [i]).ToArray ();
}
return meshFilters;
}
private void CombineMeshesWithSingleMaterial (bool showCreatedMeshInfo)
{
// Get all MeshFilters belongs to this GameObject and its children:
MeshFilter [] meshFilters = GetMeshFiltersToCombine ();
// First MeshFilter belongs to this GameObject so we don't need it:
CombineInstance [] combineInstances = new CombineInstance [meshFilters.Length - 1];
// If it will be over 65535 then use the 32 bit index buffer:
long verticesLength = 0;
for (int i = 0; i < meshFilters.Length - 1; i++) // Skip first MeshFilter belongs to this GameObject in this loop.
{
combineInstances [i].subMeshIndex = 0;
combineInstances [i].mesh = meshFilters [i + 1].sharedMesh;
combineInstances [i].transform = meshFilters [i + 1].transform.localToWorldMatrix;
verticesLength += combineInstances [i].mesh.vertices.Length;
}
// Set Material from child:
MeshRenderer [] meshRenderers = new MeshRenderer [0];
if (useMeshFilterList) {
checkNullElementsOnListMeshFilter ();
meshRenderers = new MeshRenderer [listMeshFilter.Count];
int meshRenderersLength = meshRenderers.Length;
for (int i = 0; i < meshRenderersLength; i++) {
meshRenderers [i] = listMeshFilter [i].GetComponent<MeshRenderer> ();
}
MeshRenderer mainMeshRenderer = gameObject.GetComponent<MeshRenderer> ();
meshRenderers = meshRenderers.Append (mainMeshRenderer).ToArray ();
} else {
meshRenderers = GetComponentsInChildren<MeshRenderer> (combineInactiveChildren);
}
if (meshRenderers.Length >= 2) {
meshRenderers [0].sharedMaterials = new Material [1];
meshRenderers [0].sharedMaterial = meshRenderers [1].sharedMaterial;
} else {
meshRenderers [0].sharedMaterials = new Material [0]; // Reset the MeshRenderer's Materials array.
}
// Create Mesh from combineInstances:
Mesh combinedMesh = new Mesh ();
combinedMesh.name = name;
#if UNITY_2017_3_OR_NEWER
if (verticesLength > Mesh16BitBufferVertexLimit) {
combinedMesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32; // Only works on Unity 2017.3 or higher.
}
combinedMesh.CombineMeshes (combineInstances);
GenerateUV (combinedMesh);
meshFilters [0].sharedMesh = combinedMesh;
DeactivateCombinedGameObjects (meshFilters);
if (showCreatedMeshInfo) {
if (verticesLength <= Mesh16BitBufferVertexLimit) {
Debug.Log ("<color=#00cc00><b>Mesh \"" + name + "\" was created from " + combineInstances.Length + " children meshes and has " + verticesLength
+ " vertices.</b></color>");
} else {
Debug.Log ("<color=#ff3300><b>Mesh \"" + name + "\" was created from " + combineInstances.Length + " children meshes and has " + verticesLength
+ " vertices. Some old devices, like Android with Mali-400 GPU, do not support over 65535 vertices.</b></color>");
}
}
#else
if(verticesLength <= Mesh16BitBufferVertexLimit)
{
combinedMesh.CombineMeshes(combineInstances);
GenerateUV(combinedMesh);
meshFilters[0].sharedMesh = combinedMesh;
DeactivateCombinedGameObjects(meshFilters);
if(showCreatedMeshInfo)
{
Debug.Log("<color=#00cc00><b>Mesh \""+name+"\" was created from "+combineInstances.Length+" children meshes and has "+verticesLength
+" vertices.</b></color>");
}
}
else if(showCreatedMeshInfo)
{
Debug.Log("<color=red><b>The mesh vertex limit is 65535! The created mesh had "+verticesLength+" vertices. Upgrade Unity version to"
+" 2017.3 or higher to avoid this limit (some old devices, like Android with Mali-400 GPU, do not support over 65535 vertices).</b></color>");
}
#endif
}
private void CombineMeshesWithMutliMaterial (bool showCreatedMeshInfo)
{
#region Get MeshFilters, MeshRenderers and unique Materials from all children:
MeshFilter [] meshFilters = GetMeshFiltersToCombine ();
MeshRenderer [] meshRenderers = new MeshRenderer [meshFilters.Length];
meshRenderers [0] = GetComponent<MeshRenderer> (); // Our (parent) MeshRenderer.
List<Material> uniqueMaterialsList = new List<Material> ();
for (int i = 0; i < meshFilters.Length - 1; i++) {
meshRenderers [i + 1] = meshFilters [i + 1].GetComponent<MeshRenderer> ();
if (meshRenderers [i + 1] != null) {
Material [] materials = meshRenderers [i + 1].sharedMaterials; // Get all Materials from child Mesh.
for (int j = 0; j < materials.Length; j++) {
if (!uniqueMaterialsList.Contains (materials [j])) // If Material doesn't exists in the list then add it.
{
uniqueMaterialsList.Add (materials [j]);
}
}
}
}
#endregion Get MeshFilters, MeshRenderers and unique Materials from all children.
#region Combine children Meshes with the same Material to create submeshes for final Mesh:
List<CombineInstance> finalMeshCombineInstancesList = new List<CombineInstance> ();
// If it will be over 65535 then use the 32 bit index buffer:
long verticesLength = 0;
for (int i = 0; i < uniqueMaterialsList.Count; i++) // Create each Mesh (submesh) from Meshes with the same Material.
{
List<CombineInstance> submeshCombineInstancesList = new List<CombineInstance> ();
for (int j = 0; j < meshFilters.Length - 1; j++) // Get only childeren Meshes (skip our Mesh).
{
if (meshRenderers [j + 1] != null && meshFilters [j + 1].sharedMesh != null) {
Material [] submeshMaterials = meshRenderers [j + 1].sharedMaterials; // Get all Materials from child Mesh.
for (int k = 0; k < submeshMaterials.Length; k++) {
// If Materials are equal, combine Mesh from this child:
if (uniqueMaterialsList [i] == submeshMaterials [k]) {
CombineInstance combineInstance = new CombineInstance ();
combineInstance.subMeshIndex = k; // Mesh may consist of smaller parts - submeshes.
// Every part have different index. If there are 3 submeshes
// in Mesh then MeshRender needs 3 Materials to render them.
combineInstance.mesh = meshFilters [j + 1].sharedMesh;
combineInstance.transform = meshFilters [j + 1].transform.localToWorldMatrix;
submeshCombineInstancesList.Add (combineInstance);
verticesLength += combineInstance.mesh.vertices.Length;
}
}
}
}
// Create new Mesh (submesh) from Meshes with the same Material:
Mesh submesh = new Mesh ();
#if UNITY_2017_3_OR_NEWER
if (verticesLength > Mesh16BitBufferVertexLimit) {
submesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32; // Only works on Unity 2017.3 or higher.
}
submesh.CombineMeshes (submeshCombineInstancesList.ToArray (), true);
#else
// Below Unity 2017.3 if vertices count is above the limit then an error appears in the console when we use the below method.
// Anyway we don't stop the algorithm here beacuse we want to count the entire number of vertices in the children meshes:
if(verticesLength <= Mesh16BitBufferVertexLimit)
{
submesh.CombineMeshes(submeshCombineInstancesList.ToArray(), true);
}
#endif
CombineInstance finalCombineInstance = new CombineInstance ();
finalCombineInstance.subMeshIndex = 0;
finalCombineInstance.mesh = submesh;
finalCombineInstance.transform = Matrix4x4.identity;
finalMeshCombineInstancesList.Add (finalCombineInstance);
}
#endregion Combine submeshes (children Meshes) with the same Material.
#region Set Materials array & combine submeshes into one multimaterial Mesh:
meshRenderers [0].sharedMaterials = uniqueMaterialsList.ToArray ();
Mesh combinedMesh = new Mesh ();
combinedMesh.name = name;
#if UNITY_2017_3_OR_NEWER
if (verticesLength > Mesh16BitBufferVertexLimit) {
combinedMesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32; // Only works on Unity 2017.3 or higher.
}
combinedMesh.CombineMeshes (finalMeshCombineInstancesList.ToArray (), false);
GenerateUV (combinedMesh);
meshFilters [0].sharedMesh = combinedMesh;
DeactivateCombinedGameObjects (meshFilters);
if (showCreatedMeshInfo) {
if (verticesLength <= Mesh16BitBufferVertexLimit) {
Debug.Log ("<color=#00cc00><b>Mesh \"" + name + "\" was created from " + (meshFilters.Length - 1) + " children meshes and has "
+ finalMeshCombineInstancesList.Count + " submeshes, and " + verticesLength + " vertices.</b></color>");
} else {
Debug.Log ("<color=#ff3300><b>Mesh \"" + name + "\" was created from " + (meshFilters.Length - 1) + " children meshes and has "
+ finalMeshCombineInstancesList.Count + " submeshes, and " + verticesLength
+ " vertices. Some old devices, like Android with Mali-400 GPU, do not support over 65535 vertices.</b></color>");
}
}
#else
if(verticesLength <= Mesh16BitBufferVertexLimit)
{
combinedMesh.CombineMeshes(finalMeshCombineInstancesList.ToArray(), false);
GenerateUV(combinedMesh);
meshFilters[0].sharedMesh = combinedMesh;
DeactivateCombinedGameObjects(meshFilters);
if(showCreatedMeshInfo)
{
Debug.Log("<color=#00cc00><b>Mesh \""+name+"\" was created from "+(meshFilters.Length-1)+" children meshes and has "
+finalMeshCombineInstancesList.Count+" submeshes, and "+verticesLength+" vertices.</b></color>");
}
}
else if(showCreatedMeshInfo)
{
Debug.Log("<color=red><b>The mesh vertex limit is 65535! The created mesh had "+verticesLength+" vertices. Upgrade Unity version to"
+" 2017.3 or higher to avoid this limit (some old devices, like Android with Mali-400 GPU, do not support over 65535 vertices).</b></color>");
}
#endif
#endregion Set Materials array & combine submeshes into one multimaterial Mesh.
}
private void DeactivateCombinedGameObjects (MeshFilter [] meshFilters)
{
for (int i = 0; i < meshFilters.Length - 1; i++) // Skip first MeshFilter belongs to this GameObject in this loop.
{
if (!destroyCombinedChildren) {
if (deactivateCombinedChildren) {
meshFilters [i + 1].gameObject.SetActive (false);
}
if (deactivateCombinedChildrenMeshRenderers) {
MeshRenderer meshRenderer = meshFilters [i + 1].gameObject.GetComponent<MeshRenderer> ();
if (meshRenderer != null) {
meshRenderer.enabled = false;
}
}
} else {
DestroyImmediate (meshFilters [i + 1].gameObject);
}
}
}
private void GenerateUV (Mesh combinedMesh)
{
#if UNITY_EDITOR
if (generateUVMap) {
UnityEditor.UnwrapParam unwrapParam = new UnityEditor.UnwrapParam ();
UnityEditor.UnwrapParam.SetDefaults (out unwrapParam);
UnityEditor.Unwrapping.GenerateSecondaryUVSet (combinedMesh, unwrapParam);
}
#endif
}
public void getObjectMeshes ()
{
listMeshFilter.Clear ();
if (useCustomParentListToGetMeshFilterList) {
for (int i = 0; i < customParentListToGetMeshFilterList.Count; i++) {
if (customParentListToGetMeshFilterList [i] != null) {
MeshFilter [] meshFilters = customParentListToGetMeshFilterList [i].GetComponentsInChildren<MeshFilter> (combineInactiveChildren);
for (int j = 0; j < meshFilters.Length; j++) {
if (meshFilters [j] != null) {
listMeshFilter.Add (meshFilters [j]);
}
}
}
}
} else {
MeshFilter [] meshFilters = GetComponentsInChildren<MeshFilter> (combineInactiveChildren);
for (int i = 0; i < meshFilters.Length; i++) {
if (meshFilters [i] != null) {
listMeshFilter.Add (meshFilters [i]);
}
}
}
MeshFilter mainMeshFilter = gameObject.GetComponent<MeshFilter> ();
for (int i = listMeshFilter.Count - 1; i >= 0; i--) {
if (listMeshFilter [i].GetComponent<ParticleSystem> () != null) {
listMeshFilter.RemoveAt (i);
}
if (mainMeshFilter != null && mainMeshFilter == listMeshFilter [i]) {
listMeshFilter.RemoveAt (i);
}
}
updateComponent ();
}
public void clearMeshList ()
{
listMeshFilter.Clear ();
updateComponent ();
}
void updateComponent ()
{
GKC_Utils.updateComponent (this);
GKC_Utils.updateDirtyScene ("Update Combine Mesh System", gameObject);
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 998a9e9f4201de1418c561d9b6ae0eb4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/combineMeshSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,40 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class consoleLogOnScreenSystem : MonoBehaviour
{
public Text consoleLogText;
public int maxTextLength = 3000;
public int textLenghtToRemoveOnMaxAmount = 2500;
static string myLog = "";
private string output;
void OnEnable ()
{
Application.logMessageReceived += Log;
}
void OnDisable ()
{
Application.logMessageReceived -= Log;
}
public void Log (string logString, string stackTrace, LogType type)
{
output = logString;
myLog = output + "\n" + myLog;
if (myLog.Length > maxTextLength) {
myLog = myLog.Substring (0, textLenghtToRemoveOnMaxAmount);
}
}
void OnGUI ()
{
consoleLogText.text = myLog;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: afef4d41eedc1c943b2c9691e734d961
timeCreated: 1605069085
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/consoleLogOnScreenSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,312 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class destroyGameObject : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool destroyObjectEnabled = true;
public bool destroyObjectOnEnable;
public float timer = 0.6f;
public bool destroyObjectAtStart = true;
public bool disableInsteadOfDestroyActive;
public bool destroyJustAllChildObjects;
[Space]
[Header ("Pooling Settings")]
[Space]
public bool sendObjectToPoolSystemToDisable;
public bool sendObjectByGKC_PoolingElementToDisable;
public GKC_PoolingElement mainGKC_PoolingElement;
[Space]
[Header ("Objects To Destroy Settings")]
[Space]
public GameObject objectToDestroy;
[Space]
[Space]
public bool useGameObjectList;
public List<GameObject> gameObjectList = new List<GameObject> ();
[Space]
[Header ("Debug")]
[Space]
public bool showDebugPrint;
public bool destroyCoroutineActive;
public bool ignoreDestroyObjectEnabled;
public bool destroyObjectFunctionCalled;
Coroutine destroyObjectCoroutine;
void Start ()
{
checkToDestroyObjectInTime (true);
}
public void destroyObjectInTime ()
{
stopDestroyObjectCoroutine ();
// print (gameObject.name + " " + timer);
destroyObjectCoroutine = StartCoroutine (destroyObjectInTimeCoroutine ());
}
public void stopDestroyObjectCoroutine ()
{
destroyCoroutineActive = false;
if (destroyObjectCoroutine != null) {
StopCoroutine (destroyObjectCoroutine);
}
}
IEnumerator destroyObjectInTimeCoroutine ()
{
destroyCoroutineActive = true;
// print (gameObject.name + " " + timer);
WaitForSeconds delay = new WaitForSeconds (timer);
yield return delay;
destroyCoroutineActive = false;
destroy ();
}
public void setTimer (float timeToDestroy)
{
timer = timeToDestroy;
}
void OnDisable ()
{
if (timer > 0) {
if (destroyObjectFunctionCalled) {
bool destroyOnDisableResult = false;
if (disableInsteadOfDestroyActive) {
if (destroyCoroutineActive && !gameObject.activeInHierarchy && gameObject.activeSelf) {
destroyOnDisableResult = true;
}
} else {
destroyOnDisableResult = true;
}
if (destroyOnDisableResult) {
if (showDebugPrint) {
print ("disabling objects " + Application.isPlaying + " time " + Time.timeScale + " " + Time.deltaTime);
}
if (Time.timeScale > 0 || Time.deltaTime > 0) {
if (showDebugPrint) {
print ("DESTROYING OBJECT");
}
destroy ();
} else {
if (showDebugPrint) {
print ("TRYING TO DESTROY OBJECT OUT OF PLAY TIME");
}
}
}
destroyObjectFunctionCalled = false;
} else {
if (destroyCoroutineActive) {
if (!gameObject.activeInHierarchy) {
if (showDebugPrint) {
print ("disabling objects " + Application.isPlaying + " time " + Time.timeScale + " " + Time.deltaTime);
}
if (Time.timeScale > 0 || Time.deltaTime > 0) {
if (showDebugPrint) {
print ("DESTROYING OBJECT WHICH WAS SET TO BE DESTROYED BUT IT WAS STOPPED");
}
destroy ();
} else {
if (showDebugPrint) {
print ("TRYING TO DESTROY OBJECT OUT OF PLAY TIME");
}
}
}
destroyCoroutineActive = false;
}
}
}
// print (gameObject.name + " " + timer + " " + destroyCoroutineActive);
}
void OnEnable ()
{
if (destroyObjectOnEnable) {
checkToDestroyObjectInTime (false);
}
}
public void destroy ()
{
if (!destroyObjectEnabled) {
return;
}
if (ignoreDestroyObjectEnabled) {
return;
}
if (objectToDestroy == null) {
objectToDestroy = gameObject;
}
destroyObjectFunctionCalled = true;
if (disableInsteadOfDestroyActive) {
if (sendObjectToPoolSystemToDisable) {
if (sendObjectByGKC_PoolingElementToDisable) {
mainGKC_PoolingElement.despawnPoolObject ();
} else {
GKC_PoolingSystem.Despawn (objectToDestroy);
}
} else {
objectToDestroy.SetActive (false);
}
if (useGameObjectList) {
for (int i = 0; i < gameObjectList.Count; i++) {
if (gameObjectList [i] != null) {
if (sendObjectToPoolSystemToDisable) {
GKC_PoolingSystem.Despawn (gameObjectList [i]);
} else {
if (gameObjectList [i].activeSelf) {
gameObjectList [i].SetActive (false);
}
}
}
}
}
} else {
if (GKC_Utils.isApplicationPlaying () && Time.deltaTime > 0) {
if (destroyJustAllChildObjects) {
Component[] components = objectToDestroy.GetComponentsInChildren (typeof(Transform));
int componentsLength = components.Length;
for (int i = 0; i < componentsLength; i++) {
Transform child = components [i] as Transform;
if (child != objectToDestroy.transform) {
Destroy (child.gameObject);
}
}
} else {
Destroy (objectToDestroy);
if (useGameObjectList) {
for (int i = 0; i < gameObjectList.Count; i++) {
if (gameObjectList [i] != null) {
Destroy (gameObjectList [i]);
}
}
}
}
}
}
}
public void setDestroyObjectEnabledState (bool state)
{
destroyObjectEnabled = state;
}
public void setIgnoreDestroyObjectEnabledState (bool state)
{
ignoreDestroyObjectEnabled = state;
}
public void changeDestroyForSetActiveFunction (bool state)
{
disableInsteadOfDestroyActive = state;
}
public void setSendObjectToPoolSystemToDisableState (bool state)
{
sendObjectToPoolSystemToDisable = state;
if (sendObjectToPoolSystemToDisable) {
disableInsteadOfDestroyActive = true;
}
}
public void checkToDestroyObjectInTime (bool callingFromStart)
{
if (!destroyCoroutineActive) {
if ((destroyObjectAtStart && callingFromStart) || !callingFromStart) {
destroyObjectInTime ();
}
}
}
public void cancelDestroy ()
{
stopDestroyObjectCoroutine ();
}
public void addObjectToGameObjectList (GameObject newObject)
{
if (!gameObjectList.Contains (newObject)) {
gameObjectList.Add (newObject);
}
for (int i = gameObjectList.Count - 1; i >= 0; i--) {
if (gameObjectList [i] == null) {
gameObjectList.RemoveAt (i);
}
}
}
//EDITOR FUNCTIONS
public void setDestroyObjectEnabledStateFromEditor (bool state)
{
setDestroyObjectEnabledState (state);
updateComponent ();
}
public void addObjectToGameObjectListFromEditor (GameObject newObject)
{
addObjectToGameObjectList (newObject);
updateComponent ();
}
void updateComponent ()
{
GKC_Utils.updateComponent (this);
GKC_Utils.updateDirtyScene ("Update Destroy GameObject " + gameObject.name, gameObject);
}
}

View File

@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: f3511e76832397b45a6d62d35437f680
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/destroyGameObject.cs
uploadId: 814740

View File

@@ -0,0 +1,311 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class dissolveObject : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool dissolveObjectEnabled = true;
public float timeToDestroyObject = 0.9f;
public float dissolveDelay;
public float dissolveSpeed = 0.2f;
public float currentFadeValue = 0;
[Space]
[Header ("Shader Settings")]
[Space]
public Shader shaderToApply;
public Texture dissolveTexture;
public Color dissolveColor;
public float dissolveColorAlpha;
public string dissolveShaderFieldName = "_Amount";
public string dissolveShaderTextureFieldName = "_DissolveTexture";
public string dissolveShaderColorFieldName = "_DissolveColor";
public string dissolveShaderAlphaColorFieldName = "_DissolveColorAlpha";
[Space]
[Header ("Object To Dissolve Settings")]
[Space]
public GameObject objectToDissolve;
public bool useGameObjectList;
public List<GameObject> gameObjectList = new List<GameObject> ();
[Space]
[Header ("Debug")]
[Space]
public bool objectToDissolveFound;
public bool ignoreDissolveObjectEnabled;
public typeObjectFound currentTypeObjectFound;
public List<Renderer> rendererParts = new List<Renderer> ();
public List<Shader> originalShader = new List<Shader> ();
public List<Material> materialList = new List<Material> ();
public enum typeObjectFound
{
vehicle,
regularObject,
npc
}
float lastTimeDissolveActivated;
Renderer currentRenderer;
Coroutine dissolveCoroutine;
public void stopDissolveCoroutine ()
{
if (dissolveCoroutine != null) {
StopCoroutine (dissolveCoroutine);
}
}
IEnumerator activateDissolveCoroutine ()
{
var waitTime = new WaitForFixedUpdate ();
while (true) {
yield return waitTime;
if (objectToDissolveFound) {
if (Time.time > dissolveDelay + lastTimeDissolveActivated) {
currentFadeValue += Time.deltaTime * dissolveSpeed;
if (currentFadeValue <= 1) {
int rendererPartsCount = rendererParts.Count;
for (int i = 0; i < rendererPartsCount; i++) {
currentRenderer = rendererParts [i];
if (currentRenderer != null) {
int materialsLength = currentRenderer.materials.Length;
for (int j = 0; j < materialsLength; j++) {
currentRenderer.materials [j].SetFloat (dissolveShaderFieldName, currentFadeValue);
}
}
}
}
if (Time.time > lastTimeDissolveActivated + timeToDestroyObject) {
destroyObject ();
stopDissolveCoroutine ();
}
}
}
}
}
public void activateDissolve (GameObject newOjectToDissolve)
{
if (!dissolveObjectEnabled) {
return;
}
if (ignoreDissolveObjectEnabled) {
return;
}
objectToDissolve = newOjectToDissolve;
if (objectToDissolve.GetComponent<Rigidbody> ()) {
objectToDissolveFound = true;
currentTypeObjectFound = typeObjectFound.regularObject;
}
bool isCharacter = applyDamage.isCharacter (objectToDissolve);
if (isCharacter) {
objectToDissolve = applyDamage.getCharacter (objectToDissolve);
objectToDissolveFound = true;
currentTypeObjectFound = typeObjectFound.npc;
} else {
bool isVehicle = applyDamage.isVehicle (objectToDissolve);
if (isVehicle) {
objectToDissolve = applyDamage.getVehicle (objectToDissolve);
objectToDissolveFound = true;
currentTypeObjectFound = typeObjectFound.vehicle;
}
}
if (objectToDissolveFound && objectToDissolve != null) {
outlineObjectSystem currentOutlineObjectSystem = objectToDissolve.GetComponent<outlineObjectSystem> ();
if (currentOutlineObjectSystem != null) {
currentOutlineObjectSystem.disableOutlineAndRemoveUsers ();
}
storeRenderElements ();
}
lastTimeDissolveActivated = Time.time;
stopDissolveCoroutine ();
dissolveCoroutine = StartCoroutine (activateDissolveCoroutine ());
}
public void destroyObject ()
{
if (objectToDissolve == null) {
return;
}
if (useGameObjectList) {
for (int i = 0; i < gameObjectList.Count; i++) {
if (gameObjectList [i] != null) {
Destroy (gameObjectList [i]);
}
}
}
if (currentTypeObjectFound == typeObjectFound.vehicle) {
vehicleHUDManager currenVehicleHUDManager = objectToDissolve.GetComponent<vehicleHUDManager> ();
if (currenVehicleHUDManager != null) {
currenVehicleHUDManager.destroyVehicleAtOnce ();
}
}
if (currentTypeObjectFound == typeObjectFound.npc) {
playerController currentPlayerController = objectToDissolve.GetComponent<playerController> ();
if (currentPlayerController != null) {
currentPlayerController.destroyCharacterAtOnce ();
} else {
Destroy (objectToDissolve);
}
}
if (currentTypeObjectFound == typeObjectFound.regularObject) {
Destroy (objectToDissolve);
}
}
public void storeRenderElements ()
{
rendererParts.Clear ();
originalShader.Clear ();
materialList.Clear ();
if (useGameObjectList) {
for (int i = 0; i < gameObjectList.Count; i++) {
if (gameObjectList [i] != null) {
Component [] components = gameObjectList [i].GetComponentsInChildren (typeof (Renderer));
int componentsLength = components.Length;
for (int j = 0; j < componentsLength; j++) {
Renderer child = components [j] as Renderer;
if (child.material.shader != null && !child.GetComponent<ParticleSystem> ()) {
rendererParts.Add (child);
}
}
}
}
} else {
Component [] components = objectToDissolve.GetComponentsInChildren (typeof (Renderer));
int componentsLength = components.Length;
for (int j = 0; j < componentsLength; j++) {
Renderer child = components [j] as Renderer;
if (child.material.shader != null && !child.GetComponent<ParticleSystem> ()) {
rendererParts.Add (child);
}
}
}
int rendererPartsCount = rendererParts.Count;
for (int i = 0; i < rendererPartsCount; i++) {
currentRenderer = rendererParts [i];
if (currentRenderer != null) {
int materialsLength = currentRenderer.materials.Length;
for (int j = 0; j < materialsLength; j++) {
Material currentMaterial = currentRenderer.materials [j];
originalShader.Add (currentMaterial.shader);
materialList.Add (currentMaterial);
currentMaterial.shader = shaderToApply;
currentMaterial.SetTexture (dissolveShaderTextureFieldName, dissolveTexture);
currentMaterial.SetColor (dissolveShaderColorFieldName, dissolveColor);
currentMaterial.SetFloat (dissolveShaderAlphaColorFieldName, dissolveColorAlpha);
}
}
}
}
public void setDissolveObjectEnabledState (bool state)
{
dissolveObjectEnabled = state;
}
public void setIgnoreDissolveObjectEnabledState (bool state)
{
ignoreDissolveObjectEnabled = state;
}
public void cancelDissolve ()
{
objectToDissolveFound = false;
if (Time.time > dissolveDelay + lastTimeDissolveActivated) {
for (int j = 0; j < materialList.Count; j++) {
materialList [j].shader = originalShader [j];
}
}
stopDissolveCoroutine ();
}
public void setDissolveObjectEnabledStateFromEditor (bool state)
{
setDissolveObjectEnabledState (state);
updateComponent ();
}
void updateComponent ()
{
GKC_Utils.updateComponent (this);
GKC_Utils.updateDirtyScene ("Update Dissolve GameObject", gameObject);
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: eebf03c1672d1a143bd3f6a3c0aef243
timeCreated: 1571058162
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/dissolveObject.cs
uploadId: 814740

View File

@@ -0,0 +1,68 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class enableOrDisableAIOnDistanceManager : MonoBehaviour
{
[Header ("Behavior Main Settings")]
[Space]
public bool enableOrDisableAIOnDistanceEnabled = true;
public bool setActiveStateOnPlayerCameraGameObject;
[Space]
[Header ("Debug")]
[Space]
public bool AIEnableActive = true;
[Space]
[Header ("Components")]
[Space]
public playerController mainPlayerController;
public playerCamera mainPlayerCamera;
public AINavMesh mainAINavmesh;
public GameObject playerCameraGameObject;
public playerStatesManager mainPlayerStatesManager;
public void enableOrDisbleAI (bool state)
{
if (enableOrDisableAIOnDistanceEnabled) {
if (AIEnableActive == state) {
return;
}
AIEnableActive = state;
if (!AIEnableActive) {
mainAINavmesh.pauseAI (true);
mainPlayerStatesManager.checkPlayerStates ();
}
mainPlayerController.setCharacterMeshGameObjectState (AIEnableActive);
mainPlayerController.getGravityCenter ().gameObject.SetActive (AIEnableActive);
mainPlayerController.setAnimatorState (AIEnableActive);
if (setActiveStateOnPlayerCameraGameObject) {
playerCameraGameObject.SetActive (AIEnableActive);
} else {
mainPlayerCamera.enableOrDisablePlayerCameraGameObject (AIEnableActive);
}
if (AIEnableActive) {
mainAINavmesh.pauseAI (false);
}
}
}
public void setEnableOrDisableAIOnDistanceEnabledState (bool state)
{
enableOrDisableAIOnDistanceEnabled = state;
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: ca6ebaea31f6b8e458108bfb14c5087b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/enableOrDisableAIOnDistanceManager.cs
uploadId: 814740

View File

@@ -0,0 +1,168 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class enableOrDisableObjectOnDistanceManager : MonoBehaviour
{
[Header ("Behavior Main Settings")]
[Space]
public bool addObjectToMainSystem = true;
public bool addObjectOnStartWithDelay;
public float delayToAddObjectOnStart = 0.01f;
public bool addObjectOnAwake;
public Transform mainTransform;
public string mainManagerName = "Disable Objects On Distance Manager";
public bool setActiveStateOnMainTransformEnabled = true;
[Space]
[Header ("Distance Settings")]
[Space]
public bool useCustomDistance;
public float maxDistanceObjectEnabledOnScreen;
public float maxDistanceObjectEnableOutOfScreen;
[Space]
[Header ("Debug")]
[Space]
public bool objectActive = true;
public bool objectInfoSentToMainSystem;
public bool mainEnableOrDisableObjectsOnDistanceSystemLocated;
public enableOrDisableObjectsOnDistanceSystem mainEnableOrDisableObjectsOnDistanceSystem;
[Space]
[Header ("Events Settings")]
[Space]
public UnityEvent eventOnEnableObject;
public UnityEvent eventOnDisableObject;
void Awake ()
{
if (addObjectToMainSystem) {
if (addObjectOnAwake) {
addObjectToSystem ();
}
}
}
void Start ()
{
if (addObjectToMainSystem) {
if (addObjectOnAwake) {
return;
}
if (addObjectOnStartWithDelay) {
StartCoroutine (addObjectToSystemCoroutine ());
} else {
addObjectToSystem ();
}
}
}
IEnumerator addObjectToSystemCoroutine ()
{
WaitForSeconds delay = new WaitForSeconds (delayToAddObjectOnStart);
yield return delay;
addObjectToSystem ();
}
void addObjectToSystem ()
{
if (objectInfoSentToMainSystem) {
return;
}
mainEnableOrDisableObjectsOnDistanceSystemLocated = mainEnableOrDisableObjectsOnDistanceSystem != null;
if (!mainEnableOrDisableObjectsOnDistanceSystemLocated) {
mainEnableOrDisableObjectsOnDistanceSystem = enableOrDisableObjectsOnDistanceSystem.Instance;
mainEnableOrDisableObjectsOnDistanceSystemLocated = mainEnableOrDisableObjectsOnDistanceSystem != null;
}
if (!mainEnableOrDisableObjectsOnDistanceSystemLocated) {
GKC_Utils.instantiateMainManagerOnSceneWithTypeOnApplicationPlaying (enableOrDisableObjectsOnDistanceSystem.getMainManagerName (), typeof(enableOrDisableObjectsOnDistanceSystem), true);
mainEnableOrDisableObjectsOnDistanceSystem = enableOrDisableObjectsOnDistanceSystem.Instance;
mainEnableOrDisableObjectsOnDistanceSystemLocated = (mainEnableOrDisableObjectsOnDistanceSystem != null);
}
if (!mainEnableOrDisableObjectsOnDistanceSystemLocated) {
mainEnableOrDisableObjectsOnDistanceSystem = FindObjectOfType<enableOrDisableObjectsOnDistanceSystem> ();
mainEnableOrDisableObjectsOnDistanceSystemLocated = mainEnableOrDisableObjectsOnDistanceSystem != null;
}
if (mainEnableOrDisableObjectsOnDistanceSystemLocated) {
if (mainTransform == null) {
mainTransform = transform;
}
mainEnableOrDisableObjectsOnDistanceSystem.addObject (this);
objectInfoSentToMainSystem = true;
}
}
public void removeObjectFromSystem ()
{
if (mainEnableOrDisableObjectsOnDistanceSystemLocated) {
mainEnableOrDisableObjectsOnDistanceSystem.removeObject (mainTransform);
}
}
public void setActiveState (bool state)
{
if (objectActive == state) {
return;
}
objectActive = state;
if (objectActive) {
eventOnEnableObject.Invoke ();
} else {
eventOnDisableObject.Invoke ();
}
}
public void setAddObjectToMainSystemState (bool state)
{
addObjectToMainSystem = state;
if (!Application.isPlaying) {
if (addObjectToMainSystem) {
addObjectToSystem ();
} else {
removeObjectFromSystem ();
setActiveState (false);
}
}
}
public bool isSetActiveStateOnMainTransformEnabled ()
{
return setActiveStateOnMainTransformEnabled;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: b8565424b52ca794cb9cdf2270c1ecfa
timeCreated: 1642147990
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/enableOrDisableObjectOnDistanceManager.cs
uploadId: 814740

View File

@@ -0,0 +1,309 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
public class enableOrDisableObjectsOnDistanceSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool checkObjectsActive = true;
public bool checkForNullObjects = true;
public float maxDistanceObjectEnabledOnScreen;
public float maxDistanceObjectEnableOutOfScreen;
[Space]
[Header ("Debug")]
[Space]
public bool showObjectsPaused;
public bool isManagerInitialized;
public List<objectInfo> objectInfoList = new List<objectInfo> ();
[Space]
[Header ("Components")]
[Space]
public Camera mainCamera;
public playerCamera mainPlayerCamera;
Transform mainCameraTransform;
Vector3 targetPosition;
Vector3 cameraPosition;
Transform currentObject;
Vector3 screenPoint;
float distance;
bool usingScreenSpaceCamera;
bool targetOnScreen;
float screenWidth;
float screenHeight;
objectInfo currentObjectInfo;
int objectListCount;
bool screenResolutionAssigned;
float lastTimeGameStarted = 0;
public const string mainManagerName = "Disable Objects On Distance Manager";
public static string getMainManagerName ()
{
return mainManagerName;
}
private static enableOrDisableObjectsOnDistanceSystem _enableOrDisableObjectsOnDistanceSystemInstance;
public static enableOrDisableObjectsOnDistanceSystem Instance { get { return _enableOrDisableObjectsOnDistanceSystemInstance; } }
bool instanceInitialized;
public void getComponentInstance ()
{
if (instanceInitialized) {
return;
}
if (_enableOrDisableObjectsOnDistanceSystemInstance != null && _enableOrDisableObjectsOnDistanceSystemInstance != this) {
Destroy (this.gameObject);
return;
}
_enableOrDisableObjectsOnDistanceSystemInstance = this;
instanceInitialized = true;
}
void Awake ()
{
getComponentInstance ();
}
void Start ()
{
if (mainCamera == null) {
mainPlayerCamera = GKC_Utils.findMainPlayerCameraOnScene ();
if (mainPlayerCamera != null) {
mainCamera = mainPlayerCamera.getMainCamera ();
}
}
if (mainCamera != null) {
mainCameraTransform = mainCamera.transform;
usingScreenSpaceCamera = mainPlayerCamera.isUsingScreenSpaceCamera ();
} else {
checkObjectsActive = false;
}
}
void FixedUpdate ()
{
if (!checkObjectsActive || showObjectsPaused) {
return;
}
if (!isManagerInitialized) {
checkMainManagerInitialized ();
return;
}
objectListCount = objectInfoList.Count;
if (objectListCount == 0) {
return;
}
if (!usingScreenSpaceCamera) {
if (!screenResolutionAssigned) {
updateScreenValues ();
screenResolutionAssigned = true;
}
}
cameraPosition = mainCameraTransform.position;
for (int i = 0; i < objectListCount; i++) {
currentObjectInfo = objectInfoList [i];
if (checkForNullObjects) {
if (currentObjectInfo.objectTransform == null) {
objectInfoList.RemoveAt (i);
return;
}
}
//get the target position from global to local in the screen
targetPosition = currentObjectInfo.objectTransform.position;
if (usingScreenSpaceCamera) {
screenPoint = mainCamera.WorldToViewportPoint (targetPosition);
targetOnScreen = screenPoint.z > 0 && screenPoint.x > 0 && screenPoint.x < 1 && screenPoint.y > 0 && screenPoint.y < 1;
} else {
screenPoint = mainCamera.WorldToScreenPoint (targetPosition);
targetOnScreen = screenPoint.z > 0 && screenPoint.x > 0 && screenPoint.x < screenWidth && screenPoint.y > 0 && screenPoint.y < screenHeight;
}
distance = GKC_Utils.distance (targetPosition, cameraPosition);
//if the target is visible in the screen, enable the icon
if (targetOnScreen) {
bool checkResult = false;
if (currentObjectInfo.useCustomDistance) {
checkResult = (distance <= currentObjectInfo.maxDistanceObjectEnabledOnScreen);
} else {
checkResult = (distance <= maxDistanceObjectEnabledOnScreen);
}
if (checkResult) {
if (!currentObjectInfo.objectActive) {
enableOrDisableObject (true, i);
currentObjectInfo.objectActive = true;
}
} else {
if (currentObjectInfo.objectActive) {
enableOrDisableObject (false, i);
currentObjectInfo.objectActive = false;
}
}
} else {
bool checkResult = false;
if (currentObjectInfo.useCustomDistance) {
checkResult = (distance <= currentObjectInfo.maxDistanceObjectEnableOutOfScreen);
} else {
checkResult = (distance <= maxDistanceObjectEnableOutOfScreen);
}
//else the icon is only disabled, when the player is not looking at its direction
if (checkResult) {
if (!currentObjectInfo.objectActive) {
enableOrDisableObject (true, i);
currentObjectInfo.objectActive = true;
}
} else {
if (currentObjectInfo.objectActive) {
enableOrDisableObject (false, i);
currentObjectInfo.objectActive = false;
}
}
}
}
}
public void enableOrDisableObject (bool state, int index)
{
if (objectInfoList [index].setActiveStateOnMainTransformEnabled) {
if (objectInfoList [index].objectTransform.gameObject.activeSelf != state) {
objectInfoList [index].objectTransform.gameObject.SetActive (state);
}
}
objectInfoList [index].mainEnableOrDisableObjectOnDistanceManager.setActiveState (state);
}
//set what type of pick up is this object, and the object that the icon has to follow
public void addObject (enableOrDisableObjectOnDistanceManager newEnableOrDisableObjectOnDistanceManager)
{
objectInfo newObjectInfo = new objectInfo ();
newObjectInfo.objectTransform = newEnableOrDisableObjectOnDistanceManager.mainTransform;
newObjectInfo.setActiveStateOnMainTransformEnabled = newEnableOrDisableObjectOnDistanceManager.isSetActiveStateOnMainTransformEnabled ();
newObjectInfo.mainEnableOrDisableObjectOnDistanceManager = newEnableOrDisableObjectOnDistanceManager;
newObjectInfo.objectActive = true;
newObjectInfo.useCustomDistance = newEnableOrDisableObjectOnDistanceManager.useCustomDistance;
newObjectInfo.maxDistanceObjectEnabledOnScreen = newEnableOrDisableObjectOnDistanceManager.maxDistanceObjectEnabledOnScreen;
newObjectInfo.maxDistanceObjectEnableOutOfScreen = newEnableOrDisableObjectOnDistanceManager.maxDistanceObjectEnableOutOfScreen;
objectInfoList.Add (newObjectInfo);
if (!checkObjectsActive) {
if (newObjectInfo.setActiveStateOnMainTransformEnabled) {
if (newObjectInfo.objectTransform.gameObject.activeSelf) {
newObjectInfo.objectTransform.gameObject.SetActive (false);
}
}
newObjectInfo.objectActive = false;
}
}
public void removeObject (Transform newTransform)
{
if (newTransform == null) {
return;
}
int objectIndex = objectInfoList.FindIndex (s => s.objectTransform == newTransform);
if (objectIndex > -1) {
objectInfoList.RemoveAt (objectIndex);
}
}
public void updateScreenValues ()
{
screenWidth = Screen.width;
screenHeight = Screen.height;
}
void checkMainManagerInitialized ()
{
if (isManagerInitialized) {
return;
}
if (lastTimeGameStarted == 0) {
lastTimeGameStarted = Time.time;
} else {
if (Time.time > lastTimeGameStarted + 0.1f) {
isManagerInitialized = true;
}
}
}
[System.Serializable]
public class objectInfo
{
public int ID;
public Transform objectTransform;
public bool setActiveStateOnMainTransformEnabled;
public bool useCustomDistance;
public float maxDistanceObjectEnabledOnScreen;
public float maxDistanceObjectEnableOutOfScreen;
public bool objectActive;
public enableOrDisableObjectOnDistanceManager mainEnableOrDisableObjectOnDistanceManager;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: a5476f5bcb1c45e4ab026fc0fb87e95c
timeCreated: 1642147119
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/enableOrDisableObjectsOnDistanceSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,169 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class eventObjectFoundOnRaycastSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool checkObjectsEnabled = true;
public Transform raycastTransform;
public float rayDistanceToCheckObjectFound;
public LayerMask layerToCheckObjectFound;
public bool checkObjectsOnUpdate;
[Space]
[Header ("Type of Event Settings")]
[Space]
public bool checkEventsOnFoundCaptureSystem = true;
public bool sendObjectOnSurfaceDetected;
public GameObject objectToSendOnSurfaceDetected;
[Space]
[Header ("Debug")]
[Space]
public bool showDebugPrint;
[Space]
[Header ("Remote Events Settings")]
[Space]
public bool checkEventsOnRemoteEventSystem;
public string remoteEventToCall;
public bool useRemoteEventList;
public List<string> removeEventNameList = new List<string> ();
[Space]
[Header ("Event Settings")]
[Space]
public bool useEventToCallObjecObjectDetected;
public UnityEvent eventToCallOnObjectDetected;
RaycastHit hit;
GameObject currentObjectDetected;
GameObject previousObjectDetected;
bool raycastTransformLocated;
void Start ()
{
if (checkObjectsOnUpdate) {
activateRaycastDetectionOnUpdate ();
}
}
public void activateRaycastDetectionOnUpdate ()
{
StartCoroutine (checkObjectWithRaycastCoroutine ());
}
IEnumerator checkObjectWithRaycastCoroutine ()
{
var waitTime = new WaitForFixedUpdate ();
while (true) {
yield return waitTime;
checkObjectWithRaycast ();
}
}
public void checkObjectWithRaycast ()
{
if (checkObjectsEnabled) {
if (showDebugPrint) {
print ("checkObjectWithRaycast called");
}
if (!raycastTransformLocated) {
raycastTransformLocated = raycastTransform != null;
}
if (raycastTransformLocated) {
if (Physics.Raycast (raycastTransform.position, raycastTransform.forward, out hit, rayDistanceToCheckObjectFound, layerToCheckObjectFound)) {
currentObjectDetected = hit.collider.gameObject;
if (showDebugPrint) {
print ("Object Detected On Raycast " + currentObjectDetected.name);
}
if (currentObjectDetected != previousObjectDetected) {
previousObjectDetected = currentObjectDetected;
if (checkEventsOnFoundCaptureSystem) {
if (showDebugPrint) {
print ("Checking if event found on capture system");
}
eventObjectFoundOnCaptureSystem currentEventObjectFoundOnCaptureSystem = currentObjectDetected.GetComponent<eventObjectFoundOnCaptureSystem> ();
if (currentEventObjectFoundOnCaptureSystem != null) {
if (showDebugPrint) {
print ("currentEventObjectFoundOnCaptureSystem detected");
}
currentEventObjectFoundOnCaptureSystem.callEventOnCapture ();
if (sendObjectOnSurfaceDetected) {
currentEventObjectFoundOnCaptureSystem.callEventOnCaptureWithGameObject (objectToSendOnSurfaceDetected);
}
}
}
if (checkEventsOnRemoteEventSystem) {
remoteEventSystem currentRemoteEventSystem = currentObjectDetected.GetComponent<remoteEventSystem> ();
if (currentRemoteEventSystem != null) {
if (useRemoteEventList) {
for (int i = 0; i < removeEventNameList.Count; i++) {
currentRemoteEventSystem.callRemoteEvent (removeEventNameList [i]);
}
} else {
currentRemoteEventSystem.callRemoteEvent (remoteEventToCall);
}
}
}
if (useEventToCallObjecObjectDetected) {
eventToCallOnObjectDetected.Invoke ();
}
}
} else {
if (currentObjectDetected != null) {
currentObjectDetected = null;
previousObjectDetected = null;
}
}
}
}
}
public void setRaycastTransform (Transform newObject)
{
raycastTransform = newObject;
}
public void setCheckObjectsEnabledState (bool state)
{
checkObjectsEnabled = state;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 5a3a5bd8601abab45bed6fd1916cc68c
timeCreated: 1584807976
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/eventObjectFoundOnRaycastSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,105 @@
using UnityEngine;
using System.Collections;
public class fadeObject : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool vanishEnabled = true;
public float vanishSpeed;
public Renderer meshRenderer;
[Space]
public bool vanishAtOnce;
public float delayToVanishAtOnce;
[Space]
public bool sendObjectToPoolSystemToDisable;
Color originalColor;
bool originalColorStored;
public void activeVanish (float newSpeed)
{
if (!vanishEnabled) {
return;
}
if (meshRenderer == null) {
meshRenderer = GetComponentInChildren<Renderer> ();
}
if (meshRenderer == null) {
return;
}
if (newSpeed > 0) {
vanishSpeed = newSpeed;
}
if (sendObjectToPoolSystemToDisable) {
if (originalColorStored) {
meshRenderer.material.color = originalColor;
} else {
originalColor = meshRenderer.material.color;
originalColorStored = true;
}
}
if (!gameObject.activeSelf) {
return;
}
if (!gameObject.activeInHierarchy) {
return;
}
StartCoroutine (changeColorCoroutine ());
}
IEnumerator changeColorCoroutine ()
{
if (vanishAtOnce) {
WaitForSeconds delay = new WaitForSeconds (delayToVanishAtOnce);
yield return delay;
if (!sendObjectToPoolSystemToDisable) {
Destroy (gameObject);
}
} else {
if (meshRenderer != null) {
Color alpha = meshRenderer.material.color;
while (alpha.a > 0) {
alpha.a -= Time.deltaTime * vanishSpeed;
meshRenderer.material.color = alpha;
if (alpha.a <= 0) {
if (!sendObjectToPoolSystemToDisable) {
Destroy (gameObject);
}
}
yield return null;
}
}
yield return null;
}
if (sendObjectToPoolSystemToDisable) {
GKC_PoolingSystem.Despawn (gameObject);
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 7775e912fdc673246ae9271388b0a608
timeCreated: 1474125430
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/fadeObject.cs
uploadId: 814740

View File

@@ -0,0 +1,775 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
#if UNITY_EDITOR
using UnityEditor;
[System.Serializable]
public class featuresManager : MonoBehaviour
{
////this script allows to enable and disable all the features in this asset, so you can configure which of them you need and which you don't
//[Header ("Player Controller Features")]
//[Tooltip ("Enable the player to perform a regular jump. ")]
//public bool enabledRegularJump;
//[Tooltip ("Enable the player to jump again while already in the air. If set to true players will be able to jump higher by pressing the jump button while already jumping.")]
//public bool doubleJump;
//[Tooltip ("Should the player receive damage if they have been in the air too long (see maxTimeInAirDamage in the PlayerController), are falling, and their velocity is higher than 15 (they are falling fast)?")]
//public bool fallDamage;
//[Tooltip ("If enabled player can hold down jump to slow down their fall. This reduces the effect of gravity on the player as they fall. If fallDamage is enabled this can have the additional effect of reducing the damage caused while falling.")]
//public bool holdJumpSlowDownFallEnabled;
//public bool lookAlwaysInCameraDirection;
//public bool lookInCameraDirectionIfLookingAtTarget;
//public bool lookOnlyIfMoving;
//public bool checkForStairAdherenceSystem;
//public bool canMoveWhileAimFirstPerson;
//public bool canMoveWhileAimThirdPerson;
//public bool canMoveWhileAimLockedCamera;
//public bool useLandMark;
//public bool canGetOnVehicles;
//public bool canDrive;
//public bool airDashEnabled;
//public bool sprintEnabled;
//[Space]
//[Header ("Player Camera Features")]
//[Space]
//public bool zoomCamera;
//public bool moveAwayCamera;
//public bool shakeCamera;
//public bool moveAwayCameraInAir;
//public bool useAccelerometer;
//public bool resetCameraRotationAfterTime;
//public bool lookAtTargetEnabled;
//public bool canActivateLookAtTargetEnabled;
//public bool canActiveLookAtTargetOnLockedCamera;
//public bool changeCameraViewEnabled;
//public bool changeCameraSideActive;
//[Space]
//[Header ("Gravity Control Features")]
//[Space]
//public bool gravityPower;
//public bool liftToSearchEnabled;
//public bool randomRotationOnAirEnabled;
//public bool preserveVelocityWhenDisableGravityPower;
//public bool startWithZeroGravityMode;
//public bool canResetRotationOnZeroGravityMode;
//public bool canAdjustToForwardSurface;
//public bool canActivateFreeFloatingMode;
//public bool changeModelColor;
//[Space]
//[Header ("Powers Features")]
//[Space]
//public bool runOnCrouchEnabled;
//public bool aimModeEnabled;
//public bool shootEnabled;
//public bool changePowersEnabled;
//public bool canFirePowersWithoutAiming;
//public bool useAimCameraOnFreeFireMode;
//public bool headLookWhenAiming;
//public bool useAimAssistInThirdPerson;
//public bool infinitePower;
//[Space]
//[Header ("Grab Object Features")]
//[Space]
//public bool grabObjectEnabled;
//public bool useCursor;
//public bool grabInFixedPosition;
//public bool changeGravityObjectsEnabled;
//public bool grabObjectsPhysicallyEnabled;
//public bool useObjectToGrabFoundShader;
//public bool enableTransparency;
//public bool canUseZoomWhileGrabbed;
//[Space]
//[Header ("Devices System Features")]
//[Space]
//public bool canUseDevices;
//public bool usePickUpAmountIfEqualToOne;
//public bool showUseDeviceIconEnabled;
//public bool useDeviceButtonEnabled;
//public bool useFixedDeviceIconPosition;
//public bool deviceOnScreenIfUseFixedIconPosition;
//public bool useDeviceFoundShader;
//public bool holdButtonToTakePickupsAround;
//[Space]
//[Header ("Close Combat System Features")]
//[Space]
//public bool combatSystemEnabled;
//[Space]
//[Header ("Foot Step System Features")]
//[Space]
//public bool soundsEnabled;
//public bool useFootPrints;
//public bool useFootParticles;
//[Space]
//[Header ("Scanner System Features")]
//[Space]
//public bool scannerSystemEnabled;
//[Space]
//[Header ("Pick Ups Info Features")]
//[Space]
//public bool pickUpScreenInfoEnabled;
//[Space]
//[Header ("Player Weapons Features")]
//[Space]
//public bool setWeaponWhenPicked;
//public bool canGrabObjectsCarryingWeapons;
//public bool changeToNextWeaponIfAmmoEmpty;
//public bool drawKeepWeaponWhenModeChanged;
//public bool canFireWeaponsWithoutAiming;
//public bool drawWeaponIfFireButtonPressed;
//public bool keepWeaponAfterDelayThirdPerson;
//public bool keepWeaponAfterDelayFirstPerson;
//public bool useQuickDrawWeapon;
//public bool useAimCameraOnFreeFireModeWeapons;
//public bool storePickedWeaponsOnInventoryWeaponSystem;
//public bool drawWeaponWhenPicked;
//public bool changeToNextWeaponWhenUnequipped;
//public bool changeToNextWeaponWhenEquipped;
//public bool notActivateWeaponsAtStart;
//public bool openWeaponAttachmentsMenuEnabled;
//public bool setFirstPersonForAttachmentEditor;
//public bool useUniversalAttachments;
//public bool canDropWeapons;
//public bool changeToNextWeaponWhenDrop;
//public bool dropCurrentWeaponWhenDie;
//public bool dropAllWeaponsWhenDie;
//public bool dropWeaponsOnlyIfUsing;
//public bool drawWeaponWhenResurrect;
//public bool canMarkTargets;
//public bool useAimAssistInThirdPersonWeapons;
//public bool useAimAssistInFirstPerson;
//public bool useAimAssistInLockedCamera;
//[Space]
//[Header ("Inventory Manager Features")]
//[Space]
//public bool inventoryEnabled;
//public bool combineElementsAtDrop;
//public bool useOnlyWhenNeededAmountToUseObject;
//public bool activeNumberOfObjectsToUseMenu;
//public bool setTotalAmountWhenDropObject;
//public bool examineObjectBeforeStoreEnabled;
//public bool storePickedWeaponsOnInventory;
//public bool useDragDropQuickAccessSlots;
//public bool equipWeaponsWhenPicked;
//[Space]
//[Header ("Jetpack System Features")]
//[Space]
//public bool jetpackEnabled;
//[Space]
//[Header ("Fly System Features")]
//[Space]
//public bool flyModeEnabled;
//[Space]
//[Header ("Damage Screen System Features")]
//[Space]
//public bool damageScreenEnabled;
//public bool showDamageDirection;
//public bool showDamagePositionWhenEnemyVisible;
//public bool showAllDamageDirections;
//[Space]
//[Header ("Damage In Screen System Features")]
//[Space]
//public bool showScreenInfoEnabled;
//[Space]
//[Header ("Friend List Manager Features")]
//[Space]
//public bool friendManagerEnabled;
//[Space]
//[Header ("Player States Manager Features")]
//[Space]
//public bool openPlayerModeMenuEnabled;
//public bool changeModeEnabled;
//public bool closeMenuWhenModeSelected;
//[Space]
//[Header ("Head Track Features")]
//[Space]
//public bool headTrackEnabled;
//public bool lookInCameraDirection;
//public bool lookInOppositeDirectionOutOfRange;
//public bool lookBehindIfMoving;
//[Space]
//[Header ("Hand On Surface IK System Features")]
//[Space]
//public bool adjustHandsToSurfacesEnabled;
//[Space]
//[Header ("IK Foot System Features")]
//[Space]
//public bool IKFootSystemEnabled;
//[Space]
//[Header ("Climb Ledge System Features")]
//[Space]
//public bool climbLedgeActive;
//public bool useHangFromLedgeIcon;
//public bool useFixedDeviceIconPositionClimbSystem;
//public bool keepWeaponsOnLedgeDetected;
//public bool drawWeaponsAfterClimbLedgeIfPreviouslyCarried;
//public bool onlyGrabLedgeIfMovingForward;
//public bool canJumpWhenHoldLedge;
//[Space]
//[Header ("Weapons List Manager Features")]
//[Space]
//public bool weaponListManagerEnabled;
//[Space]
//[Header ("Powers Manager Features")]
//[Space]
//public bool powersActive;
//[Space]
//[Header ("Map Features")]
//[Space]
//public bool mapActive;
//[Space]
//[Header ("TimeBullet Features")]
//[Space]
//public bool timeBullet;
//[Space]
//[Header ("Powers Features")]
//[Space]
//public bool abilitiesSystemEnabled;
//[Space]
//[Space]
////this script uses parameters inside the player, the camera, the map and the character (the parent of the player)
//public GameObject pController;
//public GameObject pCamera;
[Space]
[Space]
[TextArea (10, 10)]
public string explanation = "This feature manager has been removed, as there is an improved main settings manager" +
"for the player and AI.\n Go to the Build Player component, on this same gameObject, and open the button 'Show Setting List' \n" +
" and set the value on any of the settings and use the button 'Apply' on the right of such value to apply such setting." +
"\nYou can also set all the values on that list as needed and use the button on the bottom to apply all of them at once.";
//"IMPORTANT: \r\n\r\nFirst press Get Configuration, " +
//"to get the current values on the different components, then you apply the settings you prefer by" +
//" enabling/disabling fields on this inspector.\r\n\r\nFinally, press the button Set Configuration to apply the changes.";
//playerController playerControllerManager;
//playerCamera playerCameraManager;
//otherPowers powersManager;
//gravitySystem gravityManager;
//grabObjects grabObjectsManager;
//usingDevicesSystem usingDevicesManager;
//closeCombatSystem combatManager;
//scannerSystem scannerManager;
//pickUpsScreenInfo pickUpsScreenInfoManager;
//mapSystem mapManager;
//timeBullet timeBulletManager;
//powersListManager powerListManager;
//footStepManager footStepSystem;
//playerWeaponsManager weaponsManager;
//inventoryManager inventorySystem;
//jetpackSystem jetpackManager;
//damageInScreen damageInScreenManager;
//damageScreenSystem damageScreenManager;
//flySystem flyManager;
//friendListManager friendListSystem;
//playerStatesManager mainPlayerStatesManager;
//headTrack headTrackManager;
//handsOnSurfaceIKSystem handOnSurfaceIKManager;
//IKFootSystem IKFootManager;
//climbLedgeSystem climbLedgeManager;
//weaponListManager weaponListManager;
//playerAbilitiesSystem mainPlayerAbilitiesSystem;
//public void updateValues (bool settingConfiguration)
//{
// //search the component that has the values to enable or disable
// searchComponent ();
// //Player Controller
// if (playerControllerManager != null) {
// setBoolValue (ref playerControllerManager.enabledRegularJump, ref enabledRegularJump, !settingConfiguration);
// setBoolValue (ref playerControllerManager.enabledDoubleJump, ref doubleJump, !settingConfiguration);
// setBoolValue (ref playerControllerManager.fallDamageEnabled, ref fallDamage, !settingConfiguration);
// setBoolValue (ref playerControllerManager.holdJumpSlowDownFallEnabled, ref holdJumpSlowDownFallEnabled, !settingConfiguration);
// setBoolValue (ref playerControllerManager.lookAlwaysInCameraDirection, ref lookAlwaysInCameraDirection, !settingConfiguration);
// setBoolValue (ref playerControllerManager.lookInCameraDirectionIfLookingAtTarget, ref lookInCameraDirectionIfLookingAtTarget, !settingConfiguration);
// setBoolValue (ref playerControllerManager.lookOnlyIfMoving, ref lookOnlyIfMoving, !settingConfiguration);
// setBoolValue (ref playerControllerManager.checkForStairAdherenceSystem, ref checkForStairAdherenceSystem, !settingConfiguration);
// setBoolValue (ref playerControllerManager.canMoveWhileAimFirstPerson, ref canMoveWhileAimFirstPerson, !settingConfiguration);
// setBoolValue (ref playerControllerManager.canMoveWhileAimThirdPerson, ref canMoveWhileAimThirdPerson, !settingConfiguration);
// setBoolValue (ref playerControllerManager.canMoveWhileAimLockedCamera, ref canMoveWhileAimLockedCamera, !settingConfiguration);
// setBoolValue (ref playerControllerManager.useLandMark, ref useLandMark, !settingConfiguration);
// setBoolValue (ref playerControllerManager.canGetOnVehicles, ref canGetOnVehicles, !settingConfiguration);
// setBoolValue (ref playerControllerManager.canDrive, ref canDrive, !settingConfiguration);
// setBoolValue (ref playerControllerManager.airDashEnabled, ref airDashEnabled, !settingConfiguration);
// setBoolValue (ref playerControllerManager.sprintEnabled, ref sprintEnabled, !settingConfiguration);
// setBoolValue (ref playerControllerManager.runOnCrouchEnabled, ref runOnCrouchEnabled, !settingConfiguration);
// } else {
// print ("WARNING: Player Controller script hasn't been found");
// }
// //Player Camera
// if (playerCameraManager != null) {
// setBoolValue (ref playerCameraManager.settings.zoomEnabled, ref zoomCamera, !settingConfiguration);
// setBoolValue (ref playerCameraManager.settings.moveAwayCameraEnabled, ref moveAwayCamera, !settingConfiguration);
// setBoolValue (ref playerCameraManager.settings.enableShakeCamera, ref shakeCamera, !settingConfiguration);
// setBoolValue (ref playerCameraManager.settings.enableMoveAwayInAir, ref moveAwayCameraInAir, !settingConfiguration);
// setBoolValue (ref playerCameraManager.settings.useAcelerometer, ref useAccelerometer, !settingConfiguration);
// setBoolValue (ref playerCameraManager.resetCameraRotationAfterTime, ref resetCameraRotationAfterTime, !settingConfiguration);
// setBoolValue (ref playerCameraManager.lookAtTargetEnabled, ref lookAtTargetEnabled, !settingConfiguration);
// setBoolValue (ref playerCameraManager.lookAtTargetEnabled, ref canActivateLookAtTargetEnabled, !settingConfiguration);
// setBoolValue (ref playerCameraManager.canActiveLookAtTargetOnLockedCamera, ref canActiveLookAtTargetOnLockedCamera, !settingConfiguration);
// setBoolValue (ref playerCameraManager.changeCameraViewEnabled, ref changeCameraViewEnabled, !settingConfiguration);
// setBoolValue (ref playerCameraManager.changeCameraSideActive, ref changeCameraSideActive, !settingConfiguration);
// } else {
// print ("WARNING: Player Camera script hasn't been found");
// }
// //Gravity System
// if (gravityManager != null) {
// setBoolValue (ref gravityManager.gravityPowerEnabled, ref gravityPower, !settingConfiguration);
// setBoolValue (ref gravityManager.liftToSearchEnabled, ref liftToSearchEnabled, !settingConfiguration);
// setBoolValue (ref gravityManager.randomRotationOnAirEnabled, ref randomRotationOnAirEnabled, !settingConfiguration);
// setBoolValue (ref gravityManager.preserveVelocityWhenDisableGravityPower, ref preserveVelocityWhenDisableGravityPower, !settingConfiguration);
// setBoolValue (ref gravityManager.startWithZeroGravityMode, ref startWithZeroGravityMode, !settingConfiguration);
// setBoolValue (ref gravityManager.canResetRotationOnZeroGravityMode, ref canResetRotationOnZeroGravityMode, !settingConfiguration);
// setBoolValue (ref gravityManager.canAdjustToForwardSurface, ref canAdjustToForwardSurface, !settingConfiguration);
// setBoolValue (ref gravityManager.canActivateFreeFloatingMode, ref canActivateFreeFloatingMode, !settingConfiguration);
// setBoolValue (ref gravityManager.changeModelColor, ref changeModelColor, !settingConfiguration);
// } else {
// print ("WARNING: Gravity System script hasn't been found");
// }
// //Powers
// if (powersManager != null) {
// setBoolValue (ref powersManager.settings.aimModeEnabled, ref aimModeEnabled, !settingConfiguration);
// setBoolValue (ref powersManager.settings.shootEnabled, ref shootEnabled, !settingConfiguration);
// setBoolValue (ref powersManager.settings.changePowersEnabled, ref changePowersEnabled, !settingConfiguration);
// setBoolValue (ref powersManager.canFirePowersWithoutAiming, ref canFirePowersWithoutAiming, !settingConfiguration);
// setBoolValue (ref powersManager.useAimCameraOnFreeFireMode, ref useAimCameraOnFreeFireMode, !settingConfiguration);
// setBoolValue (ref powersManager.headLookWhenAiming, ref headLookWhenAiming, !settingConfiguration);
// setBoolValue (ref powersManager.useAimAssistInThirdPerson, ref useAimAssistInThirdPerson, !settingConfiguration);
// setBoolValue (ref powersManager.infinitePower, ref infinitePower, !settingConfiguration);
// } else {
// print ("WARNING: Other Powers script hasn't been found");
// }
// //Grab Objects
// if (grabObjectsManager != null) {
// setBoolValue (ref grabObjectsManager.grabObjectsEnabled, ref grabObjectEnabled, !settingConfiguration);
// setBoolValue (ref grabObjectsManager.useCursor, ref useCursor, !settingConfiguration);
// setBoolValue (ref grabObjectsManager.grabInFixedPosition, ref grabInFixedPosition, !settingConfiguration);
// setBoolValue (ref grabObjectsManager.changeGravityObjectsEnabled, ref changeGravityObjectsEnabled, !settingConfiguration);
// setBoolValue (ref grabObjectsManager.grabObjectsPhysicallyEnabled, ref grabObjectsPhysicallyEnabled, !settingConfiguration);
// setBoolValue (ref grabObjectsManager.useObjectToGrabFoundShader, ref useObjectToGrabFoundShader, !settingConfiguration);
// setBoolValue (ref grabObjectsManager.enableTransparency, ref enableTransparency, !settingConfiguration);
// setBoolValue (ref grabObjectsManager.canUseZoomWhileGrabbed, ref canUseZoomWhileGrabbed, !settingConfiguration);
// } else {
// print ("WARNING: Grab Objects script hasn't been found");
// }
// //Using Devices System
// if (usingDevicesManager != null) {
// setBoolValue (ref usingDevicesManager.canUseDevices, ref canUseDevices, !settingConfiguration);
// setBoolValue (ref usingDevicesManager.usePickUpAmountIfEqualToOne, ref usePickUpAmountIfEqualToOne, !settingConfiguration);
// setBoolValue (ref usingDevicesManager.showUseDeviceIconEnabled, ref showUseDeviceIconEnabled, !settingConfiguration);
// setBoolValue (ref usingDevicesManager.useDeviceButtonEnabled, ref useDeviceButtonEnabled, !settingConfiguration);
// setBoolValue (ref usingDevicesManager.useFixedDeviceIconPosition, ref useFixedDeviceIconPosition, !settingConfiguration);
// setBoolValue (ref usingDevicesManager.deviceOnScreenIfUseFixedIconPosition, ref deviceOnScreenIfUseFixedIconPosition, !settingConfiguration);
// setBoolValue (ref usingDevicesManager.useDeviceFoundShader, ref useDeviceFoundShader, !settingConfiguration);
// setBoolValue (ref usingDevicesManager.holdButtonToTakePickupsAround, ref holdButtonToTakePickupsAround, !settingConfiguration);
// } else {
// print ("WARNING: Using Devices System script hasn't been found");
// }
// //Close Combat System
// if (combatManager != null) {
// setBoolValue (ref combatManager.combatSystemEnabled, ref combatSystemEnabled, !settingConfiguration);
// } else {
// print ("WARNING: Close Combat System script hasn't been found");
// }
// //Foot step System
// if (footStepSystem != null) {
// setBoolValue (ref footStepSystem.soundsEnabled, ref soundsEnabled, !settingConfiguration);
// setBoolValue (ref footStepSystem.useFootPrints, ref useFootPrints, !settingConfiguration);
// setBoolValue (ref footStepSystem.useFootParticles, ref useFootParticles, !settingConfiguration);
// } else {
// print ("WARNING: Foot Step Manager script hasn't been found");
// }
// //Scanner System
// if (scannerManager != null) {
// setBoolValue (ref scannerManager.scannerSystemEnabled, ref scannerSystemEnabled, !settingConfiguration);
// } else {
// print ("WARNING: Scanner System script hasn't been found");
// }
// //Pick Ups Screen Info
// if (pickUpsScreenInfoManager != null) {
// setBoolValue (ref pickUpsScreenInfoManager.pickUpScreenInfoEnabled, ref pickUpScreenInfoEnabled, !settingConfiguration);
// } else {
// print ("WARNING: Pickup Screen Info System script hasn't been found");
// }
// //Player Weapons System
// if (weaponsManager != null) {
// setBoolValue (ref weaponsManager.setWeaponWhenPicked, ref setWeaponWhenPicked, !settingConfiguration);
// setBoolValue (ref weaponsManager.canGrabObjectsCarryingWeapons, ref canGrabObjectsCarryingWeapons, !settingConfiguration);
// setBoolValue (ref weaponsManager.changeToNextWeaponIfAmmoEmpty, ref changeToNextWeaponIfAmmoEmpty, !settingConfiguration);
// setBoolValue (ref weaponsManager.drawKeepWeaponWhenModeChanged, ref drawKeepWeaponWhenModeChanged, !settingConfiguration);
// setBoolValue (ref weaponsManager.canFireWeaponsWithoutAiming, ref canFireWeaponsWithoutAiming, !settingConfiguration);
// setBoolValue (ref weaponsManager.drawWeaponIfFireButtonPressed, ref drawWeaponIfFireButtonPressed, !settingConfiguration);
// setBoolValue (ref weaponsManager.keepWeaponAfterDelayThirdPerson, ref keepWeaponAfterDelayThirdPerson, !settingConfiguration);
// setBoolValue (ref weaponsManager.keepWeaponAfterDelayFirstPerson, ref keepWeaponAfterDelayFirstPerson, !settingConfiguration);
// setBoolValue (ref weaponsManager.useQuickDrawWeapon, ref useQuickDrawWeapon, !settingConfiguration);
// setBoolValue (ref weaponsManager.useAimCameraOnFreeFireMode, ref useAimCameraOnFreeFireModeWeapons, !settingConfiguration);
// setBoolValue (ref weaponsManager.storePickedWeaponsOnInventory, ref storePickedWeaponsOnInventoryWeaponSystem, !settingConfiguration);
// setBoolValue (ref weaponsManager.drawWeaponWhenPicked, ref drawWeaponWhenPicked, !settingConfiguration);
// setBoolValue (ref weaponsManager.changeToNextWeaponWhenUnequipped, ref changeToNextWeaponWhenUnequipped, !settingConfiguration);
// setBoolValue (ref weaponsManager.changeToNextWeaponWhenEquipped, ref changeToNextWeaponWhenEquipped, !settingConfiguration);
// setBoolValue (ref weaponsManager.notActivateWeaponsAtStart, ref notActivateWeaponsAtStart, !settingConfiguration);
// setBoolValue (ref weaponsManager.openWeaponAttachmentsMenuEnabled, ref openWeaponAttachmentsMenuEnabled, !settingConfiguration);
// setBoolValue (ref weaponsManager.setFirstPersonForAttachmentEditor, ref setFirstPersonForAttachmentEditor, !settingConfiguration);
// setBoolValue (ref weaponsManager.useUniversalAttachments, ref useUniversalAttachments, !settingConfiguration);
// setBoolValue (ref weaponsManager.canDropWeapons, ref canDropWeapons, !settingConfiguration);
// setBoolValue (ref weaponsManager.changeToNextWeaponWhenDrop, ref changeToNextWeaponWhenDrop, !settingConfiguration);
// setBoolValue (ref weaponsManager.dropCurrentWeaponWhenDie, ref dropCurrentWeaponWhenDie, !settingConfiguration);
// setBoolValue (ref weaponsManager.dropAllWeaponsWhenDie, ref dropAllWeaponsWhenDie, !settingConfiguration);
// setBoolValue (ref weaponsManager.dropWeaponsOnlyIfUsing, ref dropWeaponsOnlyIfUsing, !settingConfiguration);
// setBoolValue (ref weaponsManager.drawWeaponWhenResurrect, ref drawWeaponWhenResurrect, !settingConfiguration);
// setBoolValue (ref weaponsManager.canMarkTargets, ref canMarkTargets, !settingConfiguration);
// setBoolValue (ref weaponsManager.useAimAssistInThirdPerson, ref useAimAssistInThirdPersonWeapons, !settingConfiguration);
// setBoolValue (ref weaponsManager.useAimAssistInFirstPerson, ref useAimAssistInFirstPerson, !settingConfiguration);
// setBoolValue (ref weaponsManager.useAimAssistInLockedCamera, ref useAimAssistInLockedCamera, !settingConfiguration);
// } else {
// print ("WARNING: Player Weapons Manager script hasn't been found");
// }
// //Player Inventory settings
// if (inventorySystem != null) {
// setBoolValue (ref inventorySystem.inventoryEnabled, ref inventoryEnabled, !settingConfiguration);
// setBoolValue (ref inventorySystem.combineElementsAtDrop, ref combineElementsAtDrop, !settingConfiguration);
// setBoolValue (ref inventorySystem.useOnlyWhenNeededAmountToUseObject, ref useOnlyWhenNeededAmountToUseObject, !settingConfiguration);
// setBoolValue (ref inventorySystem.activeNumberOfObjectsToUseMenu, ref activeNumberOfObjectsToUseMenu, !settingConfiguration);
// setBoolValue (ref inventorySystem.setTotalAmountWhenDropObject, ref setTotalAmountWhenDropObject, !settingConfiguration);
// setBoolValue (ref inventorySystem.examineObjectBeforeStoreEnabled, ref examineObjectBeforeStoreEnabled, !settingConfiguration);
// setBoolValue (ref inventorySystem.storePickedWeaponsOnInventory, ref storePickedWeaponsOnInventory, !settingConfiguration);
// setBoolValue (ref inventorySystem.mainInventoryQuickAccessSlotsSystem.useDragDropInventorySlots, ref useDragDropQuickAccessSlots, !settingConfiguration);
// setBoolValue (ref inventorySystem.equipWeaponsWhenPicked, ref equipWeaponsWhenPicked, !settingConfiguration);
// } else {
// print ("WARNING: Inventory Manager script hasn't been found");
// }
// //Jetpack System settings
// if (jetpackManager != null) {
// setBoolValue (ref jetpackManager.jetpackEnabled, ref jetpackEnabled, !settingConfiguration);
// } else {
// print ("WARNING: Jetpack System script hasn't been found");
// }
// //Fly System settings
// if (flyManager != null) {
// setBoolValue (ref flyManager.flyModeEnabled, ref flyModeEnabled, !settingConfiguration);
// } else {
// print ("WARNING: Fly System script hasn't been found");
// }
// //Damage Screen System settings
// if (damageScreenManager != null) {
// setBoolValue (ref damageScreenManager.damageScreenEnabled, ref damageScreenEnabled, !settingConfiguration);
// setBoolValue (ref damageScreenManager.showDamageDirection, ref showDamageDirection, !settingConfiguration);
// setBoolValue (ref damageScreenManager.showDamagePositionWhenEnemyVisible, ref showDamagePositionWhenEnemyVisible, !settingConfiguration);
// setBoolValue (ref damageScreenManager.showAllDamageDirections, ref showAllDamageDirections, !settingConfiguration);
// } else {
// print ("WARNING: Damage Screen System script hasn't been found");
// }
// //Damage In Screen Info settings
// if (damageInScreenManager != null) {
// setBoolValue (ref damageInScreenManager.showScreenInfoEnabled, ref showScreenInfoEnabled, !settingConfiguration);
// } else {
// print ("WARNING: Damage In Screen script hasn't been found");
// }
// //Damage In Screen Info settings
// if (friendListSystem != null) {
// setBoolValue (ref friendListSystem.friendManagerEnabled, ref friendManagerEnabled, !settingConfiguration);
// } else {
// print ("WARNING: Friend List Manager script hasn't been found");
// }
// //Player States Manage settings
// if (mainPlayerStatesManager != null) {
// setBoolValue (ref mainPlayerStatesManager.openPlayerModeMenuEnabled, ref openPlayerModeMenuEnabled, !settingConfiguration);
// setBoolValue (ref mainPlayerStatesManager.changeModeEnabled, ref changeModeEnabled, !settingConfiguration);
// setBoolValue (ref mainPlayerStatesManager.closeMenuWhenModeSelected, ref closeMenuWhenModeSelected, !settingConfiguration);
// } else {
// print ("WARNING: Player States Manager script hasn't been found");
// }
// //Head Track Manage settings
// if (headTrackManager != null) {
// setBoolValue (ref headTrackManager.headTrackEnabled, ref headTrackEnabled, !settingConfiguration);
// setBoolValue (ref headTrackManager.lookInCameraDirection, ref lookInCameraDirection, !settingConfiguration);
// setBoolValue (ref headTrackManager.lookInOppositeDirectionOutOfRange, ref lookInOppositeDirectionOutOfRange, !settingConfiguration);
// setBoolValue (ref headTrackManager.lookBehindIfMoving, ref lookBehindIfMoving, !settingConfiguration);
// } else {
// print ("WARNING: Head Track script hasn't been found");
// }
// //Hand On Surface IK System settings
// if (handOnSurfaceIKManager != null) {
// setBoolValue (ref handOnSurfaceIKManager.adjustHandsToSurfacesEnabled, ref adjustHandsToSurfacesEnabled, !settingConfiguration);
// } else {
// print ("WARNING: Hands On Surface IK System script hasn't been found");
// }
// //IK Foot System settings
// if (IKFootManager != null) {
// setBoolValue (ref IKFootManager.IKFootSystemEnabled, ref IKFootSystemEnabled, !settingConfiguration);
// } else {
// print ("WARNING: IK Foot System script hasn't been found");
// }
// //Climb Ledge System settings
// if (climbLedgeManager != null) {
// setBoolValue (ref climbLedgeManager.climbLedgeActive, ref climbLedgeActive, !settingConfiguration);
// setBoolValue (ref climbLedgeManager.useHangFromLedgeIcon, ref useHangFromLedgeIcon, !settingConfiguration);
// setBoolValue (ref climbLedgeManager.useFixedDeviceIconPosition, ref useFixedDeviceIconPositionClimbSystem, !settingConfiguration);
// setBoolValue (ref climbLedgeManager.keepWeaponsOnLedgeDetected, ref keepWeaponsOnLedgeDetected, !settingConfiguration);
// setBoolValue (ref climbLedgeManager.drawWeaponsAfterClimbLedgeIfPreviouslyCarried, ref drawWeaponsAfterClimbLedgeIfPreviouslyCarried, !settingConfiguration);
// setBoolValue (ref climbLedgeManager.onlyGrabLedgeIfMovingForward, ref onlyGrabLedgeIfMovingForward, !settingConfiguration);
// setBoolValue (ref climbLedgeManager.canJumpWhenHoldLedge, ref canJumpWhenHoldLedge, !settingConfiguration);
// } else {
// print ("WARNING: Climb Ledge System script hasn't been found");
// }
// //Wepons List Manager settings
// if (weaponListManager != null) {
// setBoolValue (ref weaponListManager.weaponListManagerEnabled, ref weaponListManagerEnabled, !settingConfiguration);
// } else {
// print ("WARNING: Weapons List Manager script hasn't been found");
// }
// //Map settings
// if (mapManager != null) {
// setBoolValue (ref mapManager.mapEnabled, ref mapActive, !settingConfiguration);
// } else {
// print ("WARNING: Map Manager script hasn't been found");
// }
// //Time Bullet settings
// if (timeBulletManager != null) {
// setBoolValue (ref timeBulletManager.timeBulletEnabled, ref timeBullet, !settingConfiguration);
// } else {
// print ("WARNING: Time Bullet script hasn't been found");
// }
// //Power List Manager settings
// if (powerListManager != null) {
// setBoolValue (ref powerListManager.powerListManagerEnabled, ref powersActive, !settingConfiguration);
// } else {
// print ("WARNING: Powers List Manager script hasn't been found");
// }
// if (mainPlayerAbilitiesSystem != null) {
// setBoolValue (ref mainPlayerAbilitiesSystem.abilitiesSystemEnabled, ref abilitiesSystemEnabled, !settingConfiguration);
// } else {
// print ("WARNING: Player Abilities System script hasn't been found");
// }
// //upload every change object in the editor
// updateComponents ();
//}
//public void setBoolValue (ref bool rightValue, ref bool leftValue, bool assignRightValueToLeftValue)
//{
// if (assignRightValueToLeftValue) {
// leftValue = rightValue;
// } else {
// rightValue = leftValue;
// }
//}
////set the options that the user has configured in the inspector
//public void setConfiguration ()
//{
// updateValues (true);
//}
////get the current values of the features, to check the if the booleans fields are correct or not
//public void getConfiguration ()
//{
// updateValues (false);
//}
//public void updateComponents ()
//{
// searchComponent ();
// GKC_Utils.updateComponent (playerControllerManager);
// GKC_Utils.updateComponent (playerCameraManager);
// GKC_Utils.updateComponent (powersManager);
// GKC_Utils.updateComponent (gravityManager);
// GKC_Utils.updateComponent (grabObjectsManager);
// GKC_Utils.updateComponent (usingDevicesManager);
// GKC_Utils.updateComponent (combatManager);
// GKC_Utils.updateComponent (scannerManager);
// GKC_Utils.updateComponent (pickUpsScreenInfoManager);
// GKC_Utils.updateComponent (mapManager);
// GKC_Utils.updateComponent (timeBulletManager);
// GKC_Utils.updateComponent (powerListManager);
// GKC_Utils.updateComponent (footStepSystem);
// GKC_Utils.updateComponent (weaponsManager);
// GKC_Utils.updateComponent (inventorySystem);
// GKC_Utils.updateComponent (jetpackManager);
// GKC_Utils.updateComponent (damageInScreenManager);
// GKC_Utils.updateComponent (damageScreenManager);
// GKC_Utils.updateComponent (flyManager);
// GKC_Utils.updateComponent (friendListSystem);
// GKC_Utils.updateComponent (mainPlayerStatesManager);
// GKC_Utils.updateComponent (headTrackManager);
// GKC_Utils.updateComponent (handOnSurfaceIKManager);
// GKC_Utils.updateComponent (IKFootManager);
// GKC_Utils.updateComponent (climbLedgeManager);
// GKC_Utils.updateComponent (weaponListManager);
// GKC_Utils.updateComponent (mainPlayerAbilitiesSystem);
// GKC_Utils.updateComponent (this);
// GKC_Utils.updateDirtyScene ("Update Features Manager Values", gameObject);
//}
//void searchComponent ()
//{
// playerComponentsManager mainPlayerComponentsManager = pController.GetComponent<playerComponentsManager> ();
// playerControllerManager = mainPlayerComponentsManager.getPlayerController ();
// playerCameraManager = mainPlayerComponentsManager.getPlayerCamera ();
// gravityManager = mainPlayerComponentsManager.getGravitySystem ();
// powersManager = mainPlayerComponentsManager.getOtherPowers ();
// grabObjectsManager = mainPlayerComponentsManager.getGrabObjects ();
// usingDevicesManager = mainPlayerComponentsManager.getUsingDevicesSystem ();
// combatManager = mainPlayerComponentsManager.getCloseCombatSystem ();
// scannerManager = GetComponentInChildren<scannerSystem> ();
// pickUpsScreenInfoManager = mainPlayerComponentsManager.getPickUpsScreenInfo ();
// timeBulletManager = GetComponent<timeBullet> ();
// mapManager = mainPlayerComponentsManager.getMapSystem ();
// powerListManager = GetComponent<powersListManager> ();
// footStepSystem = mainPlayerComponentsManager.getFootStepManager ();
// weaponsManager = mainPlayerComponentsManager.getPlayerWeaponsManager ();
// inventorySystem = mainPlayerComponentsManager.getInventoryManager ();
// jetpackManager = mainPlayerComponentsManager.getJetpackSystem ();
// damageInScreenManager = mainPlayerComponentsManager.getDamageInScreen ();
// damageScreenManager = mainPlayerComponentsManager.getDamageScreenSystem ();
// flyManager = mainPlayerComponentsManager.getFlySystem ();
// friendListSystem = mainPlayerComponentsManager.getFriendListManager ();
// mainPlayerStatesManager = mainPlayerComponentsManager.getPlayerStatesManager ();
// headTrackManager = mainPlayerComponentsManager.getHeadTrack ();
// handOnSurfaceIKManager = GetComponentInChildren<handsOnSurfaceIKSystem> ();
// IKFootManager = GetComponentInChildren<IKFootSystem> ();
// climbLedgeManager = mainPlayerComponentsManager.getClimbLedgeSystem ();
// weaponListManager = GetComponent<weaponListManager> ();
// mainPlayerAbilitiesSystem = mainPlayerComponentsManager.getPlayerAbilitiesSystem ();
//}
}
#endif

View File

@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 4d04db457cd86be41aeaaecd4be42d6d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/featuresManager.cs
uploadId: 814740

View File

@@ -0,0 +1,179 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
public class filesChecker : MonoBehaviour
{
public string prefabsPath = "Assets/Game Kit Controller/Prefabs/Inventory/Usable";
public bool showObjectListInfoPrint;
public bool showOnlyUncentererdInfo;
public bool showUnscaledPrint;
public bool searchOnSubFolders;
[Space]
[Space]
public bool resetTransformValues;
public bool resetScaleValues;
[Space]
[Space]
public bool checkForAudioSource;
public bool showOnlyMP3Source;
public bool checkSoundName;
public string soundNameToCheck;
public void checkPrefabs ()
{
#if UNITY_EDITOR
if (!Directory.Exists (prefabsPath)) {
Debug.Log ("WARNING: " + prefabsPath + " path doesn't exist, make sure the path is from an existing folder in the project");
return;
}
string [] search_results = null;
if (searchOnSubFolders) {
search_results = System.IO.Directory.GetFiles (prefabsPath, "*.prefab", System.IO.SearchOption.AllDirectories);
} else {
search_results = System.IO.Directory.GetFiles (prefabsPath, "*.prefab");
}
print (search_results.Length + " objects found");
int positionCentered = 0;
int rotationCentered = 0;
int scaleCentered = 0;
int itemsCentered = 0;
if (search_results.Length > 0) {
foreach (string file in search_results) {
//must convert file path to relative-to-unity path (and watch for '\' character between Win/Mac)
GameObject currentPrefab = UnityEditor.AssetDatabase.LoadAssetAtPath (file, typeof (GameObject)) as GameObject;
if (currentPrefab != null) {
if (showObjectListInfoPrint) {
print (currentPrefab.name + " " +
currentPrefab.transform.position + " " +
currentPrefab.transform.eulerAngles
+ " " + currentPrefab.transform.localScale);
}
if (checkForAudioSource) {
Component [] sourceList = currentPrefab.GetComponentsInChildren (typeof (AudioSource));
foreach (Component c in sourceList) {
AudioSource currentSource = c as AudioSource;
if (currentSource.clip != null) {
string clipPath = UnityEditor.AssetDatabase.GetAssetPath (currentSource.clip.GetInstanceID ());
bool showPrintResult = true;
if (showOnlyMP3Source) {
if (!clipPath.Contains ("mp3")) {
showPrintResult = false;
}
}
if (checkSoundName) {
if (!clipPath.Contains (soundNameToCheck)) {
showPrintResult = false;
}
}
if (showPrintResult) {
print (currentPrefab.name + " " + c.gameObject.name + " " + clipPath);
}
}
}
}
if (currentPrefab.transform.position != Vector3.zero) {
//print ("position not centered");
positionCentered++;
}
if (currentPrefab.transform.rotation != Quaternion.identity) {
//print ("rotation not centered");
rotationCentered++;
}
if (currentPrefab.transform.localScale != Vector3.one) {
// print ("scale not centered");
if (showUnscaledPrint) {
print ("SCALE " + currentPrefab.name + " " + currentPrefab.transform.localScale);
}
scaleCentered++;
}
if (currentPrefab.transform.position != Vector3.zero ||
currentPrefab.transform.rotation != Quaternion.identity ||
currentPrefab.transform.localScale != Vector3.one) {
} else {
itemsCentered++;
}
if (showOnlyUncentererdInfo) {
if (currentPrefab.transform.position != Vector3.zero ||
currentPrefab.transform.rotation != Quaternion.identity) {
print (currentPrefab.name + " " +
currentPrefab.transform.position + " " +
currentPrefab.transform.eulerAngles);
}
}
if (resetTransformValues) {
currentPrefab.transform.position = Vector3.zero;
currentPrefab.transform.rotation = Quaternion.identity;
}
if (resetScaleValues) {
currentPrefab.transform.localScale = Vector3.one;
}
} else {
Debug.Log ("WARNING: something went wrong when trying to get the prefab in the path " + file);
}
}
print ("\n\n\n");
print ("objects position not centered properly " + positionCentered);
print ("objects rotation not centered properly " + rotationCentered);
print ("objects scale not centered properly " + scaleCentered);
print ("objects centered " + itemsCentered);
if (resetTransformValues) {
GKC_Utils.refreshAssetDatabase ();
}
} else {
Debug.Log ("Shield prefab not found in path " + prefabsPath);
}
// GameObject [] prefabs = Resources.LoadAll<GameObject> ("Game Kit Controller/Prefabs/Inventory/Usables");
#endif
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 42073080cefef514aae644c66a12f588
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/filesChecker.cs
uploadId: 814740

View File

@@ -0,0 +1,141 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class flyingTurretSystem : MonoBehaviour
{
[Header ("Turret Settings")]
[Space]
public bool flyingTurretEnabled = true;
public bool setManualFireOnTurretEnabled;
public bool manualFireInputEnabled;
public bool reactivateAutoShootAfterDelay;
public float delayToReactivateAutoShoot;
public Transform currentCameraTransformDirection;
[Space]
[Header ("Debug")]
[Space]
public bool flyingTurretActive;
public bool manualControlActive;
[Space]
[Header ("Components")]
[Space]
public GameObject flyingTurretObjectPrefab;
public GameObject flyingTurretObject;
public Transform objectToFollow;
public AITurret currentAITurret;
public void enableOrDisableFlyingTurret ()
{
setFlyingTurretActiveState (!flyingTurretActive);
}
public void setFlyingTurretActiveState (bool state)
{
flyingTurretActive = state;
if (flyingTurretObject == null) {
flyingTurretObject = (GameObject)Instantiate (flyingTurretObjectPrefab, objectToFollow.position, objectToFollow.rotation);
followObjectPositionUpdateSystem currentFollowObjectPositionUpdateSystem = flyingTurretObject.GetComponentInChildren<followObjectPositionUpdateSystem> ();
if (currentFollowObjectPositionUpdateSystem != null) {
currentFollowObjectPositionUpdateSystem.setObjectToFollow (objectToFollow);
}
currentAITurret = flyingTurretObject.GetComponentInChildren<AITurret> ();
}
if (flyingTurretObject != null) {
if (state) {
flyingTurretObject.SetActive (state);
}
if (currentAITurret != null) {
currentAITurret.setNewTurretAttacker (objectToFollow.gameObject);
enableOrDisableManualStateOnTurret (setManualFireOnTurretEnabled);
if (state) {
if (setManualFireOnTurretEnabled) {
currentAITurret.setNewCurrentCameraTransformDirection (currentCameraTransformDirection);
}
}
manualControlActive = manualFireInputEnabled;
if (manualFireInputEnabled) {
if (state) {
if (!currentAITurret.weaponsActive) {
currentAITurret.inputSetWeaponsState ();
}
} else {
enableOrDisableManualFireOnTurret (false);
}
}
}
if (!state) {
flyingTurretObject.SetActive (state);
}
}
}
public void enableOrDisableManualFireOnTurret (bool state)
{
if (flyingTurretActive) {
if (manualFireInputEnabled) {
if (currentAITurret != null) {
if (state) {
if (!currentAITurret.controlOverriden) {
currentAITurret.overrideTurretControlState (true);
}
if (!currentAITurret.weaponsActive) {
currentAITurret.inputSetWeaponsState ();
}
}
currentAITurret.inputSetShootState (state);
if (!state) {
if (reactivateAutoShootAfterDelay) {
currentAITurret.disableOverrideAfterDelay (delayToReactivateAutoShoot);
}
}
}
}
}
}
public void enableOrDisableManualStateOnTurret (bool state)
{
if (currentAITurret != null) {
currentAITurret.overrideTurretControlState (state);
manualControlActive = state;
}
}
public void inputToggleManualFire ()
{
if (flyingTurretActive) {
enableOrDisableManualStateOnTurret (!manualControlActive);
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 7242751c6a8c6324e9d1b4ee4051e2d6
timeCreated: 1624090084
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/flyingTurretSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,125 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class followObjectPositionSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool followObjectActive = true;
public Transform objectToFollow;
public bool followPosition = true;
public bool followRotation = true;
public Transform mainTransform;
public bool checkIfObjectToFollowNull;
[Space]
[Header ("Debug")]
[Space]
public bool objectToFollowLocated;
public bool showDebugPrint;
bool initialized;
void Start ()
{
initializeComponents ();
}
void initializeComponents ()
{
if (!initialized) {
if (mainTransform == null) {
mainTransform = transform;
}
objectToFollowLocated = objectToFollow != null;
initialized = true;
}
}
void FixedUpdate ()
{
if (followObjectActive && objectToFollowLocated) {
if (checkIfObjectToFollowNull) {
if (objectToFollow == null) {
followObjectActive = false;
return;
}
}
if (followPosition && followRotation) {
mainTransform.SetPositionAndRotation (objectToFollow.position, objectToFollow.rotation);
} else {
if (followPosition) {
mainTransform.position = objectToFollow.position;
}
if (followRotation) {
mainTransform.rotation = objectToFollow.rotation;
}
}
if (showDebugPrint) {
print ("Following target active");
}
}
}
public void setFollowObjectActiveState (bool state)
{
followObjectActive = state;
}
public void setEnabledState (bool state)
{
enabled = state;
}
public void enabledStateAndUpdatePositionOnce ()
{
setEnabledState (true);
updatePositionOnce ();
}
public void updatePositionOnce ()
{
if (objectToFollow == null) {
return;
}
if (followPosition) {
mainTransform.position = objectToFollow.position;
}
if (followRotation) {
mainTransform.rotation = objectToFollow.rotation;
}
}
public void setObjectToFollow (Transform newObject)
{
objectToFollow = newObject;
}
public void setObjectToFollowFromEditor (Transform newObject)
{
setObjectToFollow (newObject);
updateComponent ();
}
public void updateComponent ()
{
GKC_Utils.updateComponent (this);
GKC_Utils.updateDirtyScene ("Set Object To Follow From Editor", gameObject);
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 7ceb6c90a67d825418766c477c318629
timeCreated: 1555205592
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/followObjectPositionSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,90 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class followObjectPositionUpdateSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool followObjectActive = true;
public bool followPosition = true;
public bool followRotation = true;
public Transform objectToFollow;
public Transform mainTransform;
[Space]
[Header ("Debug")]
[Space]
public bool objectToFollowLocated;
bool initialized;
void Start ()
{
initializeComponents ();
}
void initializeComponents ()
{
if (!initialized) {
if (mainTransform == null) {
mainTransform = transform;
}
objectToFollowLocated = objectToFollow != null;
initialized = true;
}
}
void Update ()
{
if (followObjectActive && objectToFollowLocated) {
if (followPosition && followRotation) {
mainTransform.SetPositionAndRotation (objectToFollow.position, objectToFollow.rotation);
} else {
if (followPosition) {
mainTransform.position = objectToFollow.position;
}
if (followRotation) {
mainTransform.rotation = objectToFollow.rotation;
}
}
}
}
public void setFollowObjectActiveState (bool state)
{
followObjectActive = state;
}
public void setObjectToFollow (Transform newObject)
{
objectToFollow = newObject;
}
public void setEnabledState (bool state)
{
enabled = state;
}
public void setObjectToFollowFromEditor (Transform newObject)
{
setObjectToFollow (newObject);
updateComponent ();
}
public void updateComponent ()
{
GKC_Utils.updateComponent (this);
GKC_Utils.updateDirtyScene ("Set Object To Follow From Editor", gameObject);
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 9681d879f877b9f4ab6c432db364f7ba
timeCreated: 1587451806
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/followObjectPositionUpdateSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,214 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class graphicQualitySettingsSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool graphicSettingsEnabled = true;
public bool canChangeGameWindowedStateEnabled = true;
public bool canChangeAntiAliasingEnabled = true;
[Space]
[Header ("Debug")]
[Space]
public int currentSettingIndex;
public int currentResolutionIndex;
public bool showDebugPrint;
[Space]
[Header ("Quality Settings")]
[Space]
public List<qualitySettingInfo> qualitySettingInfoList = new List<qualitySettingInfo> ();
[Space]
[Header ("Resolution Settings")]
[Space]
public List<resolutionSettingInfo> resolutionSettingInfoList = new List<resolutionSettingInfo> ();
[Space]
[Header ("Events Settings")]
[Space]
public bool useEventsOnResolutionChange;
public UnityEvent eventOnResolutionChange;
public void setGraphicQualityValue (string newValue)
{
if (!graphicSettingsEnabled) {
return;
}
int currentIndex = qualitySettingInfoList.FindIndex (s => s.Name.Equals (newValue));
if (currentIndex > -1) {
qualitySettingInfo currentQualitySettingInfo = qualitySettingInfoList [currentIndex];
if (!currentQualitySettingInfo.isCurrentSetting) {
for (int i = 0; i < qualitySettingInfoList.Count; i++) {
qualitySettingInfoList [i].isCurrentSetting = false;
}
currentQualitySettingInfo.isCurrentSetting = true;
currentSettingIndex = currentIndex;
if (QualitySettings.GetQualityLevel () != currentQualitySettingInfo.qualityValue) {
QualitySettings.SetQualityLevel (currentQualitySettingInfo.qualityValue);
if (currentQualitySettingInfo.useEventsOnStateChange) {
currentQualitySettingInfo.eventOnStateChange.Invoke ();
}
}
if (showDebugPrint) {
print ("Quality Settings configured as " + currentQualitySettingInfo.Name);
}
}
} else {
if (showDebugPrint) {
print ("Quality Settings not found " + newValue);
}
}
}
public void setScreenResolution (string newValue)
{
if (!graphicSettingsEnabled) {
return;
}
int currentIndex = resolutionSettingInfoList.FindIndex (s => s.Name.Equals (newValue));
if (currentIndex > -1) {
resolutionSettingInfo currentResolutionSettingInfo = resolutionSettingInfoList [currentIndex];
if (!currentResolutionSettingInfo.isCurrentSetting) {
for (int i = 0; i < resolutionSettingInfoList.Count; i++) {
resolutionSettingInfoList [i].isCurrentSetting = false;
}
currentResolutionSettingInfo.isCurrentSetting = true;
currentResolutionIndex = currentIndex;
if (Screen.currentResolution.width != currentResolutionSettingInfo.resolutionValues.x ||
Screen.currentResolution.height != currentResolutionSettingInfo.resolutionValues.y) {
Screen.SetResolution ((int)currentResolutionSettingInfo.resolutionValues.x, (int)currentResolutionSettingInfo.resolutionValues.y, true);
}
if (currentResolutionSettingInfo.useEventsOnStateChange) {
currentResolutionSettingInfo.eventOnStateChange.Invoke ();
}
if (useEventsOnResolutionChange) {
eventOnResolutionChange.Invoke ();
}
if (showDebugPrint) {
print ("Resolution Settings configured as " + currentResolutionSettingInfo.Name);
}
}
} else {
if (showDebugPrint) {
print ("Resolution Settings not found " + newValue);
}
}
}
public void setGameWindowedState (bool state)
{
if (!graphicSettingsEnabled) {
return;
}
if (!canChangeGameWindowedStateEnabled) {
return;
}
resolutionSettingInfo currentResolutionSettingInfo = resolutionSettingInfoList [currentResolutionIndex];
if (Screen.fullScreen != state) {
Screen.SetResolution ((int)currentResolutionSettingInfo.resolutionValues.x, (int)currentResolutionSettingInfo.resolutionValues.y, state);
}
if (showDebugPrint) {
print ("Windowed Settings configured as " + state);
}
}
public void setAntiAliasingState (string valueString)
{
int newValue = -1;
if (int.TryParse (valueString, out newValue)) {
setAntiAliasingState (newValue);
}
}
public void setAntiAliasingState (int newValue)
{
if (!graphicSettingsEnabled) {
return;
}
if (!canChangeAntiAliasingEnabled) {
return;
}
if (QualitySettings.antiAliasing != newValue) {
QualitySettings.antiAliasing = newValue;
}
if (showDebugPrint) {
print ("AntiAliasing Settings configured as " + newValue);
}
}
[System.Serializable]
public class qualitySettingInfo
{
public string Name;
public int qualityValue;
public bool isCurrentSetting;
[Space]
[Space]
public bool useEventsOnStateChange;
public UnityEvent eventOnStateChange;
}
[System.Serializable]
public class resolutionSettingInfo
{
public string Name;
public Vector2 resolutionValues;
public bool isCurrentSetting;
[Space]
[Space]
public bool useEventsOnStateChange;
public UnityEvent eventOnStateChange;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 37d928550a5af8c428d593ed6a88fe96
timeCreated: 1653842482
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/graphicQualitySettingsSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class headExplodeExample : MonoBehaviour
{
public bool useTimeBullet = true;
public float timeBulletDuration = 3;
public float timeScale = 0.2f;
public Transform headTransform;
public void explode ()
{
// print ("function to explode head here");
if (useTimeBullet) {
GKC_Utils.activateTimeBulletXSeconds (timeBulletDuration, timeScale);
}
if (headTransform != null) {
headTransform.localScale = Vector3.zero;
}
}
public void explodeBodyPart (Transform objectToExplode)
{
if (objectToExplode != null) {
objectToExplode.localScale = Vector3.zero;
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 76cdc765208b0dd4b9925eba4dd11c51
timeCreated: 1515638964
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/headExplodeExample.cs
uploadId: 814740

View File

@@ -0,0 +1,204 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class hideBodyPartOnCharacterSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool hideBodyPartEnabled = true;
public bool useTimeBullet = true;
public float timeBulletDuration = 3;
public float timeScale = 0.2f;
[Space]
[Header ("Other Settings")]
[Space]
public bool storeHiddenBodyPartsEnabled;
[Space]
[Header ("Debug")]
[Space]
public Transform currentBodyPartToHide;
public List<Transform> storedHiddentBodyPartsList = new List<Transform> ();
[Space]
[Header ("Components")]
[Space]
public Transform characterTransform;
public void activateBodyPartFromMountPoint (string mountPointPartName)
{
setActiveStateBodyPartFromMountPoint (mountPointPartName, true);
}
public void deactivateBodyPartFromMountPoint (string mountPointPartName)
{
setActiveStateBodyPartFromMountPoint (mountPointPartName, false);
}
public void setActiveStateBodyPartFromMountPoint (string mountPointPartName, bool state)
{
if (characterTransform != null) {
Transform newBodyPart = GKC_Utils.getHumanBoneMountPointTransformByName (mountPointPartName, characterTransform);
if (newBodyPart != null) {
if (newBodyPart.gameObject.activeSelf != state) {
newBodyPart.gameObject.SetActive (state);
}
if (!state) {
if (storeHiddenBodyPartsEnabled) {
if (!storedHiddentBodyPartsList.Contains (newBodyPart)) {
storedHiddentBodyPartsList.Add (newBodyPart);
}
}
}
}
}
}
public void setEnabledStateColliderBodyPartFromMountPoint (string mountPointPartName)
{
setActiveStateColliderBodyPartFromMountPoint (mountPointPartName, true);
}
public void setDisabledStateColliderBodyPartFromMountPoint (string mountPointPartName)
{
setActiveStateColliderBodyPartFromMountPoint (mountPointPartName, false);
}
public void setActiveStateColliderBodyPartFromMountPoint (string mountPointPartName, bool state)
{
if (characterTransform != null) {
Transform newBodyPart = GKC_Utils.getHumanBoneMountPointTransformByName (mountPointPartName, characterTransform);
if (newBodyPart != null) {
Collider currentCollider = newBodyPart.GetComponent<Collider> ();
if (currentCollider != null && currentCollider.enabled != state) {
currentCollider.enabled = state;
}
}
}
}
public void hideBodyPartFromMountPoint (string mountPointPartName)
{
if (characterTransform != null) {
Transform newBodyPart = GKC_Utils.getHumanBoneMountPointTransformByName (mountPointPartName, characterTransform);
if (newBodyPart != null) {
hideBodyPart (newBodyPart);
}
}
}
public void hideBodyPartFromMountPointWithoutBulletTimeCheck (string mountPointPartName)
{
if (characterTransform != null) {
currentBodyPartToHide = GKC_Utils.getHumanBoneMountPointTransformByName (mountPointPartName, characterTransform);
if (currentBodyPartToHide != null) {
setBodyPartScale ();
}
}
}
public void hideBodyPart ()
{
if (useTimeBullet) {
GKC_Utils.activateTimeBulletXSeconds (timeBulletDuration, timeScale);
}
setBodyPartScale ();
}
public void hideBodyPart (Transform newBodyPart)
{
currentBodyPartToHide = newBodyPart;
hideBodyPart ();
}
public void hideBodyPartWithoutBulletTimeCheck ()
{
setBodyPartScale ();
}
public void hideBodyPartWithoutBulletTimeCheck (Transform newBodyPart)
{
currentBodyPartToHide = newBodyPart;
setBodyPartScale ();
}
public void setBodyPartScale ()
{
if (!hideBodyPartEnabled) {
return;
}
if (currentBodyPartToHide != null) {
currentBodyPartToHide.localScale = Vector3.zero;
if (storeHiddenBodyPartsEnabled) {
if (!storedHiddentBodyPartsList.Contains (currentBodyPartToHide)) {
storedHiddentBodyPartsList.Add (currentBodyPartToHide);
}
}
}
}
public void resetHiddenBodyPartsList ()
{
if (storeHiddenBodyPartsEnabled) {
for (int i = 0; i < storedHiddentBodyPartsList.Count; i++) {
if (storedHiddentBodyPartsList [i] != null) {
if (storedHiddentBodyPartsList [i].localScale == Vector3.zero) {
storedHiddentBodyPartsList [i].localScale = Vector3.one;
}
if (!storedHiddentBodyPartsList [i].gameObject.activeSelf) {
storedHiddentBodyPartsList [i].gameObject.SetActive (true);
}
}
}
storedHiddentBodyPartsList.Clear ();
}
}
public void setUseTimeBulletValue (bool state)
{
useTimeBullet = state;
}
public void setHideBodyPartEnabledState (bool state)
{
hideBodyPartEnabled = state;
}
public void setUseTimeBulletValueFromEditor (bool state)
{
setUseTimeBulletValue (state);
updateComponent ();
}
public void setHideBodyPartEnabledStateFromEditor (bool state)
{
setHideBodyPartEnabledState (state);
updateComponent ();
}
void updateComponent ()
{
GKC_Utils.updateComponent (this);
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: d4b08c5a85436dc4eb1657f9d69afe9b
timeCreated: 1604450208
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/hideBodyPartOnCharacterSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,188 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ignoreCollisionHelper : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool collisionCheckEnabled = true;
public LayerMask layerToIgnore;
public bool ignoreByTagEnabled;
public List<string> tagToIgnoreList = new List<string> ();
public bool storeObjectsIgnored;
[Space]
[Header ("Debug")]
[Space]
public bool showDebugPrint;
public List<Collider> objectsIgnoredList = new List<Collider> ();
public bool objectsStored;
[Space]
[Header ("Component")]
[Space]
public Collider mainCollider;
bool mainColliderLocated;
Coroutine componentTemporaryCoroutine;
Coroutine reactivateWithDelayCoroutine;
void OnCollisionEnter (Collision col)
{
if (!collisionCheckEnabled) {
return;
}
GameObject objectDetected = col.gameObject;
bool ignoreColliderResult = false;
if ((1 << objectDetected.layer & layerToIgnore.value) == 1 << objectDetected.layer) {
ignoreColliderResult = true;
}
if (!ignoreColliderResult) {
if (ignoreByTagEnabled) {
if (tagToIgnoreList.Contains (objectDetected.tag)) {
ignoreColliderResult = true;
}
}
}
if (ignoreColliderResult) {
if (!mainColliderLocated) {
mainColliderLocated = mainCollider != null;
if (!mainColliderLocated) {
mainCollider = GetComponent<Collider> ();
mainColliderLocated = mainCollider != null;
}
}
if (!mainColliderLocated) {
return;
}
Physics.IgnoreCollision (col.collider, mainCollider, true);
if (showDebugPrint) {
print ("collision ignored with " + col.collider.name);
}
if (storeObjectsIgnored) {
if (!objectsIgnoredList.Contains (col.collider)) {
objectsIgnoredList.Add (col.collider);
objectsStored = true;
}
}
}
}
public void setCollisionCheckEnabledState (bool state)
{
collisionCheckEnabled = state;
}
public void reactivateIgnoredCollisionsStored ()
{
if (objectsStored) {
for (int i = 0; i < objectsIgnoredList.Count; i++) {
if (objectsIgnoredList [i] != null) {
Physics.IgnoreCollision (objectsIgnoredList [i], mainCollider, false);
}
}
clearObjectsIgnoredList ();
}
}
public void clearObjectsIgnoredList ()
{
objectsIgnoredList.Clear ();
objectsStored = false;
}
public void enableComponentTemporaryAndReactivateCollisionsStoredWithDelay (float duration)
{
enableComponentTemporary (duration);
reactivateCollisionsStoredWithDelay (duration);
}
public void enableComponentTemporary (float duration)
{
enableOrDisableComponentTemporary (true, duration);
}
public void disableComponentTemporary (float duration)
{
enableOrDisableComponentTemporary (false, duration);
}
public void enableOrDisableComponentTemporary (bool state, float duration)
{
if (state) {
collisionCheckEnabled = true;
stopReactivateCollisionsStoredWithDelayCoroutine ();
componentTemporaryCoroutine = StartCoroutine (enableComponentTemporaryCoroutine (duration));
} else {
stopEnableComponentTemporaryCoroutine ();
collisionCheckEnabled = false;
}
}
void stopEnableComponentTemporaryCoroutine ()
{
if (componentTemporaryCoroutine != null) {
StopCoroutine (componentTemporaryCoroutine);
}
}
IEnumerator enableComponentTemporaryCoroutine (float duration)
{
WaitForSeconds delay = new WaitForSeconds (duration);
yield return delay;
collisionCheckEnabled = false;
}
public void reactivateCollisionsStoredWithDelay (float duration)
{
reactivateWithDelayCoroutine = StartCoroutine (reactivateCollisionsStoredWithDelayCoroutine (duration));
}
void stopReactivateCollisionsStoredWithDelayCoroutine ()
{
if (reactivateWithDelayCoroutine != null) {
StopCoroutine (reactivateWithDelayCoroutine);
}
}
IEnumerator reactivateCollisionsStoredWithDelayCoroutine (float duration)
{
WaitForSeconds delay = new WaitForSeconds (duration);
yield return delay;
reactivateIgnoredCollisionsStored ();
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 05a38d8ad4173bd4799857620f10aef2
timeCreated: 1625373547
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/ignoreCollisionHelper.cs
uploadId: 814740

View File

@@ -0,0 +1,76 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ignoreCollisionSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool ignoreCollisionEnabled = true;
public bool useColliderList;
public List<Collider> colliderList = new List<Collider> ();
[Space]
public bool activateCheckOnStart;
public Collider colliderToIgnore;
public bool forceIgnoreCollisionInBetweenObjectsOnColliderList;
[Space]
[Header ("Components")]
[Space]
public Collider mainCollider;
void Start ()
{
if (activateCheckOnStart) {
activateIgnoreCollision (colliderToIgnore);
}
}
public void activateIgnoreCollision (Collider objectToIgnore)
{
if (ignoreCollisionEnabled) {
if (useColliderList) {
if (objectToIgnore != null) {
ignoreCollisionOnCollider (objectToIgnore);
}
if (forceIgnoreCollisionInBetweenObjectsOnColliderList) {
int colliderListCount = colliderList.Count;
for (int i = 0; i < colliderListCount; i++) {
ignoreCollisionOnCollider (colliderList [i]);
}
}
} else {
if (objectToIgnore == null) {
return;
}
if (mainCollider != null) {
Physics.IgnoreCollision (objectToIgnore, mainCollider, true);
}
}
}
}
void ignoreCollisionOnCollider (Collider newCollider)
{
int colliderListCount = colliderList.Count;
for (int i = 0; i < colliderListCount; i++) {
if (colliderList [i] != null && colliderList [i] != newCollider) {
Physics.IgnoreCollision (newCollider, colliderList [i], true);
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: e22cf6b61dd5ac14396727cd81f1fb96
timeCreated: 1588588551
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/ignoreCollisionSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,238 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using System.IO;
using UnityEngine.EventSystems;
#if UNITY_EDITOR
using UnityEditor;
public class initialPopUpWindow : EditorWindow
{
GUISkin guiSkin;
Texture2D GKCLogo = null;
Vector2 rectSize = new Vector2 (670, 690);
GUIStyle titleStyle = new GUIStyle ();
GUIStyle style = new GUIStyle ();
Vector2 screenResolution;
float windowHeightPercentage = 0.7f;
float minHeight = 500f;
Vector2 scrollPos1;
public bool checkForPresetsActive;
Vector2 previousRectSize;
float maxLayoutWidht = 200;
Rect windowRect = new Rect ();
[MenuItem ("Game Kit Controller/Initial Pop Up", false, 601)]
public static void AboutGKC ()
{
GetWindow<initialPopUpWindow> ();
}
string messageText = "IMPORTANT: \n\n" +
" * TAGS AND LAYERS AND INPUT SETTINGS IMPORT\n\n" +
"Make sure the TAG/LAYERS and INPUT have been imported properly. " +
"You can find the TAGMANAGER and INPUTMANAGER presets on the folder: \n\n" +
"Assets->Game Kit Controller->Presets \n\n" +
"Press each one in order for these settings to be added automatically to the project." +
"You can also import these presets with the button at the end of this window." +
"\n\n" +
" * CHARACTERS FALLING IN GROUND OR MISSING ANIMATIONS\n\n" +
"You may notice that the player or AI is crossing " +
"the ground or not playing some animations properly.\n\n" +
"It is not a bug, make sure to import the animation " +
"package from the public repository of the asset.\n\n" +
"It is better explained on the doc, it is a group " +
"of animations used on the action system" +
" examples and the melee combat, just as placeholder, " +
"so you can replace them at any moment, as any animation " +
"will work properly.\n\n" +
"Import the package, close and open unity " +
"and voila, all configured by it self.\n\n" +
"You can use the alternative link for the animations package if you prefer.\n\n" +
"Also, you can import the slice system and buoyancy packages from the public repository.\n\n\n" +
"This message won't appear agin.";
void OnEnable ()
{
GKCLogo = (Texture2D)Resources.Load ("Logo_reworked", typeof(Texture2D));
screenResolution = new Vector2 (Screen.currentResolution.width, Screen.currentResolution.height);
float windowHeight = screenResolution.y * windowHeightPercentage;
windowHeight = Mathf.Clamp (windowHeight, minHeight, screenResolution.y);
rectSize = new Vector2 (670, windowHeight);
}
public void Init ()
{
}
void OnDisable ()
{
checkOnCloseWindow ();
}
void OnGUI ()
{
this.titleContent = new GUIContent ("GKC Initial Info");
this.minSize = rectSize;
EditorGUILayout.Space ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
GUILayout.BeginHorizontal ();
GUILayout.FlexibleSpace ();
GUILayout.Label (GKCLogo, GUILayout.MaxHeight (100));
GUILayout.FlexibleSpace ();
GUILayout.EndHorizontal ();
if (!guiSkin) {
guiSkin = Resources.Load ("GUI") as GUISkin;
}
GUI.skin = guiSkin;
GUILayout.BeginVertical ("window");
GUILayout.BeginHorizontal ("box");
GUILayout.FlexibleSpace ();
windowRect = GUILayoutUtility.GetLastRect ();
// windowRect.position = new Vector2 (0, windowRect.position.y);
windowRect.width = this.maxSize.x;
titleStyle.normal.textColor = Color.white;
titleStyle.fontStyle = FontStyle.Bold;
titleStyle.fontSize = 17;
titleStyle.alignment = TextAnchor.MiddleCenter;
GUILayout.Label ("Game Kit Controller Initial Info", titleStyle);
GUILayout.FlexibleSpace ();
GUILayout.EndHorizontal ();
GUILayout.BeginHorizontal ();
GUILayout.Label ("Window Height", EditorStyles.boldLabel, GUILayout.MaxWidth (maxLayoutWidht));
if (previousRectSize != rectSize) {
previousRectSize = rectSize;
this.maxSize = rectSize;
}
rectSize.y = EditorGUILayout.Slider (rectSize.y, minHeight, screenResolution.y, GUILayout.ExpandWidth (true));
GUILayout.EndHorizontal ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
style = new GUIStyle (EditorStyles.helpBox);
style.richText = true;
style.fontSize = 15;
style.fontStyle = FontStyle.Bold;
GUILayout.BeginHorizontal ();
scrollPos1 = EditorGUILayout.BeginScrollView (scrollPos1, false, false);
//EditorGUILayout.HelpBox ("", MessageType.Info);
EditorGUILayout.LabelField (messageText, style);
EditorGUILayout.EndScrollView ();
GUILayout.EndHorizontal ();
EditorGUILayout.Space ();
if (GUILayout.Button ("Public Repository")) {
Application.OpenURL ("https://github.com/sr3888/GKC-Public-Repository");
}
EditorGUILayout.Space ();
if (GUILayout.Button ("Alternative Package Google Drive Link")) {
Application.OpenURL ("https://drive.google.com/file/d/1lr6ReFs19bJu81B4t8sWfqMJqAxfzwwW/view?usp=sharing");
}
EditorGUILayout.Space ();
if (GUILayout.Button ("Tutorial To Use Generic Models")) {
Application.OpenURL ("https://www.youtube.com/watch?v=XABt9LvzRaY");
}
EditorGUILayout.Space ();
if (GUILayout.Button ("Apply InputManager & TagManager Presets Project Settings")) {
applyPresetSystem.GKCapplyProjectSettings ();
}
EditorGUILayout.Space ();
if (GUILayout.Button ("Close")) {
checkOnCloseWindow ();
this.Close ();
}
GUILayout.EndVertical ();
}
void checkOnCloseWindow ()
{
openInitialPopUpWindow mainOpenInitialPopUpWindow = FindObjectOfType<openInitialPopUpWindow> ();
if (mainOpenInitialPopUpWindow != null) {
mainOpenInitialPopUpWindow.setShowInitialPopWindowEnabledState (false);
GKC_Utils.updateComponent (mainOpenInitialPopUpWindow);
GKC_Utils.updateDirtyScene ("Update Initial Pop Up", mainOpenInitialPopUpWindow.gameObject);
}
mainManagerAdministrator mainMainManagerAdministrator = FindObjectOfType<mainManagerAdministrator> ();
if (mainMainManagerAdministrator != null) {
mainMainManagerAdministrator.setSpawnManagerOnAwakeDisableddByName ("INITIAL POP UP WINDOW");
}
if (checkForPresetsActive) {
applyPresetSystem.GKCapplyProjectSettings ();
checkForPresetsActive = false;
}
}
}
#endif

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 1154c446439b16c4183700203034f7d2
timeCreated: 1628553580
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/initialPopUpWindow.cs
uploadId: 814740

View File

@@ -0,0 +1,100 @@
using UnityEngine;
using System.Collections;
public class mechanismPart : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool enableRotation;
public int mechanimType;
public Vector3 rotateDirection;
public float rotationSpeed = 10;
[Space]
[Header ("Debug")]
[Space]
public bool gearActivated;
public bool rotatoryGearEngaged;
[Space]
[Header ("Objects Settings")]
[Space]
public GameObject rotor;
public GameObject gear;
grabbedObjectState currentGrabbedObject;
electronicDevice electronicDeviceManager;
void Start ()
{
electronicDeviceManager = GetComponent<electronicDevice> ();
}
void Update ()
{
//the script checks if the object on rails has been engaged
if (enableRotation && mechanimType == 0) {
rotor.transform.Rotate (rotateDirection * (-rotationSpeed * Time.deltaTime));
}
if (enableRotation && mechanimType == 1) {
if (rotatoryGearEngaged && gear != null) {
gear.transform.Rotate (new Vector3 (0, 0, rotationSpeed * Time.deltaTime));
rotor.transform.Rotate (rotateDirection * (-rotationSpeed * Time.deltaTime));
}
if (gear && gearActivated) {
float currentAngle = Vector3.SignedAngle (gear.transform.up, transform.up, gear.transform.forward);
// if (Mathf.Abs (gear.transform.localEulerAngles.z) > 350) {
if (Mathf.Abs (currentAngle) < 10) {
//if the object is being carried by the player, make him drop it
currentGrabbedObject = gear.GetComponent<grabbedObjectState> ();
if (currentGrabbedObject != null) {
GKC_Utils.dropObject (currentGrabbedObject.getCurrentHolder (), gear);
}
gear.tag = "Untagged";
gearActivated = false;
rotatoryGearEngaged = true;
electronicDeviceManager.unlockObject ();
}
}
}
}
public void setVelocity (float v)
{
rotationSpeed = v;
}
public void setEnableRotationState (bool state)
{
enableRotation = state;
}
public void setGearActivatedState (bool state)
{
gearActivated = state;
rotatoryGear currentRotatoryGear = gear.GetComponent<rotatoryGear> ();
if (currentRotatoryGear != null) {
currentRotatoryGear.setRotationEnabledState (true);
gear.tag = "box";
}
}
}

View File

@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 5f74181766130a34cb323c4660ebb767
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/mechanismPart.cs
uploadId: 814740

View File

@@ -0,0 +1,79 @@
using UnityEngine;
using System.Collections;
public class moveObjectLateUpdate : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool movementEnabled = true;
public float speed;
public float moveAmount;
public Vector3 direction = Vector3.up;
public bool useLocalPosition;
[Space]
[Header ("Debug")]
[Space]
public Vector3 originalPosition;
Transform mainTransform;
Vector3 vectorRight = Vector3.right;
Vector3 vectorUp = Vector3.up;
Vector3 vectorForward = Vector3.forward;
void Start ()
{
mainTransform = transform;
if (useLocalPosition) {
originalPosition = mainTransform.localPosition;
} else {
originalPosition = mainTransform.position;
}
}
void LateUpdate ()
{
if (movementEnabled) {
if (useLocalPosition) {
mainTransform.localPosition = originalPosition +
((Mathf.Cos (Time.time * speed)) / 2) * moveAmount *
(direction.x * vectorRight + direction.y * vectorUp + direction.z * vectorForward);
} else {
mainTransform.position = originalPosition +
((Mathf.Cos (Time.time * speed)) / 2) * moveAmount *
(direction.x * mainTransform.right + direction.y * mainTransform.up + direction.z * mainTransform.forward);
}
}
}
public void enableMovement ()
{
setMovementEnabledState (true);
}
public void disableMovement ()
{
setMovementEnabledState (false);
}
public void setMovementEnabledState (bool state)
{
movementEnabled = state;
}
public void changeMovementEnabledState ()
{
setMovementEnabledState (!movementEnabled);
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: a3d6d4cf1d236e04391bd75c502a939e
timeCreated: 1698063329
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/moveObjectLateUpdate.cs
uploadId: 814740

View File

@@ -0,0 +1,126 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class moveObjectSmoothlySystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool moveObjectSystemEnabled = true;
public Transform transformToMove;
[Space]
[Header ("Position State List Settings")]
[Space]
public List<objectPositionStateInfo> objectPositionStateInfoList = new List<objectPositionStateInfo> ();
objectPositionStateInfo currentObjectPositionStateInfo;
Coroutine movementCoroutine;
public void moveObjectToPosition (string positionName)
{
if (!moveObjectSystemEnabled) {
return;
}
stopMoveObjectToPositionCoroutine ();
if (gameObject.activeInHierarchy) {
movementCoroutine = StartCoroutine (moveObjectToPositionCoroutine (positionName));
}
}
public void stopMoveObjectToPositionCoroutine ()
{
if (movementCoroutine != null) {
StopCoroutine (movementCoroutine);
}
}
IEnumerator moveObjectToPositionCoroutine (string positionName)
{
bool isNewPosition = true;
int positionStateIndex = -1;
int objectPositionStateInfoListCount = objectPositionStateInfoList.Count;
for (int i = 0; i < objectPositionStateInfoListCount; i++) {
if (objectPositionStateInfoList [i].Name == positionName) {
if (objectPositionStateInfoList [i].isCurrentPosition) {
isNewPosition = false;
} else {
objectPositionStateInfoList [i].isCurrentPosition = true;
}
positionStateIndex = i;
currentObjectPositionStateInfo = objectPositionStateInfoList [i];
} else {
objectPositionStateInfoList [i].isCurrentPosition = false;
}
}
if (isNewPosition && positionStateIndex > -1) {
if (transformToMove == null) {
transformToMove = transform;
}
if (currentObjectPositionStateInfo.useDelayToMoveObject) {
yield return new WaitForSeconds (currentObjectPositionStateInfo.delayToMoveObject);
}
float dist = GKC_Utils.distance (transformToMove.localPosition, currentObjectPositionStateInfo.targetPosition);
float duration = dist / currentObjectPositionStateInfo.movementSpeed;
float translateTimer = 0;
float teleportTimer = 0;
bool targetReached = false;
while (!targetReached) {
translateTimer += Time.deltaTime / duration;
transformToMove.localPosition = Vector3.Lerp (transformToMove.localPosition, currentObjectPositionStateInfo.targetPosition, translateTimer);
teleportTimer += Time.deltaTime;
if ((GKC_Utils.distance (transformToMove.localPosition, currentObjectPositionStateInfo.targetPosition) < 0.03f) || teleportTimer > (duration + 1)) {
targetReached = true;
}
yield return null;
}
}
}
[System.Serializable]
public class objectPositionStateInfo
{
[Header ("Main Settings")]
[Space]
public string Name;
public Vector3 targetPosition;
public float movementSpeed;
[Space]
[Header ("Other Settings")]
[Space]
public bool useDelayToMoveObject;
public float delayToMoveObject;
[Space]
[Header ("Debug")]
[Space]
public bool isCurrentPosition;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: f221ceafd2c01464e91097b3d9dee24f
timeCreated: 1554039786
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/moveObjectSmoothlySystem.cs
uploadId: 814740

View File

@@ -0,0 +1,242 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.Events;
public class nonEssentialCharacterElementsManager : MonoBehaviour
{
public List<objectToSelectInfo> objectToSelectInfoList = new List<objectToSelectInfo> ();
[TextArea (3, 15)]
public string explanation = "You can remove any of the elements on this list which you " +
"don't want to use on this character, as all of them are non essential for the proper " +
"work of the character. Press R if you want to remove just certain elements of the list.\n\n" +
"Buttons usage:\n\n" +
"x-remove element of the list\n" +
"v ^-change element position on the list\n" +
"o-select object on the list\n" +
"R-destroy object\n" +
"E-enable object\n" +
"D-disable object";
public List<string> objectSearchResultList = new List<string> ();
public string objectSearcherName = "";
public bool searchObjectsActive;
public void clearObjectsSearcResultList ()
{
objectSearchResultList.Clear ();
objectSearcherName = "";
searchObjectsActive = false;
}
public void showObjectsBySearchName ()
{
if (objectSearcherName != null && objectSearcherName != "") {
objectSearchResultList.Clear ();
searchObjectsActive = true;
string currentTextToSearch = objectSearcherName;
if (currentTextToSearch != "") {
currentTextToSearch = currentTextToSearch.ToLower ();
int objectToSelectInfoListCount = objectToSelectInfoList.Count;
for (int i = 0; i < objectToSelectInfoListCount; i++) {
objectToSelectInfo currentObjectToSelectInfo = objectToSelectInfoList [i];
if (currentObjectToSelectInfo.Name != "") {
string objectName = currentObjectToSelectInfo.Name.ToLower ();
if (objectName.Contains (currentTextToSearch) ||
objectName.Equals (currentTextToSearch)) {
if (!objectSearchResultList.Contains (currentObjectToSelectInfo.Name)) {
objectSearchResultList.Add (currentObjectToSelectInfo.Name);
}
}
}
}
}
}
}
public void selectObjectByName (string objectName)
{
int curretIndex = objectToSelectInfoList.FindIndex (s => s.Name.Equals (objectName));
if (curretIndex > -1) {
selectObjectByIndex (curretIndex);
}
}
public void selectObjectByIndex (int index)
{
objectToSelectInfo currentObjectToSelectInfo = objectToSelectInfoList [index];
if (currentObjectToSelectInfo.objectToSelect != null) {
GKC_Utils.setActiveGameObjectInEditor (currentObjectToSelectInfo.objectToSelect);
}
}
public void removeObjectByName (string objectName)
{
int curretIndex = objectToSelectInfoList.FindIndex (s => s.Name.Equals (objectName));
if (curretIndex > -1) {
removeObjectByIndex (curretIndex, true);
}
}
public void destroyAllObjects ()
{
GKC_Utils.unpackPrefabObjectByCheckingTransformRoot (gameObject);
int objectToSelectInfoListCount = objectToSelectInfoList.Count;
for (int i = 0; i < objectToSelectInfoListCount; i++) {
removeObjectByIndex (i, false);
}
objectToSelectInfoList.Clear ();
updateComponent ();
}
public void removeObjectByIndex (int index, bool destroyingSingleObject)
{
bool updateComponentResult = false;
objectToSelectInfo currentObjectToSelectInfo = objectToSelectInfoList [index];
if (currentObjectToSelectInfo.objectToSelect != null) {
if (destroyingSingleObject) {
GKC_Utils.unpackPrefabObjectByCheckingTransformRoot (gameObject);
}
//string objectName = currentObjectToSelectInfo.objectToSelect.name;
//Undo.DestroyObjectImmediate (currentObjectToSelectInfo.objectToSelect);
DestroyImmediate (currentObjectToSelectInfo.objectToSelect);
//Undo.RecordObject (this, "Remove Element From List " + objectName);
objectToSelectInfoList.RemoveAt (index);
if (destroyingSingleObject) {
updateComponentResult = true;
}
}
if (currentObjectToSelectInfo.useEventOnDestroyObject) {
updateComponentResult = true;
currentObjectToSelectInfo.eventOnDestroyObject.Invoke ();
}
if (updateComponentResult) {
updateComponent ();
}
}
public void updateObjectNames ()
{
int objectToSelectInfoListCount = objectToSelectInfoList.Count;
for (int i = 0; i < objectToSelectInfoListCount; i++) {
objectToSelectInfo currentObjectToSelectInfo = objectToSelectInfoList [i];
if (currentObjectToSelectInfo.objectToSelect != null) {
currentObjectToSelectInfo.Name = currentObjectToSelectInfo.objectToSelect.name;
}
}
updateComponent ();
}
public void enableOrDisableObjectByName (string objectName, bool state)
{
int curretIndex = objectToSelectInfoList.FindIndex (s => s.Name.Equals (objectName));
if (curretIndex > -1) {
enableOrDisableObjectByIndex (curretIndex, state);
}
updateComponent ();
}
public void enableOrDisableObjectByIndex (int index, bool state)
{
objectToSelectInfo currentObjectToSelectInfo = objectToSelectInfoList [index];
if (currentObjectToSelectInfo.objectToSelect != null) {
currentObjectToSelectInfo.objectToSelect.SetActive (state);
if (currentObjectToSelectInfo.useEventsOnEnableDisableObject) {
if (state) {
currentObjectToSelectInfo.eventOnEnableObject.Invoke ();
} else {
currentObjectToSelectInfo.eventOnDisableObject.Invoke ();
}
}
}
updateComponent ();
}
public void enableOrDisableAllObjects (bool state)
{
int objectToSelectInfoListCount = objectToSelectInfoList.Count;
for (int i = 0; i < objectToSelectInfoListCount; i++) {
objectToSelectInfo currentObjectToSelectInfo = objectToSelectInfoList [i];
if (currentObjectToSelectInfo.objectToSelect != null) {
currentObjectToSelectInfo.objectToSelect.SetActive (state);
if (currentObjectToSelectInfo.useEventsOnEnableDisableObject) {
if (state) {
currentObjectToSelectInfo.eventOnEnableObject.Invoke ();
} else {
currentObjectToSelectInfo.eventOnDisableObject.Invoke ();
}
}
}
}
updateComponent ();
}
public void updateComponent ()
{
GKC_Utils.updateComponent (this);
GKC_Utils.updateDirtyScene ("Update Non essential character elements manager", gameObject);
}
[System.Serializable]
public class objectToSelectInfo
{
public string Name;
public GameObject objectToSelect;
public bool useEventsOnEnableDisableObject;
public UnityEvent eventOnEnableObject;
public UnityEvent eventOnDisableObject;
public bool useEventOnDestroyObject;
public UnityEvent eventOnDestroyObject;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 302d416ab08faeb428fcb5a8e1b60ada
timeCreated: 1699988192
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/nonEssentialCharacterElementsManager.cs
uploadId: 814740

View File

@@ -0,0 +1,44 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class objectOnWater : MonoBehaviour
{
public virtual void updateExternalForces (Vector3 newValues, bool externalForcesActiveValue)
{
}
public virtual bool isObjectOnWaterActive ()
{
return false;
}
public virtual void updateExternalRotationForces (float rotationAmount, Vector3 rotationAxis, Vector3 externalRotationForcePoint)
{
}
public virtual float getDensity ()
{
return -1;
}
public virtual void setNewDensity (float newValue)
{
}
public virtual void addOrRemoveDensity (float newValue)
{
}
public virtual void setOriginalDensity ()
{
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 1378254cd32697b4b9c95dc89e3057b9
timeCreated: 1674671894
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/objectOnWater.cs
uploadId: 814740

View File

@@ -0,0 +1,35 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class onDisableCheckSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool checkEnabled;
[Space]
[Header ("Main Settings")]
[Space]
public bool showDebugPrint;
[Space]
[Header ("Event Settings")]
[Space]
public UnityEvent eventOnDisabled;
void OnDisable ()
{
if (checkEnabled) {
eventOnDisabled.Invoke ();
if (showDebugPrint) {
print ("on disable function " + gameObject.name);
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: b4b67f03bcea57147a0cf22b9cb5680a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/onDisableCheckSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,36 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class onEnableCheckSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool checkEnabled;
[Space]
[Header ("Main Settings")]
[Space]
public bool showDebugPrint;
[Space]
[Header ("Event Settings")]
[Space]
public UnityEvent eventOnEnabled;
void OnEnable ()
{
if (checkEnabled) {
eventOnEnabled.Invoke ();
if (showDebugPrint) {
print ("on enable function " + gameObject.name);
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: ce759148c075994428a6055948ecfe51
timeCreated: 1609049753
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 Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Others/onEnableCheckSystem.cs
uploadId: 814740

Some files were not shown because too many files have changed in this diff Show More