ALGUNOS SCRIPTS DEL VIDEOJUEGO EN C#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class lekitavestidoconbarradevidas : MonoBehaviour {
public int damage;
public int vidaEnemigo;
public Slider BarraVidaEnemigo;
//public Rigidbody cubo;/// pruebas
public Rigidbody ENEMIGOSALTAEXPLOTADO;/// pruebas
public Rigidbody ENEMIGOSALTAEXPLOTADO2;/// pruebasIMBENTADO POR MIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
//public Rigidbody source;/// pruebas
//public Rigidbody targetGameObject;/// pruebas
void Update () {
BarraVidaEnemigo.value = vidaEnemigo;
}
void OnTriggerEnter(Collider other) {
// if (other.gameObject.CompareTag ("Player")){
if (other.gameObject.CompareTag ("caca")){
vidaEnemigo-=damage;
if (vidaEnemigo <= 0) {
Destroy (this.gameObject);/////destruye funciona
// Application.LoadLevel (0);
//Rigidbody p = Instantiate(cubo, transform.position, transform.rotation);////pruebassss
Rigidbody p = Instantiate(ENEMIGOSALTAEXPLOTADO, transform.position, transform.rotation);////pruebassss
Rigidbody p2 = Instantiate(ENEMIGOSALTAEXPLOTADO2, transform.position, transform.rotation);////pruebassssIMBENTADOPOR MIIIIIIIIIII
// Instantiate(source, targetGameObject.transform.position,
//targetGameObject.transform.rotation);
// Application.LoadLevel (3);///cambia la escena donde quiero funciona
}
}}
}
------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class persiguemaloachoke : MonoBehaviour {
Transform player;
UnityEngine.AI.NavMeshAgent nav;
void Awake ()
{
player = GameObject.FindGameObjectWithTag ("choke").transform;
nav = GetComponent <UnityEngine.AI.NavMeshAgent> ();
}
void Update ()
{
nav.SetDestination (player.position);
}
}
--------------------------------------------------------------
----------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class suenacuandotocalaniña : MonoBehaviour {
public AudioSource tickSource;
void Start () {
tickSource = GetComponent<AudioSource> ();
}
void Update () {
}
void OnTriggerEnter(Collider other) {
if (other.gameObject.CompareTag ("choke")){
tickSource.Play ();
}}
}
----------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DISPARATIRITO : MonoBehaviour {
public Transform player;
// public float range = 1f;
//public float range = 4f;
public float range = 0.04f;
public float bulletImpulse = 0.1f;
private bool onRange = false;
public Rigidbody projectile;
void Start()
{
float rand = Random.Range(1.0f, 2.0f);/////ORIGINAL
//float rand = Random.Range(0.04f, 2.0f);/////tambien funciona///////////////////////////EL QUE VENGO USANDO
//float rand = Random.Range(0.04f, 0.5f);/////tambien funciona
//float rand = Random.Range(0.04f, 0.08f);/////tambien funciona
InvokeRepeating("Shoot", 2, rand);//////ORIGINAL
}
void Shoot()
{
if (onRange)
{
Rigidbody bullet = (Rigidbody)Instantiate(projectile, transform.position + transform.forward, transform.rotation);
bullet.AddForce(transform.forward * bulletImpulse, ForceMode.Impulse);
Destroy(bullet.gameObject, 2);
}
}
void Update()
{
onRange = Vector3.Distance(transform.position, player.position) < range;
if (onRange)
transform.LookAt(player);
}
}
--------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CONTROLREPARTIDOR : MonoBehaviour {
public Animator Anim;
public float WalkSpeed;
void Update () {
if (Input.GetKey (KeyCode.E)) {
Anim.SetBool ("CORRER", true);
transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
} else {
Anim.SetBool ("CORRER", false);
if (Input.GetKey (KeyCode.W)) {
Anim.SetBool ("ANDA", true);
transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
} else {
Anim.SetBool ("ANDA", false);
if (Input.GetKey (KeyCode.S)) {
Anim.SetBool ("ATRAS", true);
transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
} else {
Anim.SetBool ("ATRAS", false);
if (Input.GetKey (KeyCode.A)) {
Anim.SetBool ("CORRER", true);
transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
} else {
Anim.SetBool ("CORRER", false);
if (Input.GetKey (KeyCode.P)) {/////ORIGINAL
Anim.SetBool ("BOMBA", true);
transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
} else {
Anim.SetBool ("BOMBA", false);
if (Input.GetKey (KeyCode.O)) {
Anim.SetBool ("BOMBA", true);
transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
} else {
Anim.SetBool ("BOMBA", false);
if (Input.GetKey (KeyCode.D)) {
Anim.SetBool ("CORRER", true);
transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
} else {
Anim.SetBool ("CORRER", false);
if (Input.GetButton ("Fire1")) {
Anim.SetBool ("DISPARANDO", true);
transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
} else {
Anim.SetBool ("DISPARANDO", false);
if (Input.GetKey (KeyCode.M)) {
Anim.SetBool ("LANZAR", true);
transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
} else {
Anim.SetBool ("LANZAR", false);
}
}
}
}
}
}
}
}
}
}
}
-----------------------------------------------------------------------
using UnityEngine;
using System.Collections;
public class TransformFunctions : MonoBehaviour
{
public float moveSpeed = 10f;
public float turnSpeed = 50f;
void Update ()
{
if (Input.GetKey(KeyCode.W))////funciona contantemente al apretar W mayusculas a de ser
//if (Input.GetKeyDown(KeyCode.W))// funciona pasito a pasito
//if(Input.GetKey(KeyCode.UpArrow))
transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);
if (Input.GetKey(KeyCode.S))////funciona contantemente al apretar W mayusculas a de ser
//if(Input.GetKey(KeyCode.DownArrow))
transform.Translate(-Vector3.forward * moveSpeed * Time.deltaTime);
if (Input.GetKey(KeyCode.A))////funciona contantemente al apretar W mayusculas a de ser
//if(Input.GetKey(KeyCode.LeftArrow))
transform.Rotate(Vector3.up, -turnSpeed * Time.deltaTime);
if (Input.GetKey(KeyCode.D))////funciona contantemente al apretar W mayusculas a de ser
//if(Input.GetKey(KeyCode.RightArrow))
transform.Rotate(Vector3.up, turnSpeed * Time.deltaTime);
}
}
-----------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class otalovolidermenguasulobos : MonoBehaviour {
// public int cura;
public int damage;
public int vidaEnemigo;
public Slider BarraVidaEnemigo;
void Update () {
BarraVidaEnemigo.value = vidaEnemigo;
}
void OnTriggerEnter(Collider other) {
//if (other.gameObject.CompareTag ("MATA")){
if (other.gameObject.CompareTag ("pipi")){
vidaEnemigo-=damage;
if (vidaEnemigo <= 0) {
Application.LoadLevel (3);
}
}}
}
-------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class cambiaanimacionadasingirarlo : MonoBehaviour {
// Use this for initialization
//void Start () {
//}
public Animator Anim;
public float WalkSpeed;
// Update is called once per frame
void Update () {
}
void OnTriggerEnter(Collider other) {//////////////////////////////////////MIO NUEVO
if (other.gameObject.CompareTag ("pollo")){
//transform.Rotate (new Vector3 (0 * Time.deltaTime, 700, 0), Space.Self);///////////////nuebo mio
//if (Input.GetKey (KeyCode.W)) {
Anim.SetBool ("ANDA", true);//////////////////////////////////////////////////////////////
transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);///////////////////////
} else {///////////////////////////////////////////////////////////////////////////////////////
Anim.SetBool ("ANDA", false);/////////////////////////////////////////////////////////////
//If (other.gameObject.CompareTag ("repartidor (1)")){
if (Input.GetKey (KeyCode.S)) {
Anim.SetBool ("ATRAS", true);
transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
} else {
Anim.SetBool ("ATRAS", false);
}
}
}}