public void LeaveWorkableObject() { if (currentWorkableObject != null) { currentWorkableObject.currentWorker = null; } currentWorkableObject = null; Act("stay"); }
public void OnWorkableObjectSelected(WorkableObject wo) { if (currentWorker != null) { instructions.Hide(); wo.currentWorker = currentWorker; currentWorker.GotoAndWork(wo); } }
private void OnTriggerExit(Collider theCollider) { workableObject = null; if (workableObject) { workableObject.playerActive = false; } switch (theCollider.tag) { case "Ladder": RemoveClimbable(); break; } }
private void OnTriggerEnter(Collider theCollider) { Debug.Log("collided with a " + theCollider.tag); //try to get a workable object workableObject = theCollider.GetComponentInParent <WorkableObject>(); if (workableObject) { workableObject.playerActive = true; } //check if its a ladder switch (theCollider.tag) { case "Ladder": MakeClimbable(theCollider); break; } }
public void GotoAndWork(WorkableObject wo) { if (currentWorkableObject != null) { currentWorkableObject.currentWorker = null; } Select(false); transform.position = new Vector3(wo.workerSpot.transform.position.x, wo.workerSpot.transform.position.y, transform.position.z); currentWorkableObject = wo; switch (wo.type) { case "wood": Act("cut"); break; case "iron": Act("mine"); break; } }