private void Zoom(float amount) { zoomTarget = Camera.orthographicSize - zoomSensitivity * (Camera.orthographicSize * amount); Zoomed?.Invoke(this, new CameraControllerZoomedEventArgs(this, amount, Mathf.Sign(amount))); UpdateOrthographicBounds(); }
// Can't combine the two movement functions as boost has different behavior betweent modes // You can only boost while accelerating in ship mode, while you can dash whenever in butterfly mode void ButterflyMovement() { if (AxisCheck()) { if (butterflyDash && resourceHandler.ParticleCheck(boostCost)) { butterflyMovement.Boost(rb, movement); resourceHandler.ParticleConsume(dashCost); butterflyDash = false; } if (Input.GetButton("Accelerate")) { butterflyMovement.Accelerate(rb, movement); Zoomed.Invoke("Accelerate"); } else if (Input.GetButton("Decelerate")) { butterflyMovement.Decelerate(rb, movement); Zoomed.Invoke("Decelerate"); } else { butterflyMovement.Cruise(rb, movement); } } if (!AxisCheck() || !InputCheck()) { Zoomed.Invoke("Cruise"); } }
void ShipMovement() { if (Input.GetButton("Accelerate")) { if (Input.GetButton("Boost") && resourceHandler.ParticleCheck(boostCost)) { shipMovement.Boost(rb); resourceHandler.ParticleConsume(boostCost); Zoomed.Invoke("Boost"); } else { shipMovement.Accelerate(rb); Zoomed.Invoke("Accelerate"); } } else if (Input.GetButton("Decelerate")) { shipMovement.Decelerate(rb); Zoomed.Invoke("Decelerate"); } else { shipMovement.Cruise(rb); } if (!InputCheck()) { Zoomed.Invoke("Cruise"); } }
/// <summary> /// Called, when map should zoom in /// </summary> /// <param name="screenPosition">Center of zoom in event</param> private bool OnZoomIn(Geometries.Point screenPosition) { var args = new ZoomedEventArgs(screenPosition, ZoomDirection.ZoomIn); Zoomed?.Invoke(this, args); if (args.Handled) { return(true); } // TODO // Perform standard behavior return(true); }
/// <summary> /// Called, when map should zoom out /// </summary> /// <param name="screenPosition">Center of zoom out event</param> private bool OnZoomOut(Geometries.Point screenPosition) { if (Map.ZoomLock) { return(true); } var args = new ZoomedEventArgs(screenPosition, ZoomDirection.ZoomOut); Zoomed?.Invoke(this, args); if (args.Handled) { return(true); } // Perform standard behavior Navigator.ZoomOut(screenPosition); return(true); }
private void Zoom(ZoomProperty widthProperty, ZoomProperty heightProperty) { Zoomed?.Invoke(this, new ZoomButtonsEventArgs(GetFactor(widthProperty, zoomFactorWidth), GetFactor(heightProperty, zoomFactorHeight))); }