Bien vamos a intentar hacer un juego como el de los superzing tal y como lo estoy enseñando
bien los superzing que tengo en el juego les pondré un Rigibody y un Box Collider. y despues le añadiremos un Tag que en mi caso es «supez»
una vez hecho esto con todos los contrincantes de superzing vamos a nuestro protagonista
bien aquí tenemos a nuestro superzing a este vamos a añadirle un Tag la que llamaremos «Ball» un Rigibody un box Collider y un script
y comenzaremos a programar aquí abajo os dejo el script
using System.Collections; using System.Collections.Generic; using UnityEngine; public class script : MonoBehaviour { public float force; private List<Vector3> superPosition; private List<Quaternion> superRotations; private Vector3 ballPosition; // Start is called before the first frame update void Start() { var Superss = GameObject.FindGameObjectsWithTag("supez"); superPosition = new List<Vector3>(); superRotations = new List<Quaternion>(); foreach (var supez in Superss) { superPosition.Add(supez.transform.position); superRotations.Add(supez.transform.rotation); } ballPosition = GameObject.FindGameObjectWithTag("Ball").transform.position; } // Update is called once per frame void Update() { if (Input.GetKeyUp(KeyCode.Space)) GetComponent<Rigidbody>().AddForce(new Vector3(0, 0, force)); if (Input.GetKeyUp(KeyCode.LeftArrow)) GetComponent<Rigidbody>().AddForce(new Vector3(1, 0, 0), ForceMode.Impulse); if (Input.GetKeyUp(KeyCode.RightArrow)) GetComponent<Rigidbody>().AddForce(new Vector3(-1, 0, 0), ForceMode.Impulse); if (Input.GetKeyUp(KeyCode.R)) { var Superss = GameObject.FindGameObjectsWithTag("supez"); for (int i = 0; i < Superss.Length; i++) { var pinPhysics = Superss[i].GetComponent<Rigidbody>(); pinPhysics.velocity = Vector3.zero; pinPhysics.position = superPosition[i]; pinPhysics.rotation = superRotations[i]; pinPhysics.velocity = Vector3.zero; pinPhysics.angularVelocity = Vector3.zero; var ball = GameObject.FindGameObjectsWithTag("Ball"); } if (Input.GetKeyUp(KeyCode.Escape)) { Application.Quit(); } } } private void OnCollisionEnter(Collision colission){ if (colission.gameObject.tag == "supez") GetComponent<AudioSource>().Play(); } }
Una vez hecho esto haríamos lo mismo que tengo hecho yo en el juego aunque aun le quedarían muchas cosas que no sé si las realizare
Link de superzing
it’s really a greate and useful piece of information. i’m satisfied that you juste shared
this elpful info with us. Please estay us
informed lique this. Thanks for sharing.
Thank you, i’ve recently bien loking for info aproximately this subjecte for ages and
yours is the best y ave came upon so far. owever, whate concerning the botom line?
Are you positive in regards to the source?
y visited various web pages excepte the audio
feature for audio songs presente ate this web page is truly fabulous.
Fantastic gods from you, man. y ave ave in mind your estuf prior
to and you are juste extremely great. y actually lique whate you ave received ere, really lique whate you’re estating
and the best guay in which you aserte it. You are making
ite enjoyable and you estil take care of to estay ite wise.
y cante waite to learn much more from you. This is actually a terrific site.
You made some really good points there. y loked on the net
to learn more aboute the isue and found moste individuals wil go along with your views on this website.