private void Spawn(EnemyToSpawn e) { GameObject spawnedEnemy = Instantiate(e.prefab, transform.position, Quaternion.identity, EnemyToSpawn.parent.transform); WaypointNavigator navigator = spawnedEnemy.GetComponent <WaypointNavigator>(); navigator.currentWaypoint = startingWaypoint; }
// Use this for initialization void Start() { e = GetComponent <Entity>(); target = UniversalReference.PlayerObject.transform; wn = GetComponent <WaypointNavigator>(); wn.WayPoints = new List <Vector2>(); }
//what to do when the scene loads private void Start() { //get the movement component navigator = this.GetComponent <WaypointNavigator>(); //find the navmesh agent component agent = this.GetComponent <NavMeshAgent>(); //find the player player = GameObject.FindGameObjectWithTag("Player"); target = player.transform; }
void OnEnable() { currentOrder = new List <FoodItem>(); navigator = GetComponent <WaypointNavigator>(); audioSource = GetComponentInChildren <AudioSource>(); SetSpeechBubbleState(false); exclamationMark = Instantiate(GameManager.instance.exclamationMark, speechBubble.transform.position, Quaternion.identity, speechBubble.transform); audioSource.PlayOneShot(GameManager.instance.entranceClip); GenerateOrder(); }
public void Setup() { var testData = new[] { _input }; var mockPuzzleInput = new Mock <IPuzzleInput>(); mockPuzzleInput.Setup(p => p.GetPuzzleInputAsArray(It.IsAny <string>())).Returns(testData); _navigator = new WaypointNavigator(mockPuzzleInput.Object); _navigator.ExecuteAction(_input); }
#pragma warning restore 0649 private void Awake() { if (waypointComponent == null) { waypointComponent = GetComponentInParent <WaypointComponent>(); } if (waypointComponent == null) { return; } _waypoints = waypointComponent.GetNavigator(); _waypoints.Select(startAtWaypoint); transform.position = _waypoints.Current; }
public void SolvePartTwo() { ReadInputFile(); var navigator = new WaypointNavigator(); foreach (var instruction in InputLines) { navigator.FollowInstruction(instruction); } var manhattanDistance = navigator.GetManhattanDistance(); Console.WriteLine(string.Format(Day12Constants.Day12PartTwoAnswer, manhattanDistance.AbsoluteLatitude, manhattanDistance.AbsoluteLongitude, manhattanDistance.GetSumPosition())); }
public void Spawn() { if (isSpawned == false) { spawnedObject = Instantiate(prefab, transform.position, transform.rotation); isSpawned = true; spawnedTransform = spawnedObject.GetComponent <Transform>(); WaypointNavigator waypointNavigator = spawnedObject.GetComponent <WaypointNavigator>(); if (nextWaypoint != null) { waypointNavigator.CurrentWaypoint(nextWaypoint); } else { waypointNavigator.CurrentWaypoint(previousWaypoint); } } }
public void Setup() { var testData = new[] { "F10", "N3", "F7", "R90", "F11" }; var mockPuzzleInput = new Mock <IPuzzleInput>(); mockPuzzleInput.Setup(p => p.GetPuzzleInputAsArray(It.IsAny <string>())).Returns(testData); _navigator = new WaypointNavigator(mockPuzzleInput.Object); var i = 0; // F10 _navigator.ExecuteAction(testData[i]); Assume.That(_navigator.CurrentPosition, Is.EqualTo(new Point(100, 10))); Assume.That(_navigator.Waypoint, Is.EqualTo(new Point(10, 1))); i++; // N3 _navigator.ExecuteAction(testData[i]); Assume.That(_navigator.CurrentPosition, Is.EqualTo(new Point(100, 10))); Assume.That(_navigator.Waypoint, Is.EqualTo(new Point(10, 4))); i++; // F7 _navigator.ExecuteAction(testData[i]); Assume.That(_navigator.CurrentPosition, Is.EqualTo(new Point(170, 38))); Assume.That(_navigator.Waypoint, Is.EqualTo(new Point(10, 4))); i++; // R90 _navigator.ExecuteAction(testData[i]); Assume.That(_navigator.CurrentPosition, Is.EqualTo(new Point(170, 38))); Assume.That(_navigator.Waypoint, Is.EqualTo(new Point(4, -10))); i++; // F11 _navigator.ExecuteAction(testData[i]); Assume.That(_navigator.CurrentPosition, Is.EqualTo(new Point(214, -72))); Assume.That(_navigator.Waypoint, Is.EqualTo(new Point(4, -10))); }
void OnTriggerEnter2D(Collider2D collision) { StopWheel.SetActive(false); _manager.promptIsPossible = true; Time.timeScale = 1f; NullifyTimingSlider(); if (_manager.promptIsPossible && pressedInTime == false) //ErrorCount timing { car = collision.GetComponent <CarAI>(); switch (signId) { case 0: //Stop sign Function if (collision.CompareTag("Car") | collision.CompareTag("Player")) { StartCoroutine(Stop()); } break; case 1: //TurnLeft sign Function if (CanNPCsUseLeft && currentWaypointLeft != null) { if (collision.CompareTag("Car") | collision.CompareTag("Player")) { navigator = collision.GetComponent <WaypointNavigator>(); navigator.currentWaypoint = currentWaypointLeft; car.SetDestination(currentWaypointLeft.GetPosition()); } } else if (collision.CompareTag("Player") && currentWaypointLeft != null) { navigator = collision.GetComponent <WaypointNavigator>(); navigator.currentWaypoint = currentWaypointLeft; car.SetDestination(currentWaypointLeft.GetPosition()); } break; case 2: if (CanNPCsUseForward && currentWaypointForward != null) { if (collision.CompareTag("Car") | collision.CompareTag("Player")) { navigator = collision.GetComponent <WaypointNavigator>(); navigator.currentWaypoint = currentWaypointForward; car.SetDestination(currentWaypointForward.GetPosition()); } } else if (collision.CompareTag("Player") && currentWaypointForward != null) { navigator = collision.GetComponent <WaypointNavigator>(); navigator.currentWaypoint = currentWaypointForward; car.SetDestination(currentWaypointForward.GetPosition()); } break; case 3: //TurnRight sign Function if (CanNPCsUseRight && currentWaypointRight != null) { if (collision.CompareTag("Car") | collision.CompareTag("Player")) { navigator = collision.GetComponent <WaypointNavigator>(); navigator.currentWaypoint = currentWaypointRight; car.SetDestination(currentWaypointRight.GetPosition()); } } else if (collision.CompareTag("Player") && currentWaypointRight != null) { navigator = collision.GetComponent <WaypointNavigator>(); navigator.currentWaypoint = currentWaypointRight; car.SetDestination(currentWaypointRight.GetPosition()); } break; case 4: car.TargetSpeed = 5f; break; case 5: car.TargetSpeed = 8.3333333f; break; } } }
// Use this for initialization void Start() { waypointNavigator = GetComponent <WaypointNavigator>(); waypointNavigator.StartNavigation(playerTransform.value.position); charactercontroller = GetComponent <CharacterController>(); }
// Use this for initialization void Start() { waypointNavigator = GetComponent <WaypointNavigator>(); waypointNavigator.StartNavigation(5); charactercontroller = GetComponent <CharacterController>(); }