plantilla base para movimiento básico
This commit is contained in:
Robii Aragon
2026-02-05 05:07:55 -08:00
parent 195b696771
commit 779f2c8b20
14443 changed files with 23840465 additions and 452 deletions

View File

@@ -0,0 +1,275 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.Events;
public class checkCollisionToApplyDamage : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool damageEnabled = true;
[Space]
[Header ("Objects To Detect Settings")]
[Space]
public bool useLayerToDetect;
public LayerMask layerToDetect;
[Space]
public bool useTagToDetect;
public List<string> tagToDetectList = new List<string> ();
[Space]
[Header ("Collisions Settings")]
[Space]
public bool useMinimumCollisionSpeed;
public float minimumCollisionSpeed;
[Space]
[Header ("Damage On Detected Object Settings")]
[Space]
public bool killDetectedObject;
public bool applyDamageOnDetectedObject;
public bool pushCharacterDetected;
public float extraForceOnObjectDetected;
public bool ignoreShieldOnObjectDetected;
public int damageTypeIDOnObjectDetected = -1;
public bool canActivateReactionSystemTemporallyOnObjectDetected;
public int damageReactionIDOnObjectDetected = -1;
public float damageMultiplierOnObjectDetected = 1;
public bool applyFixedDamageValueOnObjectDetected;
public float fixedDamageValueOnObjectDetected;
[Space]
[Header ("Damage On Object Settings")]
[Space]
public bool killObjectOnCollision;
public bool applyDamageOnObject;
public bool pushCharacterOnCollision;
public float extraForceOnCollision;
public bool ignoreShield;
public int damageTypeID = -1;
public bool damageCanBeBlocked = true;
public bool canActivateReactionSystemTemporally;
public int damageReactionID = -1;
public float damageMultiplier = 1;
public bool applyFixedDamageValue;
public float fixedDamageValue;
[Space]
[Header ("Debug Settings")]
[Space]
public bool showDebugPrint;
[Space]
[Header ("Remote Events Settings")]
[Space]
public bool useRemoteEventOnCollision;
public List<string> remoteEventNameList = new List<string> ();
[Space]
[Header ("Events Settings")]
[Space]
public bool useEventOnCollision;
public UnityEvent eventOnCollision;
[Space]
[Header ("Components")]
[Space]
public healthManagement mainHealthManagement;
ContactPoint currentContact;
GameObject collisionObject;
bool mainHealthManagementLocated;
void OnCollisionEnter (Collision collision)
{
if (!damageEnabled) {
return;
}
bool checkLayerCollisionDetectionResult = false;
bool checkTagCollisionDetectionResult = false;
if (useLayerToDetect) {
if ((1 << collision.gameObject.layer & layerToDetect.value) == 1 << collision.gameObject.layer) {
checkLayerCollisionDetectionResult = true;
}
}
if (useTagToDetect) {
if (tagToDetectList.Contains (collision.gameObject.tag)) {
checkTagCollisionDetectionResult = true;
}
}
if (useLayerToDetect || useTagToDetect) {
if (!checkLayerCollisionDetectionResult && !checkTagCollisionDetectionResult) {
return;
}
}
bool canActivateCollisionReaction = true;
if (useMinimumCollisionSpeed) {
float collisionMagnitude = collision.relativeVelocity.magnitude;
if (Mathf.Abs (collisionMagnitude) < minimumCollisionSpeed) {
canActivateCollisionReaction = false;
}
}
if (showDebugPrint) {
print ("canActivateCollisionReaction result " + canActivateCollisionReaction);
}
if (canActivateCollisionReaction) {
currentContact = collision.contacts [0];
collisionObject = collision.gameObject;
if (useRemoteEventOnCollision) {
remoteEventSystem currentRemoteEventSystem = collisionObject.GetComponent<remoteEventSystem> ();
if (currentRemoteEventSystem != null) {
for (int i = 0; i < remoteEventNameList.Count; i++) {
currentRemoteEventSystem.callRemoteEvent (remoteEventNameList [i]);
}
}
}
if (useEventOnCollision) {
eventOnCollision.Invoke ();
}
if (killDetectedObject) {
float damage = applyDamage.getCurrentHealthAmount (collisionObject);
applyDamage.checkHealth (gameObject, collisionObject, damage, transform.forward, currentContact.point, gameObject,
false, true, ignoreShieldOnObjectDetected, false, damageCanBeBlocked, canActivateReactionSystemTemporallyOnObjectDetected,
damageReactionIDOnObjectDetected, damageTypeIDOnObjectDetected);
} else {
if (applyDamageOnDetectedObject) {
if (pushCharacterDetected) {
Vector3 pushDirection = (currentContact.point - transform.position).normalized;
if (extraForceOnObjectDetected > 0) {
pushDirection *= extraForceOnObjectDetected;
}
applyDamage.pushCharacter (collisionObject, pushDirection);
}
float damage = 0;
if (applyFixedDamageValueOnObjectDetected) {
damage = fixedDamageValueOnObjectDetected;
} else {
damage = collision.relativeVelocity.magnitude * damageMultiplierOnObjectDetected;
}
applyDamage.checkHealth (gameObject, collisionObject, damage, transform.forward, currentContact.point, gameObject,
false, true, ignoreShieldOnObjectDetected, false, damageCanBeBlocked, canActivateReactionSystemTemporallyOnObjectDetected,
damageReactionIDOnObjectDetected, damageTypeIDOnObjectDetected);
}
}
if (!mainHealthManagementLocated) {
mainHealthManagementLocated = mainHealthManagement != null;
if (!mainHealthManagementLocated) {
mainHealthManagement = gameObject.GetComponent<healthManagement> ();
mainHealthManagementLocated = mainHealthManagement != null;
}
}
if (mainHealthManagementLocated) {
if (killObjectOnCollision) {
float damage = applyDamage.getCurrentHealthAmount (collisionObject);
mainHealthManagement.setDamageWithHealthManagement (damage, transform.forward, currentContact.point, gameObject,
gameObject, false, true,
ignoreShield, false, damageCanBeBlocked,
canActivateReactionSystemTemporally,
damageReactionID, damageTypeID);
} else {
if (applyDamageOnObject) {
if (pushCharacterOnCollision) {
Vector3 pushDirection = (currentContact.point - transform.position).normalized;
if (extraForceOnCollision > 0) {
pushDirection *= extraForceOnCollision;
}
applyDamage.pushCharacter (collisionObject, pushDirection);
}
float damage = 0;
if (applyFixedDamageValue) {
damage = fixedDamageValue;
} else {
damage = collision.relativeVelocity.magnitude * damageMultiplier;
}
if (showDebugPrint) {
print ("applyDamageOnObject " + damage);
}
mainHealthManagement.setDamageWithHealthManagement (damage, transform.forward, currentContact.point, gameObject,
gameObject, false, true,
ignoreShield, false, damageCanBeBlocked,
canActivateReactionSystemTemporally,
damageReactionID, damageTypeID);
}
}
}
}
}
public void setDamageEnabledState (bool state)
{
damageEnabled = state;
}
public void disableDamage ()
{
setDamageEnabledState (false);
}
public void enableDamage ()
{
setDamageEnabledState (true);
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: b80cc6442547774418785c64e2da5136
timeCreated: 1681967777
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/Demo/checkCollisionToApplyDamage.cs
uploadId: 814740

View File

@@ -0,0 +1,45 @@
using UnityEngine;
using System.Collections;
public class clock : MonoBehaviour {
public int minutes = 0;
public int hours = 0;
public float speed = 1;
GameObject needleSeconds;
GameObject needleMinutes;
GameObject needleHours;
float secInterval = 0;
int seconds = 0;
//just a script to simulate a clock in the solar system mechanism
void Start(){
needleSeconds = transform.Find("seconds").gameObject;
needleMinutes = transform.Find("minutes").gameObject;
needleHours = transform.Find("hours").gameObject;
}
void Update(){
secInterval += Time.deltaTime * speed;
if(secInterval >= 1){
secInterval -= 1;
seconds++;
if(seconds >= 60){
seconds = 0;
minutes++;
if(minutes > 60){
minutes = 0;
hours++;
if(hours >= 24){
hours = 0;
}
}
}
}
float rotationSeconds = (360 / 60) * seconds;
float rotationMinutes = (360 / 60) * minutes;
float rotationHours = ((360 / 12) * hours) + ((360 / (60 * 12)) * minutes);
needleSeconds.transform.localEulerAngles = transform.up * rotationSeconds;
needleMinutes.transform.localEulerAngles = transform.up * rotationMinutes;
needleHours.transform.localEulerAngles = transform.up * rotationHours;
}
}

View File

@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: e1de6763c597b474e9d99b4fcda9a1e3
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/Demo/clock.cs
uploadId: 814740

View File

@@ -0,0 +1,216 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class damageCharacterOnCollision : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool damageEnabled = true;
public bool addForceToRigidbodies = true;
public float forceAmountToRigidbodies = 1000;
public bool applyDamageWhenPushCharacter;
public float extraForceOnCollision;
[Space]
[Header ("Objects To Detect Settings")]
[Space]
public bool useLayerToDetect;
public LayerMask layerToDetect;
[Space]
public bool useTagToDetect;
public List<string> tagToDetectList = new List<string> ();
[Space]
[Header ("Collisions Settings")]
[Space]
public bool useMinimumCollisionSpeed;
public float minimumCollisionSpeed;
public bool checkMinimumSpeedOnMainRigidbody;
public float minimumSpeedOnMainRigidbody;
[Space]
[Header ("Damage Settings")]
[Space]
public bool killCharacterOnCollision = true;
public bool pushCharacterOnCollision;
public bool ignoreShield;
public int damageTypeID = -1;
public bool damageCanBeBlocked = true;
public bool canActivateReactionSystemTemporally;
public int damageReactionID = -1;
public float damageMultiplier = 1;
public bool applyFixedDamageValue;
public float fixedDamageValue;
[Space]
[Header ("Debug Settings")]
[Space]
public bool showDebugPrint;
[Space]
[Header ("Remote Events Settings")]
[Space]
public bool useRemoteEventOnObjectsFound;
public List<string> remoteEventNameList = new List<string> ();
[Space]
[Header ("Components")]
[Space]
public Rigidbody mainRigidbody;
ContactPoint currentContact;
GameObject collisionObject;
void OnCollisionEnter (Collision collision)
{
if (!damageEnabled) {
return;
}
bool checkLayerCollisionDetectionResult = false;
bool checkTagCollisionDetectionResult = false;
if (useLayerToDetect) {
if ((1 << collision.gameObject.layer & layerToDetect.value) == 1 << collision.gameObject.layer) {
checkLayerCollisionDetectionResult = true;
}
}
if (useTagToDetect) {
if (tagToDetectList.Contains (collision.gameObject.tag)) {
checkTagCollisionDetectionResult = true;
}
}
if (useLayerToDetect || useTagToDetect) {
if (!checkLayerCollisionDetectionResult && !checkTagCollisionDetectionResult) {
return;
}
}
bool canActivateCollisionReaction = true;
if (useMinimumCollisionSpeed) {
float collisionMagnitude = collision.relativeVelocity.magnitude;
if (Mathf.Abs (collisionMagnitude) < minimumCollisionSpeed) {
canActivateCollisionReaction = false;
}
if (showDebugPrint) {
print ("collision magnitude " + Mathf.Abs (collisionMagnitude));
}
if (checkMinimumSpeedOnMainRigidbody) {
if (mainRigidbody == null) {
mainRigidbody = GetComponent<Rigidbody> ();
}
if (mainRigidbody != null) {
float speedOnMainRigidbody = mainRigidbody.linearVelocity.magnitude;
if (Mathf.Abs (speedOnMainRigidbody) < minimumSpeedOnMainRigidbody) {
canActivateCollisionReaction = false;
}
}
}
}
if (showDebugPrint) {
print ("can activate collision reaction result " + canActivateCollisionReaction);
}
if (canActivateCollisionReaction) {
currentContact = collision.contacts [0];
collisionObject = collision.gameObject;
if (useRemoteEventOnObjectsFound) {
remoteEventSystem currentRemoteEventSystem = collisionObject.GetComponent<remoteEventSystem> ();
if (currentRemoteEventSystem != null) {
for (int i = 0; i < remoteEventNameList.Count; i++) {
currentRemoteEventSystem.callRemoteEvent (remoteEventNameList [i]);
}
}
}
if (addForceToRigidbodies) {
if (applyDamage.canApplyForce (collisionObject)) {
collision.rigidbody.AddExplosionForce (forceAmountToRigidbodies, collision.transform.position, 100);
}
}
if (killCharacterOnCollision) {
//applyDamage.killCharacter (collisionObject);
float damage = applyDamage.getCurrentHealthAmount (collisionObject);
applyDamage.checkHealth (gameObject, collisionObject, damage, transform.forward, currentContact.point, gameObject,
false, true, ignoreShield, false, damageCanBeBlocked, canActivateReactionSystemTemporally, damageReactionID, damageTypeID);
} else {
if (pushCharacterOnCollision) {
Vector3 pushDirection = (currentContact.point - transform.position).normalized;
if (extraForceOnCollision > 0) {
pushDirection *= extraForceOnCollision;
}
applyDamage.pushCharacter (collisionObject, pushDirection);
}
if (applyDamageWhenPushCharacter) {
float damage = 0;
if (applyFixedDamageValue) {
damage = fixedDamageValue;
} else {
damage = collision.relativeVelocity.magnitude * damageMultiplier;
}
if (showDebugPrint) {
print ("apply damage " + damage);
}
applyDamage.checkHealth (gameObject, collisionObject, damage, transform.forward, currentContact.point, gameObject,
false, true, ignoreShield, false, damageCanBeBlocked, canActivateReactionSystemTemporally, damageReactionID, damageTypeID);
}
}
}
}
public void setDamageEnabledState (bool state)
{
damageEnabled = state;
}
public void disableDamage ()
{
setDamageEnabledState (false);
}
public void enableDamage ()
{
setDamageEnabledState (true);
}
}

