void Update() { if (Input.GetMouseButtonDown(0) && !iskillingstuff) { //Use (); Debug.Log("Something!!!"); TreatmentGUI.AddCooldown(type, cooldown + duration); iskillingstuff = true; GetComponent <SpriteRenderer>().enabled = true; StartCoroutine(ApplyChemo()); } }
virtual public void Use() { TreatmentGUI.AddCooldown(type, cooldown); gameObject.SetActive(false); }
void Update() { if (!startPositionSet) { // user hasn't set the start point yet if (Input.GetMouseButtonDown(0)) { startPoint = ExampleUtils.ScreenToWorld(area.root, Input.mousePosition); startPoint = new Vector3(startPoint.x, startPoint.y, -1); lineRenderer.SetPosition(0, startPoint); lineRenderer.enabled = true; startPositionSet = true; } } else { Vector3 mouse = ExampleUtils.ScreenToWorld(area.root, Input.mousePosition); // fixed length lazor beam Vector3 delta = mouse - startPoint; delta = new Vector3(delta.x, delta.y, 0); endPoint = startPoint + delta.normalized * length; endPoint = new Vector3(endPoint.x, endPoint.y, -1); aBitLeft = Vector3.Cross(delta, Vector3.back).normalized; lineRenderer.SetPosition(1, endPoint); if (Input.GetMouseButtonDown(0) && !effect.activeSelf) { lineRenderer.enabled = false; TreatmentGUI.AddCooldown(type, cooldown); effect.SetActive(true); effect.transform.position = startPoint; iTween.MoveTo(effect, iTween.Hash("position", endPoint, "time", 2f, "easetype", iTween.EaseType.linear, "oncompletetarget", this.gameObject, "oncomplete", "ZapComplete")); } } if (effect.activeSelf) { FlatHexPoint testPos = area.map[effect.transform.position]; if (area.grid[testPos] != null) { Destroy(area.grid[testPos].gameObject); } testPos = area.map[effect.transform.position + aBitLeft]; if (area.grid[testPos] != null) { Destroy(area.grid[testPos].gameObject); } testPos = area.map[effect.transform.position - aBitLeft]; if (area.grid[testPos] != null) { Destroy(area.grid[testPos].gameObject); } gameObject.audio.Play(); } }