Example #1
0
    public void OnTriggerEnter(Collider other)
    {
        agent.destination = agent.destination;
        GameObject hitObject = other.gameObject;

        Debug.Log(hitObject.tag);
        if (hitObject.tag == "Resource" && task == TaskList.Gathering)
        {
            isGathering = true;
            hitObject.GetComponent <NodeManager>().gatherers++;
            heldResourceType = hitObject.GetComponent <NodeManager>().resourceType;
        }
        else if (hitObject.tag == "Drop" && task == TaskList.Delivering)
        {
            if (RM.Gold >= RM.maxGold)
            {
                task = TaskList.Idle;
            }
            else
            {
                RM.Gold          += heldResource;
                heldResource      = 0;
                task              = TaskList.Gathering;
                agent.destination = targetNode.transform.position;
            }
        }
    }
Example #2
0
    public void OnTriggerEnter(Collider other)
    {
        GameObject hitObject = other.gameObject;

        if (hitObject.tag == "Resource")
        {
            isGathering      = true;
            heldResourceType = hitObject.GetComponent <NodeManager>().resourceType;
        }
    }