/// <summary> /// Initialises the movemovent controller for player movement and necessary references. /// </summary> public void Init(PlayerController controller, CameraController cameraControl) { this.playerController = controller; this.cameraController = cameraControl; GameManager gameManager = GameManager.Instance; //Load shipstates. GameSettings gameSettings = gameManager.gameSettings; settings = gameSettings.playerSettings; VesselShipStats shipStats = gameSettings.vesselStats.Where(x => x.type.Equals(controller.vesselSelection)).First(); _speed = shipStats.speed; //Load Input Controllers ThrustUI thrustUI = gameManager.sceneController.dynamicHud.thrustUI; movementController = new InputMovementSystem(this, shipStats, thrustUI); rotationController = new InputRotationController(); movementController.OnShipThrust.AddListener(playerController.audioSystem.CalculateThrustSound); movementController.OnShipThrust.AddListener(playerController.audioSystem.CalculateEngineTempo); }
/// <summary> /// Constructor for initialising important movement variables for calculation /// </summary> public InputMovementSystem(IMovementController controller, VesselShipStats shipStats, ThrustUI thrustUI) { this.movementController = controller; this.shipStats = shipStats; this.OnShipThrust.AddListener(thrustUI.SetThrustLevel); }