void Awake() { if (instance == null) instance = this; else Destroy(this); }
void Awake() { if (Instance != null) { Destroy(Instance.gameObject); } if (Instance == null) { Instance = this; } countdown.CrossFadeAlpha(0, 0, true); }
void Update() { camhandler.update(); // animate cursorcone if (!conedown) { cursorcone.transform.Translate(conedown_vector); if (cursorcone.transform.position.y > 1.1) { conedown = true; } } else if (conedown) { cursorcone.transform.Translate(coneup_vector); if (cursorcone.transform.position.y < 0.7) { conedown = false; } } // update all warriors foreach (Entity ew in entities) { ew.update(); } // Update Mouse events mouseclickhandler.update(); foreach (Block b in blocks) { b.update(); } if (Input.GetKeyDown(KeyCode.Escape)) { if (IngameGUI.isOpen()) { IngameGUI.setOpen(false); } else { Application.LoadLevel(0); } } else if (Input.GetKeyDown(KeyCode.O)) { IngameGUI.setOpen(!IngameGUI.isOpen()); } else if (Input.GetKeyDown("f2")) { string screenshotFilename = "screenshot_" + System.DateTime.Now.Ticks + ".png"; int count = 0; while (System.IO.File.Exists(screenshotFilename)) { count++; screenshotFilename = "screenshot_" + System.DateTime.Now.Ticks + "_" + count + ".png"; } Application.CaptureScreenshot(screenshotFilename); } }