public BotLogicNavMesh(BotLocomotive botLocomotion, NavMeshAgent navMeshAgentComponent, ProximityChecker jumpProximityChecker, float walkSpeed = 0.75f, float walkRotationSpeed = 120f, float runSpeed = 5f, float runRotationSpeed = 120f) : base(botLocomotion) { Initialize(botLocomotion, navMeshAgentComponent, jumpProximityChecker, walkSpeed, walkRotationSpeed, runSpeed, runRotationSpeed); }
protected override void OnSetup(IBehaviourContext character) { ConnectionEntry <RPGCharacter> centerInput = Center.GetEntry(character); ConnectionEntry <bool> includeCasterInput = IncludeCaster.GetEntry(character); ConnectionEntry <float> distanceInput = Distance.GetEntry(character); CharacterConnection.EntryCollection targetsOutput = Targets.GetEntry(character); GameObject proximityHolder = new GameObject("Proximity Cheacker"); ProximityChecker proximity = proximityHolder.AddComponent <ProximityChecker> (); proximity.enabled = false; proximity.Conditions += (RPGCharacter target) => { return(includeCasterInput.Value ? true : target != centerInput.Value); }; proximity.OnEnter += (RPGCharacter target) => { targetsOutput.Add(target); }; proximity.OnExit += (RPGCharacter target) => { targetsOutput.Remove(target); }; Action changeHandler = () => { if (centerInput.Value == null) { proximityHolder.transform.SetParent(null); proximity.enabled = false; return; } proximityHolder.transform.SetParent(centerInput.Value.transform); proximityHolder.transform.localPosition = Vector3.zero; proximity.enabled = true; }; Action distanceChangeHandler = () => { proximity.Distance = distanceInput.Value; }; distanceChangeHandler(); changeHandler(); centerInput.OnAfterChanged += changeHandler; distanceInput.OnAfterChanged += distanceChangeHandler; }
public void SetUp() { _proximityChecker = new ProximityChecker(); _boardTiles = new TileType[3][]; for (var index = 0; index < _boardTiles.Length; index++) { _boardTiles[index] = new TileType[3]; } _boardTiles[1][1] = TileType.Floor; }
private void Initialize(BotLocomotive botLocomotion, NavMeshAgent navMeshAgentComponent, ProximityChecker jumpProximityChecker, float walkSpeed = 0.75f, float walkRotationSpeed = 120f, float runSpeed = 5f, float runRotationSpeed = 120) { NavMeshAgentComponent = navMeshAgentComponent; JumpProximityChecker = jumpProximityChecker; WalkSpeed = walkSpeed; WalkRotationSpeed = walkRotationSpeed; RunSpeed = runSpeed; RunRotationSpeed = runRotationSpeed; NavMeshAgentComponent.speed = WalkSpeed; NavMeshAgentComponent.angularSpeed = WalkRotationSpeed; }