void Update() { Vector2 mousePos = camCtrl.cam.ScreenToWorldPoint(Input.mousePosition); bool mousePressed = Input.GetMouseButton(0); bool mouseClicked = Input.GetMouseButtonDown(0); switch (state) { case GameState.GAME: if (mousePressed) { bool clickedBuilding = mouseClicked && buildingCtrl.BuildingClicking(mousePos); if (!clickedBuilding) { Shooting(mousePos); } } break; case GameState.INTERMISSION: switch (intmsnState) { case IntermissionState.NORMAL: if (mouseClicked) { buildingCtrl.BuildingClicking(mousePos); } break; case IntermissionState.PLACING_BUILDING: if (mousePressed) { buildingCtrl.PlacingBuildingClicking(mousePos); } break; default: break; } break; default: break; } waveCtrl.GUpdate(); //RELOAD foreach (ProjectileType typ in System.Enum.GetValues(typeof(ProjectileType))) { if (turretAmmo[typ] <= 0 && Time.time > turretReloadTimers[typ]) { foreach (Turret turret in buildingCtrl.turrets) { if (turret.Stats.def.type == typ) { turretAmmo[typ] += turret.Stats.def.maxAmmo; } } //turretAmmo[typ] UpdateInfoPanel(); } } }