public void UpdatePathData(List <Node> _path, bool _pathFound)
    {
        path            = _path;
        pathFound       = _pathFound;
        _WaitingForPath = false;

        // Stop following the revious path
        if (followPathCoroutine != null)
        {
            StopCoroutine(followPathCoroutine);
            followPathCoroutine = null;
        }

        if (pathFound)
        {
            if (path.Count > 1)
            {
                // Start following the new path
                followPathCoroutine = StartCoroutine(FollowPath());
            }
        }
        else
        {
            entityMovement.StopMoving();
        }
    }
Example #2
0
        public override void Tick()
        {
            // if target has been killed
            if (!_target.IsInstanciate)
            {
                TargetDeath();
                return;
            }

            // Can entity attack target?
            if (_entityDetection.IsEntityInAttackRange(_target))
            {
                _entityMovement.StopMoving();

                _entityAttack.DoAttack(_target);
            }
            else // Otherwise, entity go closer.
            {
                _entityMovement.MoveToEntity(_target);
            }
        }
Example #3
0
        public override void OnStateExit()
        {
            _entityMovement.StopMoving();

            _owner.GetCharacterComponent <EntityTransitiveStop>().DisableTransitiveStop();
        }