Esempio n. 1
0
    public void Init(ControllersProvider provider)
    {
        matchContoller     = provider.GetController <MatchContoller>();
        unityEvents        = provider.GetController <UnityEventsController>();
        gameModeController = provider.GetController <GameModeController>();

        //AI
        sizeController         = provider.GetController <SceneSizeController>();
        ballMovementController = provider.GetController <BallMovementController>();

        var uiController = provider.GetController <UIController>();

        selfInputHandler  = uiController.SelfInputHandler;
        enemyInputHandler = uiController.EmenyInputHandler;

        matchContoller.StateChanged += MatchStateChanged;
        unityEvents.UpdateAction    += Update;

        gameModeController.GameModeChanged += GameModeChanged;

        var sceneController = provider.GetController <SceneController>();

        var selfRacket = sceneController.GetObject(SceneObjectType.SelfRacket);

        selfRacketController = new RacketMovementController(sizeController, selfRacket.transform, racketSpeed);

        var enemyRacket = sceneController.GetObject(SceneObjectType.EnemyRacket);

        enemyRacketController = new RacketMovementController(sizeController, enemyRacket.transform, racketSpeed);

        ball = sceneController.GetObject(SceneObjectType.Ball);
    }
Esempio n. 2
0
    //private float lastPosition;

    public BotInputController(
        RacketMovementController racketController,
        SceneSizeController sizeController,
        BallMovementController ballMovementController,
        Transform ballTransform)
    {
        this.racketController       = racketController;
        this.ballTransform          = ballTransform;
        this.ballMovementController = ballMovementController;

        //float deadZone = sizeController.RacketWidht / 2f;
        border = sizeController.SceneWidht / 2f;//sizeController.SceneWidht - deadZone;

        ballDirection = ballMovementController.Direction;
        ballMovementController.BallDirectionChanged += OnBallDirectionChanged;
    }
Esempio n. 3
0
 private void Awake()
 {
     bmc          = GetComponent <BallMovementController>();
     audioManager = FindObjectOfType <AudioManager>();
 }