Exemplo n.º 1
0
    public void GoWorkOnItem(WorkableItem workableItem)
    {
        workTarget = workableItem;

        agent.SetDestination(workableItem.transform.position);

        TryWorkOnItem();
    }
Exemplo n.º 2
0
    public override bool ApplyOnItem(WorkableItem item)
    {
        TreeBehavior tree = item as TreeBehavior;

        if (tree)
        {
            tree.AfterWorked();

            return(true);
        }

        return(false);
    }
Exemplo n.º 3
0
    protected void TryWorkOnItem()
    {
        if (!workTarget)
        {
            return;
        }

        if ((workTarget.transform.position - transform.position).magnitude < 5)
        {
            if (heldItem.ApplyOnItem(workTarget))
            {
                Destroy(workTarget.gameObject);
                workTarget = null;
            }
        }
    }
Exemplo n.º 4
0
    protected void handleCharacterInteraction(RaycastHit hit)
    {
        GameObject   rootObjHit   = hit.transform.root.gameObject;
        Item         pickableItem = rootObjHit.GetComponent <Item>();
        WorkableItem workableItem = rootObjHit.GetComponent <WorkableItem>();

        RoverBehavior selectedCharacterBehavior = selectedCharacter.GetComponent <RoverBehavior>();

        if (pickableItem)
        {
            //selectedCharacterBehavior.GoPickUpItem(pickableItem);
        }
        else if (workableItem)
        {
            //selectedCharacterBehavior.GoWorkOnItem(workableItem);
        }
        else if (rootObjHit.isStatic)
        {
            selectedCharacterBehavior.MoveTo(hit.point);
        }
    }
Exemplo n.º 5
0
 public virtual bool ApplyOnItem(WorkableItem item)
 {
     return(false);
 }