// Update is called once per frame void Update() { target = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, transform.position.z)); cross.transform.position = new Vector2(target.x, target.y); if (Input.mousePosition.x < splitScreen) { fireIndex = 0; if (ammo.alphaCounter == 10) { fireIndex = 1; } if (ammo.alphaCounter == 10 && ammo.deltaCounter == 10) { fireIndex = 2; } } else if (Input.mousePosition.x >= splitScreen && Input.mousePosition.x < 2 * splitScreen) { fireIndex = 1; if (ammo.deltaCounter == 10) { fireIndex = 0; } if (ammo.deltaCounter == 10 && ammo.alphaCounter == 10) { fireIndex = 2; } } else if (Input.mousePosition.x >= 2 * splitScreen) { fireIndex = 2; if (ammo.omegaCounter == 10) { fireIndex = 1; } if (ammo.omegaCounter == 10 && ammo.deltaCounter == 10) { fireIndex = 0; } } Vector3 difference = target - firePoints[fireIndex].transform.position; float rotationZ = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg; if (Input.GetButtonDown("Fire1") && gameObject.activeSelf) { float distance = difference.magnitude; Vector2 direction = difference / distance; direction.Normalize(); Shoot(direction, rotationZ); ammo.RemoveMissile(); SoundManager.PlaySound("shot"); } if (ammo.alphaCounter == 10 && ammo.deltaCounter == 10 && ammo.omegaCounter == 10 || GameManager.levelComplete) { gameObject.SetActive(false); cross.SetActive(false); Cursor.visible = true; } }