コード例 #1
0
        public void Initialization()
        {
            _weapons = ServiceLocatorMonoBehaviour.GetService <CharacterController>()
                       .GetComponentsInChildren <Weapon>().ToList();
            foreach (Weapon weapon in _weapons)
            {
                weapon.IsVisible = false;
            }

            _currentActiveWeapon = -1;
            FlashLight           = Object.FindObjectOfType <FlashLightModel>();
            FlashLight.Switch(FlashLightActiveType.Off);
        }
コード例 #2
0
        public Controllers()
        {
            IMotor 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 SelectionController());

            _executeControllers = new IExecute[5];

            _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>();
        }
コード例 #3
0
 /// <summary>
 /// Выкинуть оружие
 /// </summary>
 /// <param name="weapon"></param>
 public void RemoveWeapon(Weapon weapon)
 {
     //CR: не знаю как сделать по нормальному
     var todelete = ServiceLocatorMonoBehaviour.GetService <CharacterController>()
                    .GetComponentsInChildren <Weapon>().FirstOrDefault(x => x.Name == weapon.Name).transform.parent = null;
 }