예제 #1
0
    void updateState()
    {
        float dist = Vector3.Distance(transform.position, target.position);

        if (dist > Agent.stoppingDistance && dist < Agent.stoppingDistance + 5)
        {
            state = archerState.isInrange;
        }
        else if (dist < Agent.stoppingDistance + 5)
        {
            state = archerState.walkAway;
        }
    }
예제 #2
0
    void updateState()
    {
        float distance = Vector3.Distance(transform.position, target.position);

        if (distance >= agent.stoppingDistance && distance <= agent.stoppingDistance + 5)
        {
            state = archerState.isInRange;
        }
        else if (distance < agent.stoppingDistance)
        {
            state = archerState.walkAway;
        }
        else if (distance > agent.stoppingDistance + 5)
        {
            state = archerState.walkTowards;
        }
        else
        {
            Debug.Log("I dont know what im supposed to be doing. PLease help");
        }
    }