Ejemplo n.º 1
0
        public void Mount(SceneItem target, string targetLinkPoint, string linkPoint)
        {
            if (IsMounted)
            {
                throw new Exception("This object is already mounted to another SceneItem");
            }
            if (target == null)
            {
                throw new Exception("This target SceneItem is null");
            }
            //if((!target.IsTemplate && !this.IsTemplate))
            //  throw new Exception("You cannot mount a sceneitem if it is not a Template");

            _mountedTargetLinkPoint = target.GetLinkPoint(targetLinkPoint);
            _mountedLinkPoint       = GetLinkPoint(linkPoint);
            if (_mountedTargetLinkPoint == null)
            {
                throw new Exception("The target LinkPoint \"" + targetLinkPoint + "\" does not exists");
            }
            if (_mountedLinkPoint == null)
            {
                throw new Exception("The local LinkPoint \"" + linkPoint + "\" does not exists");
            }
            _mountedTargetLinkPoint.AddMountedChildLinkPoint(_mountedLinkPoint);
            _mountOwner = target;
        }
Ejemplo n.º 2
0
 public void RemoveMountedChildLinkPoint(LinkPoint linkPoint)
 {
     if (_mountedChildLinkPoints.Contains(linkPoint) == false)
     {
         throw new Exception("The LinkPoint \"" + linkPoint.Name + "\" is not attached to this SceneItem");
     }
     _mountedChildLinkPoints.Remove(linkPoint);
 }
Ejemplo n.º 3
0
        public void UpdateChild(LinkPoint targetLinkPoint)
        {
            SceneItem targetChild = targetLinkPoint.Owner;

            targetChild.Position = this.Position - targetLinkPoint.Offset;
            targetChild.Rotation = this.Rotation;


            //targetChild.Position = GetWorldLinkPosition( this._mountedTo.Val.Position, this._mountedTo.Val.Rotation, this._mountedTo.Val.Offset);
        }
Ejemplo n.º 4
0
 public void AddMountedChildLinkPoint(LinkPoint linkPoint)
 {
     if (_mountedChildLinkPoints.Contains(linkPoint))
     {
         throw new Exception("The LinkPoint \"" + linkPoint.Name + "\" is already attached to this SceneItem");
     }
     Mounts[linkPoint.Owner.Name] = linkPoint.Name;
     _mountedChildLinkPoints.Add(linkPoint);
     this.UpdateChild(linkPoint);
 }
Ejemplo n.º 5
0
 public void UnMount()
 {
     if (IsMounted == false)
     {
         throw new Exception("This object is not mounted to a SceneItem");
     }
     if (_mountOwner == null)
     {
         throw new Exception("The Mount Owner of this object is null");
     }
     if (_mountedTargetLinkPoint == null)
     {
         throw new Exception("The Mount Owner target LinkPoint is null");
     }
     if (_mountedLinkPoint == null)
     {
         throw new Exception("The local mounted LinkPoint is null");
     }
     _mountedTargetLinkPoint.RemoveMountedChildLinkPoint(_mountedLinkPoint);
     _mountedTargetLinkPoint = null;
     _mountedLinkPoint       = null;
     _mountOwner             = null;
 }