public bool RemoveBehaviour(IGizmoBehaviour behaviour) { if (behaviour == null) { return(false); } if (behaviour == _moveGizmo) { _moveGizmo = null; } else if (behaviour == _rotationGizmo) { _rotationGizmo = null; } else if (behaviour == _scaleGizmo) { _scaleGizmo = null; } else if (behaviour == _universalGizmo) { _universalGizmo = null; } else if (behaviour == _sceneGizmo) { _sceneGizmo = null; } else if (behaviour == _objectTransformGizmo) { _objectTransformGizmo = null; } return(_behaviours.Remove(behaviour)); }
public bool AddBehaviour(IGizmoBehaviour behaviour) { if (behaviour == null || behaviour.Gizmo != null) { return(false); } GizmoBehaviorInitParams initParams = new GizmoBehaviorInitParams(); initParams.Gizmo = this; behaviour.Init_SystemCall(initParams); if (!_behaviours.Add(behaviour)) { return(false); } Type behaviourType = behaviour.GetType(); if (behaviourType == typeof(MoveGizmo)) { _moveGizmo = behaviour as MoveGizmo; } else if (behaviourType == typeof(RotationGizmo)) { _rotationGizmo = behaviour as RotationGizmo; } else if (behaviourType == typeof(ScaleGizmo)) { _scaleGizmo = behaviour as ScaleGizmo; } else if (behaviourType == typeof(UniversalGizmo)) { _universalGizmo = behaviour as UniversalGizmo; } else if (behaviourType == typeof(SceneGizmo)) { _sceneGizmo = behaviour as SceneGizmo; } else if (behaviourType == typeof(BoxGizmo)) { _boxGizmo = behaviour as BoxGizmo; } else if (behaviourType == typeof(ObjectTransformGizmo)) { _objectTransformGizmo = behaviour as ObjectTransformGizmo; } else if (behaviourType == typeof(ObjectExtrudeGizmo)) { _objectExtrudeGizmo = behaviour as ObjectExtrudeGizmo; } behaviour.OnAttached(); behaviour.OnEnabled(); return(true); }
public bool Add(IGizmoBehaviour behaviour) { if (!Contains(behaviour)) { _behaviours.Add(behaviour); return(true); } return(false); }
protected void CheckRequiredBehaviours(List <Type> reqBehaviourTypes) { foreach (Type bhvType in reqBehaviourTypes) { IGizmoBehaviour behaviour = Gizmo.GetFirstBehaviourOfType(bhvType); if (behaviour == null) { ThrowReqBehaviourExeception(bhvType); break; } } }
public bool Contains(IGizmoBehaviour behaviour) { return(_behaviours.Contains(behaviour)); }
public bool Remove(IGizmoBehaviour behaviour) { return(_behaviours.Remove(behaviour)); }