void OnTriggerEnter2D(Collider2D other) { if (_editor.AudioManager.IsPlaying()) { if (other.gameObject.tag != "WallToggle") { return; } WallObject wallObject = other.gameObject.GetComponentInParent <WallObject>(); _editor.OnWallObjectClicked(wallObject); } }
private void addEventToWall(OhShapeEditor editor) { EventTrigger trigger = _toggle.GetComponentInParent <EventTrigger>(); EventTrigger.Entry pointerClick = new EventTrigger.Entry(); pointerClick.eventID = EventTriggerType.PointerClick; pointerClick.callback.AddListener((eventData) => { // _toggle.isOn = true; editor.OnWallObjectClicked(this); }); EventTrigger.Entry drag = new EventTrigger.Entry(); drag.eventID = EventTriggerType.Drag; drag.callback.AddListener((eventData) => { editor.OnWallObjectDrag(this); }); trigger.triggers.Add(pointerClick); trigger.triggers.Add(drag); }