void DeregisterTouch(Collider col) { Touchable touchable = col.gameObject.GetComponent <Touchable>(); if (touchable != null) { if (TouchablesDictionary.ContainsKey(touchable.touchableType)) { if (TouchablesDictionary[touchable.touchableType].Contains(touchable)) { TouchablesDictionary[touchable.touchableType].Remove(touchable); } } if (TouchablesDictionary[touchable.touchableType].Count == 0) { TouchablesDictionary.Remove(touchable.touchableType); } } else { if (col.GetComponent <TouchDetector>() == null) { if (GeneralObjects.Contains(col.gameObject)) { GeneralObjects.Remove(col.gameObject); } } } }
void RegisterTouch(Collider col) { Touchable touchable = col.gameObject.GetComponent <Touchable>(); if (touchable != null) { //Debug.Log ("registering ledgegrab touch"); if (!TouchablesDictionary.ContainsKey(touchable.touchableType)) { List <Touchable> newList = new List <Touchable>(); newList.Add(touchable); TouchablesDictionary.Add(touchable.touchableType, newList); } else { if (!TouchablesDictionary[touchable.touchableType].Contains(touchable)) { TouchablesDictionary[touchable.touchableType].Add(touchable); } } } else { if (col.GetComponent <TouchDetector>() == null) { if (!GeneralObjects.Contains(col.gameObject)) { GeneralObjects.Add(col.gameObject); } } } }
public bool UpdateHit(TouchDetectorType touchDetectorType, ref ControlMechanism target) { if (IsWithinAttackTime()) { TouchDetector detector = characterData.GetTouchDetector(touchDetectorType); Touchable touchable = GetFirstTouch(detector, TouchableType.CHARACTER); if (touchable != null) { touchable.controlMechanism.characterStateController.TakeHit(controlMechanism, characterData.characterAnimationData.DesignatedAnimation); target = touchable.controlMechanism; return(true); } } return(false); }