View File

@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: ee1501b11d2d01d4a84652b4cea578fa
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/Demo/damageCharacterOnCollision.cs
uploadId: 814740

View File

@@ -0,0 +1,24 @@
using UnityEngine;
using System.Collections;
public class deviceToActive : MonoBehaviour {
public GameObject[] centers;
public bool activate;
void Start () {
}
// Update is called once per frame
void Update () {
if (activate) {
for(int i=0;i<centers.Length;i++){
centers[i].transform.Rotate(0,200*Time.deltaTime,0);
}
}
}
void changeStateMachine(bool state){
activate = state;
}
}

View File

@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: e75b87c038b90e64dadaeaab68e4b49b
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/Demo/deviceToActive.cs
uploadId: 814740

View File

@@ -0,0 +1,79 @@
using UnityEngine;
using System.Collections;
public class moveObject : 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 FixedUpdate ()
{
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,17 @@
fileFormatVersion: 2
guid: 002308376e5150c46b17c8cda0bf788e
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/Demo/moveObject.cs
uploadId: 814740

View File

@@ -0,0 +1,65 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class openStructure : MonoBehaviour
{
public List<GameObject> objectsToFade = new List<GameObject> ();
public Shader transparent;
public Shader normalShader;
public bool activate;
public bool changed;
public int option = 1;
int i;
//just a simple script to disable and enable part of the structure, using a transparent shader, so the player can go outside
void Update ()
{
if (activate) {
if (!changed) {
changeShader ();
}
for (i = 0; i < objectsToFade.Count; i++) {
Color alpha = objectsToFade [i].GetComponent<Renderer> ().material.color;
alpha.a += (Time.deltaTime / 2) * option;
objectsToFade [i].GetComponent<Renderer> ().material.color = alpha;
if (alpha.a <= 0 || alpha.a >= 1) {
activate = false;
disableObjects ();
}
}
}
}
public void changeStructureState ()
{
option *= (-1);
activate = true;
}
void disableObjects ()
{
for (int i = 0; i < objectsToFade.Count; i++) {
if (option == -1) {
objectsToFade [i].GetComponent<Collider> ().enabled = false;
} else {
objectsToFade [i].GetComponent<Collider> ().enabled = true;
objectsToFade [i].GetComponent<Renderer> ().material.shader = normalShader;
objectsToFade [i].GetComponent<Renderer> ().material.color = Color.white;
}
}
if (option == 1) {
changed = false;
}
}
void changeShader ()
{
for (int i = 0; i < objectsToFade.Count; i++) {
if (option == -1) {
objectsToFade [i].GetComponent<Renderer> ().material.shader = transparent;
}
}
changed = true;
}
}

View File

@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 879fe07c6e6d2d84db657877e789f350
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/Demo/openStructure.cs
uploadId: 814740

View File

@@ -0,0 +1,38 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class setLaserRefractions : MonoBehaviour
{
public GameObject objectToChange;
public Text textValue;
public string shieldAbilityName = "Shield";
playerShieldSystem currentPlayerShieldSystem;
//change a value in the object to change
public void getSliderValue (Slider info)
{
int value = (int)info.value;
currentPlayerShieldSystem.setLaserRefractionLimit (value);
textValue.text = info.value.ToString ("#");
}
public void setCurrentPlayer (GameObject newPlayer)
{
objectToChange = newPlayer;
playerComponentsManager currentPlayerComponentsManager = objectToChange.GetComponent<playerComponentsManager> ();
if (currentPlayerComponentsManager != null) {
playerAbilitiesSystem currentPlayerAbilitiesSystem = currentPlayerComponentsManager.getPlayerAbilitiesSystem ();
if (currentPlayerAbilitiesSystem != null) {
currentPlayerShieldSystem = (playerShieldSystem)currentPlayerAbilitiesSystem.getAbilityByName (shieldAbilityName);
}
}
}
}

View File

@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: ad3f2c47a38f31f4099bc18c7c305ce3
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/Demo/setLaserRefractions.cs
uploadId: 814740

View File

@@ -0,0 +1,87 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class setText : MonoBehaviour
{
public bool editingText;
public bool showGizmo;
TextMesh textMesh;
Text text;
MeshRenderer mainMeshRenderer;
//a script to set the text of every cartel in the scene, and checking if the player is inside the trigger
void Start ()
{
mainMeshRenderer = GetComponent<MeshRenderer> ();
GetComponent<TextMesh> ().text = GetComponent<Text> ().text.Replace ("|", "\n");
if (GetComponent<Collider> ()) {
mainMeshRenderer.enabled = false;
} else {
mainMeshRenderer.enabled = true;
}
}
void OnTriggerEnter (Collider col)
{
if (col.gameObject.CompareTag ("Player")) {
mainMeshRenderer.enabled = true;
}
}
void OnTriggerExit (Collider col)
{
if (col.gameObject.CompareTag ("Player")) {
mainMeshRenderer.enabled = false;
}
}
public void getmainMeshRendererComponent ()
{
if (mainMeshRenderer == null) {
mainMeshRenderer = GetComponent<MeshRenderer> ();
}
}
void OnDrawGizmos ()
{
if (!showGizmo) {
return;
}
if (GKC_Utils.isCurrentSelectionActiveGameObject (gameObject)) {
DrawGizmos ();
}
}
void OnDrawGizmosSelected ()
{
DrawGizmos ();
}
void DrawGizmos ()
{
if (showGizmo) {
if (!Application.isPlaying) {
if (mainMeshRenderer) {
if (editingText) {
if (!mainMeshRenderer.enabled) {
mainMeshRenderer.enabled = true;
}
if (!textMesh || !text) {
textMesh = GetComponent<TextMesh> ();
text = GetComponent<Text> ();
}
textMesh.text = text.text.Replace ("|", "\n");
} else {
if (mainMeshRenderer.enabled) {
mainMeshRenderer.enabled = false;
}
}
} else {
getmainMeshRendererComponent ();
}
}
}
}
}

View File

@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: b74d2a06bbfec914dbfc600cdeb15d71
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/Demo/setText.cs
uploadId: 814740

View File

@@ -0,0 +1,41 @@
using UnityEngine;
using System.Collections;
public class simpleObject : MonoBehaviour
{
public string animationName = "piston";
public bool working;
Animation mainAnimation;
void Start ()
{
mainAnimation = GetComponent<Animation> ();
}
void Update ()
{
if (working) {
if (!mainAnimation.IsPlaying (animationName)) {
if (mainAnimation [animationName].speed == -1) {
mainAnimation [animationName].speed = 1;
} else {
mainAnimation [animationName].speed = -1;
mainAnimation [animationName].time = mainAnimation [animationName].length;
}
mainAnimation.Play (animationName);
}
}
}
public void activate ()
{
working = true;
}
public void changeState ()
{
working = !working;
}
}

View File

@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: a8632ce000b4f9e4dae77564ee2dc3b6
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/Demo/simpleObject.cs
uploadId: 814740

View File

@@ -0,0 +1,65 @@
using UnityEngine;
using System.Collections;
public class simpleTurretRobot : MonoBehaviour
{
public GameObject machineGun;
public GameObject cannon;
Animation machineGunAnim;
Animation cannonAnim;
public bool activated;
void Start ()
{
machineGunAnim = machineGun.GetComponent<Animation> ();
cannonAnim = cannon.GetComponent<Animation> ();
}
public void pressButton ()
{
activated = !activated;
//stopAnimations ();
if (activated) {
activateWeapon ();
} else {
deactivateWeapon ();
}
}
public void stopAnimations ()
{
machineGunAnim.Stop ();
cannonAnim.Stop ();
}
public void activateWeapon ()
{
machineGunAnim ["activateMachineGun"].speed = 1;
//cannonAnim ["activateCannon"].time = 0;
machineGunAnim.CrossFade ("activateMachineGun");
cannonAnim ["activateCannon"].speed = 1;
//cannonAnim ["activateCannon"].time = 0;
cannonAnim.CrossFade ("activateCannon");
}
public void deactivateWeapon ()
{
cannonAnim ["activateCannon"].speed = -1;
if (!cannonAnim.IsPlaying ("activateCannon")) {
cannonAnim ["activateCannon"].time = cannonAnim ["activateCannon"].length;
cannonAnim.Play ("activateCannon");
} else {
cannonAnim.CrossFade ("activateCannon");
}
machineGunAnim ["activateMachineGun"].speed = -1;
if (!machineGunAnim.IsPlaying ("activateMachineGun")) {
machineGunAnim ["activateMachineGun"].time = machineGunAnim ["activateMachineGun"].length;
machineGunAnim.Play ("activateMachineGun");
} else {
machineGunAnim.CrossFade ("activateMachineGun");
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: c5bc23ec42427a04aa3e2ac135dc4dff
timeCreated: 1509995330
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/Demo/simpleTurretRobot.cs
uploadId: 814740

View File

@@ -0,0 +1,40 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class solarSystem : MonoBehaviour
{
public GameObject sun;
public float speed;
public bool useDistance;
public List<GameObject> planets = new List<GameObject> ();
//a script to make a simple solar system, where every planet rotates according to the distance to the sun
void Start ()
{
Component[] components = GetComponentsInChildren (typeof(Transform));
//get all the planets inside the solar system
foreach (Component c in components) {
if (c.CompareTag ("moving")) {
planets.Add (c.gameObject);
}
}
}
void Update ()
{
int planetsCount = planets.Count;
Vector3 sunPosition = sun.transform.position;
for (int i = 0; i < planets.Count; i++) {
float distance = GKC_Utils.distance (sunPosition, planets [i].transform.position);
if (useDistance) {
planets [i].transform.RotateAround (sunPosition, planets [i].transform.up, (speed / (distance / 20)) * Time.deltaTime);
} else {
planets [i].transform.RotateAround (sunPosition, planets [i].transform.up, speed * Time.deltaTime);
}
}
}
}

View File

@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: a29597b425ac5084691ec2d586c78e25
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/Demo/solarSystem.cs
uploadId: 814740