private void PutDown() { if (pickedUpRobot != null) { gem.TriggerEvent("PutDown", pickedUpRobot.gameObject); isCarrying = 0; pickedUpRobot = null; } else { isCarrying = 0; } StartCoroutine("PuttingDown"); }
void Awake() { List <Type> depTypes = ProgramUtils.GetMonoBehavioursOnType(this.GetType()); List <MonoBehaviour> deps = new List <MonoBehaviour> { (gem = FindObjectOfType(typeof(GlobalEventManager)) as GlobalEventManager) }; if (deps.Contains(null)) { throw ProgramUtils.DependencyException(deps, depTypes); } basicRobot = GetComponent <BasicRobot>(); currentRepair = maxRepair; if (GetComponent <BasicRobot>() == null) { engineerRobot = GetComponent <EngineerRobot>(); } }
//void OnCollisionStay(Collision other) //{ // Debug.Log("Picking up robot: " + other.gameObject.name); // if(isCarrying == 1 && Input.GetKey(KeyCode.Space) && other.gameObject.tag == "Robot") // { // pickedUpRobot = other.gameObject.GetComponent<BasicRobot>(); // if (pickedUpRobot != null) // { // gem.TriggerEvent("PickUp", other.gameObject, new List<object> { hand }); // } // else if (other.gameObject.GetComponent<EngineerRobot>() != null) // { // gem.TriggerEvent("PickUp", other.gameObject, new List<object> { hand }); // } // isCarrying = 0; // gem.TriggerEvent("GrabbedRobot", other.gameObject); // StartCoroutine("PickingUp"); // } //} private void OnTriggerStay(Collider other) { if (isCarrying == 1 && Input.GetKey(KeyCode.Space) && other.gameObject.tag == "Robot") { Debug.Log("Triggering by: " + other.gameObject.name); pickedUpRobot = other.gameObject.GetComponent <BasicRobot>(); if (pickedUpRobot != null) { gem.TriggerEvent("PickUp", other.gameObject, new List <object> { hand }); } else if (other.gameObject.GetComponent <EngineerRobot>() != null) { gem.TriggerEvent("PickUp", other.gameObject, new List <object> { hand }); } isCarrying = 0; gem.TriggerEvent("GrabbedRobot", other.gameObject); StartCoroutine("PickingUp"); } }
void OnEnable() { robot = (BasicRobot)target; }
public BasicRobotBuilder() { robot = new BasicRobot(); }