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(ObjectTransformGizmo)) { _objectTransformGizmo = behaviour as ObjectTransformGizmo; } behaviour.OnAttached(); behaviour.OnEnabled(); return(true); }
public void Init_SystemCall(GizmoBehaviorInitParams initParams) { _gizmo = initParams.Gizmo; }