public INPCState DoState(NPCSearch_ClassBased npc)
    {
        if (npc.navAgent == null)
        {
            npc.navAgent = npc.GetComponent <NavMeshAgent>();
        }

        DoCollect(npc);
        if (!npc.pickUpTarget.activeSelf)
        {
            return(npc.wanderState);
        }
        else
        {
            return(npc.collectState);
        }
    }
    public INPCState DoState(NPCSearch_ClassBased npc)
    {
        if (npc.navAgent == null)
        {
            npc.navAgent = npc.GetComponent <NavMeshAgent>();
        }

        MoveToCritter(npc);

        if (!npc.critterTarget.activeSelf)
        {
            return(npc.wanderState);
        }
        else
        {
            return(npc.attackState);
        }
    }
예제 #3
0
    public INPCState DoState(NPCSearch_ClassBased npc)
    {
        if (npc.navAgent == null)
        {
            npc.nextLocation = npc.transform.position;
            npc.navAgent     = npc.GetComponent <NavMeshAgent>();
        }

        DoWander(npc);

        if (CanSeeCritter(npc))
        {
            return(npc.attackState);
        }
        else if (CanSeePickUp(npc))
        {
            return(npc.collectState);
        }
        else
        {
            return(npc.wanderState);
        }
    }