Пример #1
0
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (!_delegate)
        {
            _delegate = animator.GetComponent <SWizard_Delegate>();

            _agent = _delegate.Agent;
        }

        _agent.isStopped = false;

        // random position from NavMesh
        Vector3 randomDirection = Random.insideUnitSphere;

        randomDirection.y = 0f;
        Vector3 randomPosition = animator.transform.position
                                 + randomDirection.normalized * Random.Range(_minDistance, _maxDistance);

        NavMeshHit hit;

        NavMesh.SamplePosition(randomPosition, out hit, 10f, 1);
        _destination = hit.position;
        _agent.SetDestination(_destination);


        _delegate.State = SWizard_State.RunningRandom;
    }
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (!_delegate)
        {
            _delegate = animator.GetComponent <SWizard_Delegate>();
        }

        _delegate.State = SWizard_State.SummonFire;
    }
Пример #3
0
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (!_delegate)
        {
            _delegate = animator.GetComponent <SWizard_Delegate>();

            _parentTransform = _delegate.Parent.gameObject.transform;
            _rb = _delegate.Rb;
        }

        animator.SetBool("Idling", true);
        _count = Random.Range(_minTimeIdle, _maxTimeIdle);

        _delegate.State = SWizard_State.Idle;
    }
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (!_delegate)
        {
            _delegate = animator.GetComponent <SWizard_Delegate>();

            _agent  = _delegate.Agent;
            _player = Player.Instance;
            _parent = _delegate.Parent;
        }

        _agent.isStopped = false;

        _destination = _player.RandomPositionNearMe(_distance);
        _agent.SetDestination(_destination);

        _delegate.State = SWizard_State.ChasePlayer;
    }