private void Awake() { _cueBallRB = cueBall.GetComponent <Rigidbody>(); _yellowTargetBallRB = yellowTargetBall.GetComponent <Rigidbody>(); _redTargetBallRB = redTargetBall.GetComponent <Rigidbody>(); if (!_cueBallRB || !_yellowTargetBallRB || !_redTargetBallRB) { Debug.LogError("All balls must have an attached Rigidbody!"); } _cameraTransform = Camera.main.transform; _gameSessionService = ServiceLocator.Resolve <IGameSessionService>(); _gameSettingsService = ServiceLocator.Resolve <IGameSettingsService>(); _gameSettingsService.LoadGameSettings(Constants.DIRECTORY_PATH_SAVES, Constants.FILE_NAME_SETTINGS, Constants.EXTENSION_SAVE_FILES); _eventService = ServiceLocator.Resolve <IEventService>(); _cachedCueBallPosition = cueBall.transform.position; _cachedRedTargetBallPosition = redTargetBall.transform.position; _cachedYellowTargetBallPosition = yellowTargetBall.transform.position; // Setup the state machine stateHolder.updateDelegates = new StateHolder.UpdateDelegate[3]; stateHolder.updateDelegates[(int)ControllerState.AwaitingInput] = UpdateAwaitingInput; stateHolder.updateDelegates[(int)ControllerState.BallInMotion] = UpdateBallInMotion; stateHolder.updateDelegates[(int)ControllerState.Replay] = UpdateReplay; }
private void Awake() { _gameSettingsService = ServiceLocator.Resolve <IGameSettingsService>(); _gameSessionService = ServiceLocator.Resolve <IGameSessionService>(); // Load game settings from the previously saved session if it exists (for now audio volume only). _gameSettingsService.LoadGameSettings(Constants.DIRECTORY_PATH_SAVES, Constants.FILE_NAME_SETTINGS, Constants.EXTENSION_SAVE_FILES); // Load game data from the previously saved session if it exists (saved during game over). _gameSessionService.LoadGameSessionData(Constants.DIRECTORY_PATH_SAVES, Constants.FILE_NAME_LAST_SESSION, Constants.EXTENSION_SAVE_FILES); UpdateUIFromGameSettings(); UpdateUIFromGameSessionData(); }
public DicePanel(IGameSettingsService gameSettingsService) { _gameSettingsService = gameSettingsService; }
private void Awake() { _eventService = ServiceLocator.Resolve <IEventService>(); _gameSettingsService = ServiceLocator.Resolve <IGameSettingsService>(); _audiosource = GetComponent <AudioSource>(); }
public Die(IDicePanel dicePanel, IGameSettingsService gameSettingsService) { _dicePanel = dicePanel; _gameSettingsService = gameSettingsService; }