Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LTTGMouseInput extends PlayerInput;
- var int DesiredZoom;
- var PrivateWrite IntPoint MousePosition; // Stored mouse position. Set to private write as we don't want other classes to modify it, but still allow other classes to access it.
- event PlayerInput(float DeltaTime)
- {
- // Add the aMouseX & aMouseY to the mouse position and clamp it within the viewport width/height
- MousePosition.X = Clamp(MousePosition.X + aMouseX, 0, myHUD.SizeX);
- MousePosition.Y = Clamp(MousePosition.Y - aMouseY, 0, myHUD.SizeY);
- CamScroll();
- SmoothZoom(DeltaTime);
- super.PlayerInput(DeltaTime);
- }
- /**********************************************************************
- ** Horizontal/Vertical Scroll Cam System **
- **********************************************************************/
- function CamScroll()
- {
- // SlowLimit/FastLimit = Scroll Activation from Margin Distance for Fast/Slow speed
- // SlowScrollSpeed = Scroll Speed at SlowLimit / FastScrollSpeed = Scroll Speed at FastLimit
- local int SlowLimit, FastLimit, FastScrollSpeed, SlowScrollSpeed, ScrollLimitX, ScrollLimitY;
- SlowLimit = 25;
- FastLimit = 3;
- SlowScrollSpeed = 20;
- FastScrollSpeed = 50;
- ScrollLimitX = 3000;
- ScrollLimitY = 300;
- if ( (MousePosition.X < SlowLimit) && (MousePosition.X > FastLimit) && (LTTGCamera(PlayerCamera).CamY > -ScrollLimitY) )
- LTTGCamera(PlayerCamera).CamY -= SlowScrollSpeed;
- if ( (MousePosition.X <= FastLimit) && (LTTGCamera(PlayerCamera).CamY > -ScrollLimitY) )
- LTTGCamera(PlayerCamera).CamY -= FastScrollSpeed;
- if ( (MousePosition.X > (myHUD.SizeX - SlowLimit)) && (MousePosition.X < (myHUD.SizeX - FastLimit) ) && (LTTGCamera(PlayerCamera).CamY < ScrollLimitY))
- LTTGCamera(PlayerCamera).CamY += SlowScrollSpeed;
- if ( (MousePosition.X >= (myHUD.SizeX - FastLimit)) && (LTTGCamera(PlayerCamera).CamY < ScrollLimitY) )
- LTTGCamera(PlayerCamera).CamY += FastScrollSpeed;
- if ( (MousePosition.Y < SlowLimit) && (MousePosition.Y > FastLimit) && (LTTGCamera(PlayerCamera).CamX < ScrollLimitX) )
- LTTGCamera(PlayerCamera).CamX += SlowScrollSpeed;
- if ( (MousePosition.Y <= FastLimit) && (LTTGCamera(PlayerCamera).CamX < ScrollLimitX) )
- LTTGCamera(PlayerCamera).CamX += FastScrollSpeed;
- if ( (MousePosition.Y > (myHUD.SizeY - SlowLimit)) && (MousePosition.Y < (myHUD.SizeX - FastLimit) ) && (LTTGCamera(PlayerCamera).CamX > -ScrollLimitX) )
- LTTGCamera(PlayerCamera).CamX -= SlowScrollSpeed;
- if ( MousePosition.Y >= (myHUD.SizeY - FastLimit) && (LTTGCamera(PlayerCamera).CamX > -ScrollLimitX) )
- LTTGCamera(PlayerCamera).CamX -= FastScrollSpeed;
- }
- /**********************************************************************
- ** Zoom in/out Camera System **
- **********************************************************************/
- exec function IncreaseCamZ()
- {
- if (DesiredZoom < 3000)
- DesiredZoom += DesiredZoom * 1 / 10;
- }
- exec function DecreaseCamZ()
- {
- if (DesiredZoom > 1000)
- DesiredZoom -= DesiredZoom * 1 / 10;
- }
- function SmoothZoom(float DeltaTime)
- {
- LTTGCamera(PlayerCamera).CamZ += (DesiredZoom - LTTGCamera(PlayerCamera).CamZ) * DeltaTime *2;
- }
- /***********************************************************
- ** default Properties **
- ***********************************************************/
- defaultproperties
- {
- DesiredZoom = 1500;
- }
Add Comment
Please, Sign In to add comment