private void OnTriggerEnter(Collider other) { HoldableObject.ObjectType type = HoldableObject.ObjectType.Null; if (other.GetComponent <HoldableObject>()) { type = other.GetComponent <HoldableObject>().objectType; } if ((type == HoldableObject.ObjectType.Sokoban1x1 || type == HoldableObject.ObjectType.Sokoban2x2 || type == HoldableObject.ObjectType.FloorBouncer || type == HoldableObject.ObjectType.Morph) && (other.gameObject.layer == mainGuard.layer) && mainGuard.GetComponent <PlatformGuard>().stuckObjects.Contains(other.gameObject)) { Debug.Log("here we go"); incorrect = true; objectToMove = other.gameObject; if (motionCheck && mainGuard.GetComponent <PlatformGuard>().target&& mainGuard.GetComponent <PlatformGuard>().target.Equals(objectToMove)) { positionObject = (CenterObjectRoutine()); StopAllCoroutines(); StartCoroutine(positionObject); } } }
private void OnTriggerExit(Collider other) { HoldableObject.ObjectType type = HoldableObject.ObjectType.Null; if (other.GetComponent <HoldableObject>()) { type = other.GetComponent <HoldableObject>().objectType; } if (type == HoldableObject.ObjectType.Sokoban1x1 || type == HoldableObject.ObjectType.Sokoban2x2 || type == HoldableObject.ObjectType.FloorBouncer || type == HoldableObject.ObjectType.Morph) { incorrect = false; //objectToMove = null; } }