Esempio n. 1
0
        public GameController(Transform placeForUi, ProfilePlayer profilePlayer)
        {
            SubscriptionProperty <float> leftMoveDiff  = new SubscriptionProperty <float>();
            SubscriptionProperty <float> rightMoveDiff = new SubscriptionProperty <float>();

            TapeBackgroundController tapeBackgroundController =
                new TapeBackgroundController(leftMoveDiff, rightMoveDiff);

            AddController(tapeBackgroundController);
            InputGameController inputGameController =
                new InputGameController(leftMoveDiff, rightMoveDiff, profilePlayer.CurrentCar);

            AddController(inputGameController);
            CarController carController = new CarController(leftMoveDiff, rightMoveDiff);

            AddController(carController);

            AIController aiController = new AIController(placeForUi);

            AddController(aiController);

            var abilityController = ConfigureAbilityController(placeForUi, carController, profilePlayer);

            abilityController.ShowAbilities();
        }
Esempio n. 2
0
        public GameController(Transform placeForUi, ProfilePlayer profilePlayer)
        {
            SubscriptionProperty <float> leftMoveDiff             = new SubscriptionProperty <float>();
            SubscriptionProperty <float> rightMoveDiff            = new SubscriptionProperty <float>();
            TapeBackgroundController     tapeBackgroundController = new TapeBackgroundController(leftMoveDiff, rightMoveDiff);

            AddController(tapeBackgroundController);
            InputGameController inputGameController = new InputGameController(leftMoveDiff, rightMoveDiff, profilePlayer.CurrentCar);

            AddController(inputGameController);
            CarController carController = new CarController();

            AddController(carController);
        }
    /// <summary>
    /// Load Player Ship data from definition, init components and setup config data
    /// </summary>
    public void Init()
    {
        ShipDefinition =
            GameDefinitions.ShipDefinitions.FirstOrDefault(x => x.ID == LevelManager.PlayerDefitionPool.ID);

        ShipStats = new ShipStats(ShipDefinition.Health, ShipDefinition.Speed, ShipDefinition.ShootTime);
        Weapons   = new Weapons(this, ShipDefinition);

#if UNITY_EDITOR
        playerController = new PlayerController();
#elif UNITY_ANDROID
        playerController = new PlayerMobileController();
#endif

        playerController.Init(this);

        ShipRendererBehaviour = GetComponentInChildren <ShipRendererBehaviour>();
        ShipRendererBehaviour.Init(this);
    }
Esempio n. 4
0
        public GameController(Transform placeForUi, ProfilePlayer profilePlayer, IReadOnlyList <IItem> items)
        {
            var leftMoveDiff             = new SubscriptionProperty <float>();
            var rightMoveDiff            = new SubscriptionProperty <float>();
            var tapeBackgroundController = new TapeBackgroundController(leftMoveDiff, rightMoveDiff);

            AddController(tapeBackgroundController);

            var inputGameController = new InputGameController(leftMoveDiff, rightMoveDiff, profilePlayer.CurrentCar);

            AddController(inputGameController);

            var carController = new CarController(profilePlayer);

            AddController(carController);

            // можно внедрить как зависимость для другого контроллера
            var abilityController = ConfigureAbilityController(placeForUi, carController, items);

            abilityController.ShowAbilities();
        }