public Controllers() { IMotor motor = new UnitMotor(ServiceLocatorMonoBehaviour.GetService <CharacterController>()); ServiceLocator.SetService(new TimeRemainingController()); ServiceLocator.SetService(new PlayerController(motor)); ServiceLocator.SetService(new FlashLightController()); ServiceLocator.SetService(new InputController()); ServiceLocator.SetService(new SelectionController()); ServiceLocator.SetService(new WeaponController()); ServiceLocator.SetService(new Inventory()); ServiceLocator.SetService(new BotController()); ServiceLocator.SetService(new PoolController()); _executeControllers = new IExecute[6]; _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 <BotController>(); _fixedExecutesControllers = new IFixedExecute[1]; _fixedExecutesControllers[0] = ServiceLocator.Resolve <TimeRemainingController>(); }
public void Initialization() { _weapons = ServiceLocatorMonoBehaviour.GetService <CharacterController>().GetComponentsInChildren <Weapon>() .ToList(); foreach (var weapon in Weapons) { weapon.IsVisible = false; } FlashLight = Object.FindObjectOfType <FlashLightModel>(); FlashLight.Switch(FlashLightActiveType.Off); }
public void Initialization() { for (var index = 0; index < _countBot; index++) { var tempBot = Object.Instantiate(ServiceLocatorMonoBehaviour.GetService <Reference>().Bot, Patrol.GenericPoint(ServiceLocatorMonoBehaviour.GetService <CharacterController>().transform), Quaternion.identity); tempBot.Agent.avoidancePriority = index; tempBot.Target = ServiceLocatorMonoBehaviour.GetService <CharacterController>().transform; //todo разных протинвиков AddBotToList(tempBot); } }
public void Save() { if (!Directory.Exists(Path.Combine(_path))) { Directory.CreateDirectory(_path); } var player = new SerializableGameObject { Pos = ServiceLocatorMonoBehaviour.GetService <CharacterController>().gameObject.transform.position, Name = "NEDNAR", IsEnable = true }; _data.Save(player, Path.Combine(_path, FILE_NAME)); }
public void Load() { var file = Path.Combine(_path, FILE_NAME); if (!File.Exists(file)) { return; } var newPlayer = _data.Load(file); ServiceLocatorMonoBehaviour.GetService <CharacterController>().gameObject.transform.position = newPlayer.Pos; ServiceLocatorMonoBehaviour.GetService <CharacterController>().gameObject.name = newPlayer.Name; ServiceLocatorMonoBehaviour.GetService <CharacterController>().gameObject.SetActive(newPlayer.IsEnable); Debug.Log(newPlayer); }