Notes
Notes - notes.io |
------------------------------------
public class asteroidharaket : MonoBehaviour {
Rigidbody fizik;
public int hiz;
void Start()
{
fizik = GetComponent<Rigidbody>();
fizik.velocity = transform.forward * hiz;
}
-------------------------------------
public class FxKontrol : MonoBehaviour {
Rigidbody fizik;
public int hiz;
void Start () {
fizik = GetComponent<Rigidbody>();
fizik.velocity = transform.forward*hiz;
}
-------------------------------------
using UnityEngine.SceneManagement; // kütüphaneden çağiriyor.
public class oyunkontrol : MonoBehaviour
{
public GameObject asteroid;
public Vector3 randomPos;
int score;
public Text text;
bool oyunbittikontrol = false;
bool yenidenbaslakontrol = false;
public Text oyunbitti;
public Text yenidenbasla;
void Start()
{
score = 0;
text.text = "Score= " + score;
StartCoroutine(olustur());
}
void Update()
{
if (Input.GetKeyDown(KeyCode.R)&¥idenbaslakontrol)
{
SceneManager.LoadScene("oyun");
}
}
IEnumerator olustur()
{
while (true)
{
for (int i = 0; i < 10; i++)
{
Vector3 vec = new Vector3(Random.Range(-randomPos.x, randomPos.x), 0, randomPos.z);
Instantiate(asteroid, vec, Quaternion.identity);
yield return new WaitForSeconds(1);
}
if (oyunbittikontrol)
{
yenidenbasla.text = "Yeniden Başlamak İçin 'R' Tuşuna Basın";
yenidenbaslakontrol = true;
break;
}
yield return new WaitForSeconds(3);
}
}
public void ScoreArttir(int gelenscore)
{
score += gelenscore;
text.text = "Score= " + score;
}
public void oyunbitir()
{
oyunbitti.text = "Oyun Bitti";
oyunbittikontrol = true;
}
}
--------------------------------------
public class patlamasil : MonoBehaviour {
// Use this for initialization
void Start () {
Destroy(gameObject, 3);
}
--------------------------------------
public class PlayerKontrol : MonoBehaviour {
Rigidbody fizik;
float yatay;
float dikey;
Vector3 vec;
public int hiz;
public float minX;
public float maxX;
public float minZ;
public float maxZ;
public int egim;
float ateszamani = 0;
public GameObject Kursun;
public Transform Cıkısyeri;
void Start () {
fizik = GetComponent<Rigidbody>();
}
void Update()
{
if (Input.GetButton("Fire1") && Time.time > ateszamani)
{
ateszamani = Time.time + 1;
Instantiate(Kursun, Cıkısyeri.position,Quaternion.identity);
}
}
void FixedUpdate () {
yatay = Input.GetAxis("Horizontal");
dikey = Input.GetAxis("Vertical");
vec = new Vector3(yatay, 0, dikey);
fizik.velocity = vec * hiz;
fizik.position = new Vector3(Mathf.Clamp(fizik.position.x, minX, maxX), 0.0f, Mathf.Clamp(fizik.position.z, minZ, maxZ));
fizik.rotation = Quaternion.Euler(0, 0, fizik.velocity.x*-egim);
}
}
-----------------------------------------
public class rotasyon : MonoBehaviour {
Rigidbody fizik;
public int hiz;
void Start () {
fizik = GetComponent<Rigidbody>();
fizik.angularVelocity = Random.insideUnitSphere*hiz;
}
------------------------------------------
public class sil : MonoBehaviour {
void OnTriggerExit(Collider col)
{
Destroy(col.gameObject);
}
}
--------------------------------------------
public class Temaslayokol : MonoBehaviour {
GameObject OyunKontrol;
oyunkontrol kontrol;
public GameObject patlama;
public GameObject playerpatlama;
void Start()
{
OyunKontrol = GameObject.FindGameObjectWithTag("OyunKontrol");
kontrol = OyunKontrol.GetComponent<oyunkontrol>();
}
void OnTriggerEnter(Collider col)
{
if (col.tag != "sinir")
{
Destroy(col.gameObject);
Destroy(gameObject);
Instantiate(patlama, transform.position, transform.rotation);
kontrol.ScoreArttir(10);
}
if (col.tag == "Player")
{
Instantiate(playerpatlama, col.transform.position, col.transform.rotation);
kontrol.oyunbitir();
}
}
}
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team