Skip to content

Stratkit Rts Camera

# Camera Controller

This module allows you to move the camera over the map in response to user events such as touch, swipe, pinch, or mouse gestures.

Integration

It is a Stratkit.Core module, so should be added correspondingly.

Configuration

Following configurations should be attached in bootstrap's Config Objects: * Instance of UserActionsInputs, you can use the already existing UserActionsInputsDefault.asset. * Instance of CameraModuleConfig, you can use the already existing CameraModuleConfigDefault.asset.

Each field of configurations is described in corresponding tooltips.

Initialization

In your bootstrap, after the map was loaded, set appropriate values in MapDataComponent singleton:

DefaultWorld.SetSingletonSafely(new MapDataComponent
{
   Camera = _camera,
   Constraints = _mapConstraints
});

Samples

  • Find the Stratkit Rts Camera module in the Package Manager window.
  • Go to Samples tab and click "Import".
  • Sample files will appear in location Assets/Samples/Stratkit Rts Camera/1.0.0/Example Map/.
  • Open RtsCameraExample.unity and see how Bootstrap GameObject is created and what is attached in corresponding MonoBehaviours.
  • Open RtsCameraExampleBootstrap.cs and see how module is added to the bootstrap.
  • You can click "Play" or create an *.apk build to check how it works.

Tests

  • Unit tests playback recordings of user inputs that was recorded previously and stored in com.stratkit.rts-camera/Runtime/Stratkit.RtsCamera.Tests/TestCases~/.
  • They have to be run with the Game Window resolution set to Full HD landscape (1920x1080), in other case they may fail. For this reason tests' Setup finds that some fixed resolution size already exists in Game window's configuration (if not then creates new one) and sets it as current size - in this case changes may not apply immediately so the test may finish as invalid (not failed) and there is need to run them again.
  • If you want to record new test cases, before you have to:
  • Import Input System sample "Input Recorder".
  • Import Stratkit Rts Camera sample.
  • Play the RtsCameraExample.unity scene and use the InputRecorder.