コード例 #1
0
        public Controllers()
        {
            IMotor motor = default;

            if (Application.platform == RuntimePlatform.PS4)
            {
                //
            }
            else
            {
                motor = new UnitMotor(
                    ServiceLocatorMonoBehaviour.GetService <CharacterController>());
            }

            ServiceLocator.SetService(new PlayerController(motor));
            ServiceLocator.SetService(new FlashLightController());
            ServiceLocator.SetService(new InputController());
            _executeControllers = new IExecute[3];

            _executeControllers[0] = ServiceLocator.Resolve <PlayerController>();

            _executeControllers[1] = ServiceLocator.Resolve <FlashLightController>();

            _executeControllers[2] = ServiceLocator.Resolve <InputController>();
        }
コード例 #2
0
ファイル: Controllers.cs プロジェクト: alexss8/MyFirstFPS
        public Controllers()
        {
            // Forming ServiceLocator data.
            IMotor motor = new UnitMotor(ServiceLocatorMonoBehaviour.GetService <CharacterController>());

            ServiceLocator.SetService(new PlayerController(motor));
            ServiceLocator.SetService(new Inventory());
            ServiceLocator.SetService(new FlashLightController());
            ServiceLocator.SetService(new InputController());
            ServiceLocator.SetService(new WeaponController());
            ServiceLocator.SetService(new SelectionController());
            ServiceLocator.SetService(new TimeRemainingController());
            ServiceLocator.SetService(new HealthBarController());
            ServiceLocator.SetService(new BotController());
            ServiceLocator.SetService(new AimController());

            // Forming IExecute controllers.
            _executeControllers    = new IExecute[7];
            _executeControllers[0] = ServiceLocator.Resolve <TimeRemainingController>();
            _executeControllers[1] = ServiceLocator.Resolve <PlayerController>();
            _executeControllers[2] = ServiceLocator.Resolve <FlashLightController>();
            _executeControllers[3] = ServiceLocator.Resolve <InputController>();
            _executeControllers[4] = ServiceLocator.Resolve <SelectionController>();
            _executeControllers[5] = ServiceLocator.Resolve <HealthBarController>();
            _executeControllers[6] = ServiceLocator.Resolve <BotController>();
        }
コード例 #3
0
        public void Initialization()
        {
            _aims = Object.FindObjectsOfType <BaseAim>();
            AimUIText aimUiText = ServiceLocatorMonoBehaviour.GetService <AimUIText>();

            foreach (var aim in _aims)
            {
                aimUiText.AddPointsGiver(aim);
            }
        }
コード例 #4
0
ファイル: Inventory.cs プロジェクト: alexss8/MyFirstFPS
        public void Initialization()
        {
            _weapons = ServiceLocatorMonoBehaviour.GetService <CharacterController>().
                       GetComponentsInChildren <Weapon>();

            foreach (var weapon in _weapons)
            {
                weapon.SetActive(false);
            }

            FlashLight = Object.FindObjectOfType <FlashLightModel>();
            FlashLight.Switch(FlashLightActiveType.Off);
        }
コード例 #5
0
ファイル: BotController.cs プロジェクト: alexss8/MyFirstFPS
        public void Initialization()
        {
            for (var index = 0; index < _countBot; index++)
            {
                var characterTransform = ServiceLocatorMonoBehaviour.GetService <CharacterController>().transform;
                var tempBot            = Object.Instantiate(ServiceLocatorMonoBehaviour.GetService <Reference>().Bot,
                                                            Patrol.GenericPoint(characterTransform),
                                                            Quaternion.identity);

                tempBot.Agent.avoidancePriority = index;
                tempBot.Target = characterTransform;
                //todo разных противников
                AddBotToList(tempBot);

                var aimUIText = ServiceLocatorMonoBehaviour.GetService <AimUIText>();
                aimUIText.AddPointsGiver(tempBot);
            }
        }
コード例 #6
0
 public void Initialization()
 {
     _transform       = ServiceLocatorMonoBehaviour.GetService <Canvas>().transform;
     _healthBarPrefab = ServiceLocatorMonoBehaviour.GetService <Reference>().HealthUIBar;
 }