Beispiel #1
0
 //this waits for the server to respond before actually moving the object.
 //another strategy might be to move the object, then correct
 private void Network_PositionChangeHandler(object sender, Massive.Events.MoveEvent e)
 {
     //throw new NotImplementedException();
     if (!e.InstanceID.Equals(Globals.UserAccount.UserID))
     {
         MSceneObject mo = (MSceneObject)MScene.ModelRoot.FindModuleByInstanceID(e.InstanceID);
         if (mo != null)
         {
             //movesync smoothly moves an object into position
             MMoveSync ms = (MMoveSync)mo.FindModuleByType(MObject.EType.MoveSync);
             if (ms == null)
             {
                 ms = new MMoveSync(mo, e.Position, e.Rotation);
                 mo.Add(ms);
             }
             else
             {
                 ms.SetTarget(e.Position, e.Rotation);
             }
         }
     }
     else
     {
         MMessageBus.AvatarMoved(this, e.InstanceID, e.Position, e.Rotation);
     }
     //Console.WriteLine(e.Position);
 }
Beispiel #2
0
        /// <summary>
        /// Submodules offer extra functionality for e.g. user interaction, linking click handlers to widgets
        /// We don't want to copy their instance, because each has unique values, e.g. door state.
        /// </summary>
        /// <param name="bb"></param>
        /// <param name="o"></param>
        static void AddSubmodules(MBuildingBlock bb, MSceneObject o)
        {
            if (bb.SubModule == "MDoor")
            {
                MDoor door = new MDoor(o);
                o.Add(door);
            }

            if (bb.SubModule == "MLinker")
            {
                MLinker link = new MLinker();
                o.Add(link);
                MClickHandler mc = new MClickHandler();
                mc.DoubleClicked = MLinkerWidget.Mc_DoubleClick;
                mc.RightClicked  = MLinkerWidget.Mc_RightClick;
                o.Add(mc);
                o.Tag = "LINKER01|URL:";
            }

            if (bb.SubModule == "MTeleporter")
            {
                MClickHandler mc = new MClickHandler();
                mc.DoubleClicked = MTeleporterWidget.Mc_DoubleClick;
                mc.RightClicked  = MTeleporterWidget.Mc_RightClick;
                o.Add(mc);
                o.Tag = "TELEPORTER01|XYZ:";
            }


            if (bb.SubModule == "MPicture")
            {
                MClickHandler mc = new MClickHandler();
                mc.DoubleClicked = MPictureWidget.Mc_DoubleClick;
                mc.RightClicked  = MPictureWidget.Mc_RightClick;
                o.Add(mc);
                o.Tag = "PICTURE01|This Picture|Description";
            }

            if (bb.SubModule == "MStatus")
            {
                MClickHandler mc = new MClickHandler();
                mc.DoubleClicked = MStatusWidget.Mc_DoubleClick;
                mc.RightClicked  = MStatusWidget.Mc_RightClick;
                o.Add(mc);
                o.Tag = "STATUS01|This Status|Description";
            }

            if (bb.SubModule == "MNPC")
            {
                MNPC npc = new MNPC(o, "NPC");
                o.Add(npc);
            }
        }