Exemplo n.º 1
0
    protected override void OnCharacterActionStart(Character actor)
    {
        transform = actor.transform;

        NavMeshAnimator walker = actor.GetComponentInChildren <NavMeshAnimator>();

        if (walker != null)
        {
            moveSpeed = walker.moveSpeed;
            turnSpeed = walker.turnSpeed;
        }
        else
        {
            moveSpeed = 5.0f;
            turnSpeed = 540.0f;
        }

        if (!run)
        {
            moveSpeed /= 2.0f;
        }

        float distance = Mathf.Min(NeverdawnUtility.GetPathLength(corners), maxDistance);

        distance = 0.0f;
    }
Exemplo n.º 2
0
    public void Reset(NavMeshAnimator previous = null)
    {
        if (m_transform == null)
        {
            m_transform = transform;
        }

        smoothForward = 0.0f;
        smoothTurn    = 0.0f;
        lastPos       = m_transform.position;
        lastForward   = m_transform.forward;
    }
Exemplo n.º 3
0
    protected override void OnInitializeCursor()
    {
        NeverdawnCamera.AddTargetLerped(targetTransform);

        agent        = targetTransform.GetComponent <NavMeshAgent>();
        meshFilter   = GetComponent <MeshFilter>();
        navMeshPath  = new NavMeshPath();
        meshRenderer = GetComponent <MeshRenderer>();

        NavMeshAnimator walker = character.GetComponentInChildren <NavMeshAnimator>();

        turnSpeed = 0.5f * walker.turnSpeed;
        root      = character.position;
        agent.Warp(root);

        createGradient();
    }
Exemplo n.º 4
0
    protected override void OnCharacterActionStart(Character actor)
    {
        NavMeshAnimator walker = actor.GetComponentInChildren <NavMeshAnimator>();

        if (walker != null)
        {
            moveSpeed = walker.moveSpeed;
            turnSpeed = walker.turnSpeed;
        }
        else
        {
            moveSpeed = 5.0f;
            turnSpeed = 540.0f;
        }

        direction = (target - actor.position);
        direction.Normalize();


        maxDistance = (target - actor.position).magnitude;
        distance    = 0.0f;
    }