public Controllers()
        {
            IMotor _motor = default;

            _motor = new UnitMotor(ServiceLocatorMonoBehaviour.GetService <CharacterController>());
            ServiceLocator.SetService(new TimeRemainingController());
            ServiceLocator.SetService(new Inventory());
            ServiceLocator.SetService(new PlayerController(_motor));
            ServiceLocator.SetService(new FlashLightController());
            ServiceLocator.SetService(new WeaponController());
            ServiceLocator.SetService(new InputController());
            ServiceLocator.SetService(new SelectorController());
            ServiceLocator.SetService(new BulletController());
            ServiceLocator.SetService(new SaveDataRepository());
            ServiceLocator.SetService(new LevelMakerController());
            ServiceLocator.SetService(new SmartEnemyesController());
            _executeControllers = new IExecute[8];

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

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

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

            _executeControllers[3] = ServiceLocator.Resolve <InputController>();

            _executeControllers[4] = ServiceLocator.Resolve <SelectorController>();

            _executeControllers[5] = ServiceLocator.Resolve <BulletController>();

            _executeControllers[6] = ServiceLocator.Resolve <WeaponController>();

            _executeControllers[7] = ServiceLocator.Resolve <SmartEnemyesController>();
        }
Пример #2
0
        public void AddEnemyes(int x, int z)
        {
            float   pointX         = ((x - 2) * 20) + Random.Range(-5.0f, 5.0f);
            float   pointY         = 1.0f;
            float   pointZ         = ((z - 2) * 20) + Random.Range(-5.0f, 5.0f);
            Vector3 _enemyPosition = new Vector3(pointX, pointY, pointZ);
            var     tempEnemy      = Instantiate(_enemy, _enemyPosition, new Quaternion());

            tempEnemy.PlayerTransform = ServiceLocatorMonoBehaviour.GetService <CharacterController>().transform;
            ServiceLocator.Resolve <SmartEnemyesController>().AddBotToList(tempEnemy);
        }
Пример #3
0
        public void Load()
        {
            var file = Path.Combine(_path, _fileName);

            if (!File.Exists(file))
            {
                return;
            }
            var temp = _data.Load(file);

            ServiceLocatorMonoBehaviour.GetService <CharacterController>().transform.position = temp.Position;
            ServiceLocatorMonoBehaviour.GetService <CharacterController>().transform.rotation = temp.Rotation;
        }
Пример #4
0
        public void Initialization()
        {
            _weapons = ServiceLocatorMonoBehaviour.GetService <CharacterController>().
                       GetComponentsInChildren <BaseWeaponObject>();

            foreach (var weapon in Weapons)
            {
                weapon.IsVisible = false;
            }

            FlashLight = Object.FindObjectOfType <FlashLightModel>();
            FlashLight.Switch(FlashLightActiveType.Off);
        }
Пример #5
0
        public void Save()
        {
            if (!Directory.Exists(Path.Combine(_path)))
            {
                Directory.CreateDirectory(_path);
            }
            Transform temp   = ServiceLocatorMonoBehaviour.GetService <CharacterController>().transform;
            var       player = new SerializableGameObject
            {
                Position = temp.position,
                Rotation = temp.rotation,
                Name     = "Save1",
                IsEnable = true
            };

            _data.Save(player, Path.Combine(_path, _fileName));
        }
 private void Start()
 {
     _weaponOwner = ServiceLocatorMonoBehaviour.GetService <CharacterController>().transform;
     Debug.Log($"У оружия {name} владелец {_weaponOwner.tag} ");
     _timeRemaining       = new TimeRemaining(ReadyShoot, _rechargeTime);
     _reloadTimeRemaining = new TimeRemaining(ReloadClip, _reloadTime);
     if (!_unlimitedCharge)
     {
         Clip.TotalAmmunition = _startClip;
     }
     else
     {
         Clip.TotalAmmunition = 999;
     }
     Clip.VolumeAmmunition = _clipVolume;
     Clip.CountAmmunition  = 0;
     ReloadClip();
 }