void OnMouseDown() { if (enabled) { mZCoord = Camera.main.WorldToScreenPoint(gameObject.transform.position).z; //Store offset = gameobject world pos - mouse world pos mOffset = gameObject.transform.position - GetMouseAsWorldPoint(); PathingModule pm = GetComponent <PathingModule>(); if (pm != null) { pm.travelling = false; } PetController pc = GetComponent <PetController>(); if (pc != null) { pc.currentlyLosingDesire = false; } } }
void OnMouseUp() { if (enabled) { PathingModule pm = GetComponent <PathingModule>(); if (pm != null) { pm.travelling = true; } PetController pc = GetComponent <PetController>(); if (pc != null) { pc.currentlyLosingDesire = true; } if (isOffering) { offeringDisplay.SetActive(true); } } }