//Ust Buton static void butonUst_OnInterrupt(uint data1, uint data2, DateTime time) { if (Yon != Yonler.Asagi | yilanUzunlugu == 1) { Yon = Yonler.Yukari; } }
//Sol Buton static void butonSol_OnInterrupt(uint data1, uint data2, DateTime time) { if (Yon != Yonler.Saga | yilanUzunlugu == 1) { Yon = Yonler.Sola; } }
public void HareketEt(Yonler yon) { if (yon == Yonler.Asagi) { yeniKonum.X = AracResmi.Location.X; yeniKonum.Y += 5; AracResmi.Location = yeniKonum; } }
public static void YenidenBasla() { yilanPozisyon[0] = new Pozisyon(9, 9); yilanPozisyon[1] = new Pozisyon(8, 9); yilanPozisyon[2] = new Pozisyon(7, 9); yilanPozisyon[3] = new Pozisyon(6, 9); yilanUzunlugu = 4; puan = 0; seviye = 1; YemKoy(); Yon = Yonler.Saga; }
public void HareketEt(Yonler yon) { yeniKonum = AracResmi.Location; if (yon == Yonler.Yukarı) { yeniKonum.X = AracResmi.Location.X; yeniKonum.Y -= 5; AracResmi.Location = yeniKonum; } }
public void HareketEt(Yonler yon) { if (yon == Yonler.Asagi) { Point point = new Point() { X = ResimKutusu.Location.X, Y = ResimKutusu.Location.Y + 5 }; ResimKutusu.Location = point; } }
public void HareketE(Yonler yon) { if (yon == Yonler.Asagi) { Resim.Location = new Point() { X = Resim.Location.X, Y = Resim.Location.Y + 5 }; } else { throw new Exception("Ucak sadece asagi hareket edebilir"); } }
public void HareketE(Yonler yon) { if (yon == Yonler.Yukari) { Resim.Location = new Point() { X = Resim.Location.X, Y = Resim.Location.Y - 5 }; } else { throw new Exception("Roket sadece yukarı hareket edebilir"); } }
public void HareketEt(Yonler yon) { if (yon == Yonler.Yukari) { ResimKutusu.Location = new Point { X = ResimKutusu.Location.X, Y = ResimKutusu.Location.Y - MERMI_HIZI }; } else { throw new Exception("Roket sadece yukarı yönde hareket eder"); } }
public void HareketEt(Yonler yon) { if (yon == Yonler.Asagi) { Point point = new Point() { X = ResimKutusu.Location.X, Y = ResimKutusu.Location.Y + UCAK_HIZI }; this.ResimKutusu.Location = point; } else { throw new Exception("Uçak sadece aşağı yönde hareket edebilir"); } }
public void HareketEt(Yonler yon) { switch (yon) { case Yonler.Sola: if (Resim.Location.X > 20) Resim.Location = new Point(Resim.Location.X-hareketBirimi,Resim.Location.Y); break; case Yonler.Saga: if (Resim.Location.X < contianer.Size.Width-120) Resim.Location = new Point(Resim.Location.X + hareketBirimi, Resim.Location.Y); break; default: throw new Exception("ucak savar sadece saga sola hareket ettirilebilir"); } }
public void HareketEt(Yonler yon) { yeniKonum = AracResmi.Location; if (yon == Yonler.Sag) { yeniKonum.X += 5; yeniKonum.Y = AracResmi.Location.Y; AracResmi.Location = yeniKonum; } else if (yon == Yonler.Sol) { yeniKonum.X -= 5; yeniKonum.Y = AracResmi.Location.Y; AracResmi.Location = yeniKonum; } }
public void HareketEt(Yonler yon) { switch (yon) { case Yonler.Sola: if (ResimKutusu.Location.X > 20) { ResimKutusu.Location = new Point(ResimKutusu.Location.X - UCAKSAVAR_BIRIM, ResimKutusu.Location.Y); } break; case Yonler.Saga: if (ResimKutusu.Location.X < tasiyici.Width - 120) { ResimKutusu.Location = new Point(ResimKutusu.Location.X + UCAKSAVAR_BIRIM, ResimKutusu.Location.Y); } break; default: throw new Exception("Uçaksavar sadece sola veya sağa hareket edebilir"); } }
//yakinlik olcen fonksiyon. Parametre olaarak iki noktayı alıyor ve belli mesafelerde mi değil mi kontrol ediyor //public bool yakinlikOlcer(Point ilkLocation, Point ikinciLocation, int distanceX, int distanceY) //{ // if (Math.Abs(ilkLocation.X - ikinciLocation.X) < distanceX && Math.Abs(ilkLocation.Y - ikinciLocation.Y) < distanceY) // { // return true; // } // else // { // return false; // } //} public Point hareketEt(Yonler yon) { Point newLocation = location; switch (yon) { case Yonler.Up: if (newLocation.Y - hareketMesafesi >= 47) { newLocation.Y -= hareketMesafesi; } break; case Yonler.Down: if (newLocation.Y + hareketMesafesi <= 268) { newLocation.Y += hareketMesafesi; } break; case Yonler.Left: if (newLocation.X - hareketMesafesi >= 35) { newLocation.X -= hareketMesafesi; } break; case Yonler.Right: if (newLocation.X + hareketMesafesi <= 729) { newLocation.X += hareketMesafesi; } break; default: break; } return(newLocation); }
void Update() { if (bilinensayisi < KelimeSayisi) { if (clickObject.GetComponent <ClickControl>() != null) { clickControl = clickObject.GetComponent <ClickControl>(); } Ray ray = camera.ScreenPointToRay(Input.mousePosition); RaycastHit hitInfo; if (Physics.Raycast(ray, out hitInfo)) { if (Input.GetMouseButtonDown(0) && hitInfo.transform.gameObject.name.Contains("Kart")) { SecilenKelime = new List <GameObject>(); Control[0] = hitInfo.transform.gameObject; if (Control[0].name.Length == 8) { cardX = Convert.ToInt32(Control[0].name.Substring(5, 1)); cardZ = Convert.ToInt32(Control[0].name.Substring(7, 1)); } if (Control[0].name.Length == 9) { if (Control[0].name.Substring(7, 1) != "_") { cardX = Convert.ToInt32(Control[0].name.Substring(5, 1)); cardZ = Convert.ToInt32(Control[0].name.Substring(7, 2)); } else { cardX = Convert.ToInt32(Control[0].name.Substring(5, 2)); cardZ = Convert.ToInt32(Control[0].name.Substring(8, 1)); } } if (Control[0].name.Length == 10) { cardX = Convert.ToInt32(Control[0].name.Substring(5, 2)); cardZ = Convert.ToInt32(Control[0].name.Substring(8, 2)); } } if (Input.GetMouseButton(0)) { if (hitInfo.transform.gameObject != Control[0]) { if (hitInfo.transform.gameObject != null && hitInfo.transform.gameObject.transform.position.z == Control[0].transform.position.z) { yonler = Yonler.Yatay; SecilenKelime.Add(Control[0]); } if (hitInfo.transform.gameObject != null && hitInfo.transform.gameObject.transform.position.x == Control[0].transform.position.x) { yonler = Yonler.Dikey; SecilenKelime.Add(Control[0]); } if (hitInfo.transform.gameObject != null && Math.Abs(hitInfo.transform.gameObject.transform.position.z - Control[0].transform.position.z) == Math.Abs(hitInfo.transform.gameObject.transform.position.x - Control[0].transform.position.x)) { yonler = Yonler.Capraz; SecilenKelime.Add(Control[0]); } yonAtandi = true; } if (yonAtandi == true) { if (yonler == Yonler.Yatay) { RaycastHit hitInfoNew; Vector3 position = new Vector3(hitInfo.transform.position.x, Control[0].transform.position.y, Control[0].transform.position.z - 1); if (Physics.Raycast(position, transform.TransformDirection(Vector3.forward), out hitInfoNew)) { SecilenKelime.Add(hitInfoNew.transform.gameObject); } } if (yonler == Yonler.Dikey) { RaycastHit hitInfoNew; Vector3 position = new Vector3(Control[0].transform.position.x, Control[0].transform.position.y, hitInfo.transform.position.z - 1); if (Physics.Raycast(position, transform.TransformDirection(Vector3.forward), out hitInfoNew)) { SecilenKelime.Add(hitInfoNew.transform.gameObject); } } if (yonler == Yonler.Capraz) { RaycastHit hitInfoNew; Vector3 position = new Vector3(hitInfo.transform.position.x, Control[0].transform.position.y, hitInfo.transform.position.z - 1); if (Physics.Raycast(position, transform.TransformDirection(Vector3.forward), out hitInfoNew)) { if (Math.Abs(Control[0].transform.position.x - hitInfoNew.transform.gameObject.transform.position.x) == Math.Abs(Control[0].transform.position.z - hitInfoNew.transform.gameObject.transform.position.z)) { SecilenKelime.Add(hitInfoNew.transform.gameObject); } } } } } if (Input.GetMouseButtonUp(0) && hitInfo.transform.gameObject.name.Contains("Kart")) { Control[1] = hitInfo.transform.gameObject; ensturman = null; kelimeHarfleri = new List <GameObject>(); KontrolEtme(Control, kelimeHarfleri); yonAtandi = false; } } } if (bilinensayisi == KelimeSayisi) { oyunKazanildi = true; } }