"Roboteitor"

“Roboteitor” videojuego que se me ocurrió viendo escenas de la película “Termineitor”. Funcionamiento teclas -w-a-s-d – mouse- botón de mouse izquierdo. 


Este es un prototipo una introducción que iré ampliando según visitas o motivación personal. La música de fondo esta compuesta por mi mismo, no soy músico, pero a este paso, asta músico voy a ser. Cuando el player es tocado se reinicia el juego a los pocos segundos, de momento solo trato de poner una buena ambientación general y jugar con las luces y las explosiones y los sonidos. 


También empiezo a trastear con c# logrando reiniciar el juego según colisiones al player y según tiempo que transcurre una escena…tambien uso un script para hacer las animaciones, mejor dicho para que al tocar una tecla correspondiente,


 el personaje camine hacia delante “w” o hacia atrás “s” o se agache “boton izquierdo de raton mouse” o de un salto “barra espaciadora” ...en este tema e de hacer mejoras y practicas hay detalles aquí que no me acaban de que dar bien…


..y e puesto los elementos del juego a partir de los recursos que ofrece Unity para hacer videojuegos..(continuara….) (posdata….e buelto a unity e estado unos días probando Armory3d pero no hay todavía muchos ejemplos de donde aprender, iré alternando un sistema y otro, me gustan los dos….)

 




pongo los scripts que utilizo…
en este de debajo sirve para las naves que dan vueltas, simplemente es un cubo el que gira, este cubo lo e alargado dándole forma de palo o de viga y es el padre donde esta este escript,
 el hijo es la nave y e borrado  su Mesh Mesh Filter que tenia un cubo ahora el cubo no se ve  y la nave parece que baya girando por si misma, semejante al funcionamiento de los brazos de una noria….

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class giranave : MonoBehaviour {

        // Use this for initialization
        void Start () {


            //transform.rotation = Quaternion.Euler (0,45, 0);
        }





        // Update is called once per frame
        void Update () {
            // Es la rotacion de Angulos de Euler en grados.
            transform.Rotate (new Vector3 (0.0f * Time.deltaTime, 0.1f, 0), Space.Self);


        }
    }



----------------------------------------------------------------------------------------------------------
este de debajo es para que al colisionar un gameobjet con otro aga un cambio de gsmeobjets ...por ejemplo ago que los cubos ladrillos al ser tocados cambien por unas explosiones y fuegos

--------------------------------------------------------------------------------------------------------
using System;
using UnityEngine;
using Object = UnityEngine.Object;

namespace UnityStandardAssets.Utility
{
    public class ActivateTrigger : MonoBehaviour
    {
        // A multi-purpose script which causes an action to occur when
        // a trigger collider is entered.
        public enum Mode
        {
            Trigger = 0,    // Just broadcast the action on to the target
            Replace = 1,    // replace target with source
            Activate = 2,   // Activate the target GameObject
            Enable = 3,     // Enable a component
            Animate = 4,    // Start animation on target
            Deactivate = 5  // Decativate target GameObject
        }

        public Mode action = Mode.Activate;         // The action to accomplish
        public Object target;                       // The game object to affect. If none, the trigger work on this game object
        public GameObject source;
        public int triggerCount = 1;
        public bool repeatTrigger = false;


        private void DoActivateTrigger()
        {
            triggerCount--;

            if (triggerCount == 0 || repeatTrigger)
            {
                Object currentTarget = target ?? gameObject;
                Behaviour targetBehaviour = currentTarget as Behaviour;
                GameObject targetGameObject = currentTarget as GameObject;
                if (targetBehaviour != null)
                {
                    targetGameObject = targetBehaviour.gameObject;
                }

                switch (action)
                {
                    case Mode.Trigger:
                        if (targetGameObject != null)
                        {
                            targetGameObject.BroadcastMessage("DoActivateTrigger");
                        }
                        break;
                    case Mode.Replace:
                        if (source != null)
                        {
                            if (targetGameObject != null)
                            {
                                Instantiate(source, targetGameObject.transform.position,
                                            targetGameObject.transform.rotation);
                                DestroyObject(targetGameObject);
                            }
                        }
                        break;
                    case Mode.Activate:
                        if (targetGameObject != null)
                        {
                            targetGameObject.SetActive(true);
                        }
                        break;
                    case Mode.Enable:
                        if (targetBehaviour != null)
                        {
                            targetBehaviour.enabled = true;
                        }
                        break;
                    case Mode.Animate:
                        if (targetGameObject != null)
                        {
                            targetGameObject.GetComponent<Animation>().Play();
                        }
                        break;
                    case Mode.Deactivate:
                        if (targetGameObject != null)
                        {
                            targetGameObject.SetActive(false);
                        }
                        break;
                }
            }
        }


        private void OnTriggerEnter(Collider other)
        {
            DoActivateTrigger();
        }
    }
}



--------------------------------------
-----------------------------------------------en este cuando me da una vala enemiga me saca la escena o el nivel de muerte donde sale el player con la animación de caerse derribado
---------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class meirebalaenemiga : MonoBehaviour {


        void Start () {


        }

        void Update () {
        }

        void OnTriggerEnter(Collider other) {
           
            if (other.gameObject.CompareTag ("balaenemiga")){
                transform.Rotate (new Vector3 (0 * Time.deltaTime, 91, 90), Space.Self);

                Application.LoadLevel (2);


            }}

    }

    



----------------------------------------------------------------------------------------------------------
-------------------------------------------------------en este de debajo cuando pasa unos segundos cambia la escena lo hace por tiempo
-----------------------------------------------------------------------------------------------------------------



    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;/// <summary>
    /// ////////////////////////7777777777777777777777777puestoyo ahoraaaaaaaaa sin esto no ba
    /// </summary>


public class REINICIAMIJUEGO : MonoBehaviour {


        public Text contador1;
        public Text fin1;
        private float tiempo = 8f;
        // Use this for initialization
        void Start () {
            contador1.text = " " + tiempo;
            fin1.enabled = false;




        }

        // Update is called once per frame
        void Update ()
        {
            tiempo -= Time.deltaTime;
            contador1.text = " " + tiempo.ToString ("f0");
            if (tiempo <= 0) {
                contador1.text = "0";
                fin1.enabled = true;

       

            {
                   
           

                    Destroy (gameObject, 0.0f);

                    {

                       

                        Application.LoadLevel (1);





                    }
                }
            }
        }

    }

-------------------------------------------------------------------------------------------------------------------
--------------------------------------destruye gameobjets por tiempo, muy útil para borrar eliminar las balas proyectiles cada cierto tiempo si no el videojuego se colgaría se pararía, por tema de memoria sobrecargada en el pc-----------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
using System;
using UnityEngine;

namespace UnityStandardAssets.Utility
{
    public class TimedObjectDestructor : MonoBehaviour
    {
        [SerializeField] private float m_TimeOut = 1.0f;
        [SerializeField] private bool m_DetachChildren = false;


        private void Awake()
        {
            Invoke("DestroyNow", m_TimeOut);
        }


        private void DestroyNow()
        {
            if (m_DetachChildren)
            {
                transform.DetachChildren();
            }
            DestroyObject(gameObject);
        }
    }
}
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Otros detalles del videojuego es acoplar capsulas como hijos al esqueleto del player para hacerle un traje o armadura
 


 

 


 

 

 

 

 



No hay comentarios:

Publicar un comentario