public GrabAction( ObjectController objectController, GameObject gameObject, ObjectInteraction.InteractObject vio) : base(objectController, gameObject, vio) { _grabStartList = GameObject.GetComponents <IGrabStartAware>().ToList(); if (_grabStartList.Count > 0) { AddGrabStartBehaviour(); } _grabEndList = GameObject.GetComponents <IGrabEndAware>().ToList(); if (_grabEndList.Count > 0) { AddGrabEndBehaviour(); } _grabPoint = GameObject.GetComponent <IGrabPointAware>(); _gameObject = gameObject; _onEditorGrabStart += OnGrabInit; _onEditorGrabEnd += OnUngrabInit; }
public void Init() { IUseStartAware useStartAware = _gameObject.GetComponent <IUseStartAware>(); if (useStartAware != null) { _useStart = useStartAware; } IUseEndAware useEndAware = _gameObject.GetComponent <IUseEndAware>(); if (useEndAware != null) { _useEnd = useEndAware; } IGrabStartAware grabStartAware = _gameObject.GetComponent <IGrabStartAware>(); if (grabStartAware != null) { _grabStart = grabStartAware; } IGrabEndAware grabEndAware = _gameObject.GetComponent <IGrabEndAware>(); if (grabEndAware != null) { _grabEnd = grabEndAware; } IGrabPointAware grabPointAware = _gameObject.GetComponent <IGrabPointAware>(); if (grabPointAware != null) { _grabPoint = grabPointAware; } IPointerClickAware pointerClickAware = _gameObject.GetComponent <IPointerClickAware>(); if (pointerClickAware != null) { AddPointerBehaviour(); _pointerClick = pointerClickAware; } IPointerInAware pointerInAware = _gameObject.GetComponent <IPointerInAware>(); if (pointerInAware != null) { AddPointerBehaviour(); _pointerIn = pointerInAware; } IPointerOutAware pointerOutAware = _gameObject.GetComponent <IPointerOutAware>(); if (pointerOutAware != null) { AddPointerBehaviour(); _pointerOut = pointerOutAware; } ITouchStartAware touchStartAware = _gameObject.GetComponent <ITouchStartAware>(); if (touchStartAware != null) { _touchStart = touchStartAware; } ITouchEndAware touchEndAware = _gameObject.GetComponent <ITouchEndAware>(); if (touchEndAware != null) { _touchEnd = touchEndAware; } IHighlightAware highlightAware = _gameObject.GetComponent <IHighlightAware>(); if (Settings.Instance().HighlightEnabled) { highlightAware = _gameObject.AddComponent <DefaultHightlighter>(); } HighlightOverrider highlightOverrider = _gameObject.GetComponent <HighlightOverrider>(); if (highlightOverrider != null) { _highlightOverriderGameObject = highlightOverrider.ObjectToHightlight; } if (highlightAware != null) { _highlight = highlightAware; AddHighLighter(highlightAware); } if (Settings.Instance().HighlightEnabled) { EnableHighlight(); } IHapticsAware hapticsAware = _gameObject.GetComponent <IHapticsAware>(); if (hapticsAware == null && (Settings.Instance().TouchHapticsEnabled || Settings.Instance().GrabHapticsEnabled || Settings.Instance().UseHapticsEnabled)) { hapticsAware = _gameObject.AddComponent <DefaultHaptics>(); } if (hapticsAware != null) { AddHaptics(hapticsAware); _haptics = hapticsAware; } }