Пример #1
0
        protected override IEnumerator VisualisePath()
        {
            _isFindingPath = true;
            yield return(StartCoroutine(Pathfinder.FindPath(StepValue, transform.position, _goalPosition,
                                                            moveableRadius,
                                                            newPath => _path = newPath)));

            //if (!(Vector3.Distance(_goalPosition, _path.Last()) < 1)) yield break;
            _usingPath = true;
            StateChange.ToMoveState();
            _isFindingPath = false;
        }
Пример #2
0
 protected override void DetermineGoalPosition()
 {
     if (Math.Abs(_sphere.radius - moveableRadius) > float.Epsilon)
     {
         _sphere.radius = moveableRadius;
     }
     if (_others.Count == 0)
     {
         _goalPosition = Random.insideUnitSphere * moveableRadius;
     }
     else
     {
         var num = Random.Range(0, _others.Count);
         _goalPosition = _others[num].transform.position - _others[num].transform.forward * _stalkDistance;
         _target       = _others[num];
     }
     StateChange.ToMoveState();
 }
Пример #3
0
 protected override void DetermineGoalPosition()
 {
     _goalPosition = new Vector3(Random.Range(transform.localPosition.x - moveableRadius, transform.localPosition.x + moveableRadius), transform.localPosition.y, Random.Range(transform.localPosition.z - moveableRadius, transform.localPosition.z + moveableRadius));
     StateChange.ToMoveState();
 }