public static Vector3 GenericStartingPoint(Transform agent, Affiliation side) { Vector3 result; Vector3 startingPoint; var dis = Random.Range(2, 8); var randomPoint = Random.insideUnitSphere * dis; switch (side) { case Affiliation.SideOne: startingPoint = ServiceLocatorMonoBehaviour.GetService <Reference>().SpawningPointTeamOne.position; break; case Affiliation.SideTwo: startingPoint = ServiceLocatorMonoBehaviour.GetService <Reference>().SpawningPointTeamTwo.position; break; case Affiliation.None: default: startingPoint = Vector3.zero; break; } NavMesh.SamplePosition(startingPoint + randomPoint, out var hit, dis, NavMesh.AllAreas); result = hit.position; return(result); }
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()); ServiceLocator.SetService(new HighlightController()); _executeControllers = new IExecute[4]; _executeControllers[0] = ServiceLocator.Resolve<PlayerController>(); _executeControllers[1] = ServiceLocator.Resolve<FlashLightController>(); _executeControllers[2] = ServiceLocator.Resolve<InputController>(); _executeControllers[3] = ServiceLocator.Resolve<HighlightController>(); }
public Controllers() { IMotor motor = new UnitMotor(ServiceLocatorMonoBehaviour.GetService <CharacterController>()); 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 TimeRemainingController()); _executeControllers = new IExecute[6]; _executeControllers[0] = ServiceLocator.Resolve <PlayerController>(); _executeControllers[1] = ServiceLocator.Resolve <FlashLightController>(); _executeControllers[2] = ServiceLocator.Resolve <InputController>(); _executeControllers[3] = ServiceLocator.Resolve <SelectionController>(); _executeControllers[4] = ServiceLocator.Resolve <BotController>(); _executeControllers[5] = ServiceLocator.Resolve <TimeRemainingController>(); }
private void SpawningBots() { for (var index = 0; index < _countBotSideOne; index++) { var tempBot = Object.Instantiate(ServiceLocatorMonoBehaviour.GetService <Reference>().BotTypeOne, Patrol.GenericStartingPoint(ServiceLocatorMonoBehaviour.GetService <CharacterController>().transform, Affiliation.SideOne), Quaternion.identity); tempBot.Agent.avoidancePriority = 0; // tempBot.Target = ServiceLocatorMonoBehaviour.GetService<CharacterController>().transform; tempBot.Target = targetBot.transform; tempBot.Agent.avoidancePriority = 0; tempBot.AffiliationSide = Affiliation.SideOne; AddBotToList(tempBot); } for (var index = 0; index < _countBotSideTwo; index++) { var tempBot = Object.Instantiate(ServiceLocatorMonoBehaviour.GetService <Reference>().BotTypeTwo, Patrol.GenericStartingPoint(ServiceLocatorMonoBehaviour.GetService <CharacterController>().transform, Affiliation.SideTwo), Quaternion.identity); tempBot.Agent.avoidancePriority = 0; tempBot.AffiliationSide = Affiliation.SideTwo; AddBotToList(tempBot); } }
//public FlashLightModel FlashLight { get; private set; } public void Initialization() { _weapons = ServiceLocatorMonoBehaviour.GetService <CharacterController>(). GetComponentsInChildren <Weapon>(); 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); } }