void Update() { if (Input.GetMouseButtonDown(0)) { active = true; } if (!active) { return; } if (timer >= 0) { timer -= Time.deltaTime; } if (Input.GetMouseButton(0) && timer <= 0) { timer += maxTimer; Vector3 mousePosition = mainCamera.ScreenToWorldPoint(Input.mousePosition); mousePosition.z = 0; if (count == 0) { p0 = mousePosition; } if (count >= 1 && Vector3.Distance(p1, mousePosition) <= minDistance) { return; } p1 = p2; p2 = mousePosition; if (++count <= 1) { return; } buildBox.Build(p1, p2); if (count != 4) { return; } wizard.Blink(p0, p2); } if (Input.GetMouseButtonUp(0)) { Clear(); } }
public void Die() { foreach (ObjectPool pool in objectPools) { pool.Kill(); } wizard.Blink(familiar.transform.position + new Vector3(1, 1, 0)); familiar.Deactivate(); familiar.alive = false; wizard.alive = false; dying = true; hazardManager.Deactivate(); PlayerPrefs.SetInt("Score", hazardManager.currentWave); }