當前位置: 首頁>>代碼示例>>C#>>正文


C# Framework.ColliderArgs類代碼示例

本文整理匯總了C#中OpenSim.Framework.ColliderArgs的典型用法代碼示例。如果您正苦於以下問題:C# ColliderArgs類的具體用法?C# ColliderArgs怎麽用?C# ColliderArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ColliderArgs類屬於OpenSim.Framework命名空間,在下文中一共展示了ColliderArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TriggerScriptColliding

 public void TriggerScriptColliding(SceneObjectPart part, ColliderArgs colliders)
 {
     ScriptColliding handlerColliding = OnScriptColliding;
     if (handlerColliding != null)
     {
         foreach (ScriptColliding d in handlerColliding.GetInvocationList())
         {
             try
             {
                 d(part, colliders);
             }
             catch (Exception e)
             {
                 m_log.ErrorFormat(
                     "[EVENT MANAGER]: Delegate for TriggerScriptColliding failed - continuing.  {0} {1}",
                     e.ToString(), e.StackTrace);
             }
         }
     }
 }
開發者ID:mugginsm,項目名稱:Aurora-Sim,代碼行數:20,代碼來源:EventManager.cs

示例2: HandleGenericCollisionEvent

        private void HandleGenericCollisionEvent(CollisionEventUpdate update, Scenes.ScriptEvents eventType, EventManager.ScriptColliding callback,
            bool playSound)
        {
            // play the sound.
            if (playSound && CollisionSound != UUID.Zero && eventType == ScriptEvents.collision_start && CollisionSoundVolume > 0.0f)
            {
                SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0);
            }

            SceneObjectPart handlingPart = FindCollisionHandlingPart(eventType);
            if (handlingPart == null) return; //no one to handle the event

            ColliderArgs colliderArgs = new ColliderArgs();
            List<DetectedObject> colliding = new List<DetectedObject>();

            bool otherIsPrim;
            if (update.Type == CollisionEventUpdateType.CollisionBegan ||
                update.Type == CollisionEventUpdateType.CollisionContinues ||
                update.Type == CollisionEventUpdateType.BulkCollisionsContinue ||
                update.Type == CollisionEventUpdateType.CollisionEnded)
            {
                otherIsPrim = true;
            }
            else
            {
                otherIsPrim = false;
            }

            if (update.BulkCollisionData == null)
            {
                TryExtractCollider(update.OtherColliderLocalId, colliding, otherIsPrim, update.OtherColliderUUID);
            }
            else
            {
                foreach (uint localId in update.BulkCollisionData)
                {
                    TryExtractCollider(localId, colliding, otherIsPrim, update.OtherColliderUUID);
                }
            }
            

            if (colliding.Count > 0)
            {
                colliderArgs.Colliders = colliding;
                // always running this check because if the user deletes the object it would return a null reference.
                if (m_parentGroup == null)
                    return;
                if (m_parentGroup.Scene == null)
                    return;
                callback(handlingPart.LocalId, colliderArgs);
            }
        }
開發者ID:kf6kjg,項目名稱:halcyon,代碼行數:52,代碼來源:SceneObjectPart.cs

示例3: DoNotify

        private void DoNotify(ScriptCollidingNotification notify, uint id, ColliderArgs collargs)
        {
            if (m_parentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.ShouldUseFireAndForgetForCollisions)
            {
                // For those learning C#, FireAndForget takes a function, an object to pass
                //    to that function and an ID string. The "oo => {}" construct is a lambda expression
                //    for a function with one arguement ('oo'). The 'new Object[] {}" construct creates an Object
                //    that is an object array and initializes it with three items (the parameters
                //    being passed). The parameters passed are the function to call ('notify') and
                //    its two arguements. Finally, once in the function (called later by the FireAndForget
                //    thread scheduler), the passed object is cast to an object array and then each
                //    of its items (aoo[0] to aoo[2]) are individually cast to what they are and
                //    then used in a call of the passed ScriptCollidingNotification function.
                Util.FireAndForget(oo =>
                {
                    Object[] aoo = (Object[])oo;
                    ((ScriptCollidingNotification)aoo[0])((uint)aoo[1], (ColliderArgs)aoo[2]);

                }, new Object[] { notify, id, collargs }, "SOP.Collision");
            }
            else
            {
                notify(id, collargs);
            }
        }
開發者ID:Kubwa,項目名稱:opensim,代碼行數:25,代碼來源:SceneObjectPart.cs

示例4: TriggerScriptCollidingEnd

 public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders)
 {
     handlerCollidingEnd = OnScriptCollidingEnd;
     if (handlerCollidingEnd != null)
         handlerCollidingEnd(localId, colliders);
 }
開發者ID:intari,項目名稱:OpenSimMirror,代碼行數:6,代碼來源:EventManager.cs

示例5: SendLandCollisionEvent

        private void SendLandCollisionEvent(SceneObjectGroup dest, scriptEvents ev, ScriptCollidingNotification notify)
        {
            if ((dest.RootPart.ScriptEvents & ev) != 0)
            {
                ColliderArgs LandCollidingMessage = new ColliderArgs();
                List<DetectedObject> colliding = new List<DetectedObject>();

                colliding.Add(CreateDetObjectForGround());
                LandCollidingMessage.Colliders = colliding;

                notify(dest.RootPart.LocalId, LandCollidingMessage);
            }
        }
開發者ID:CassieEllen,項目名稱:opensim,代碼行數:13,代碼來源:ScenePresence.cs

示例6: collision_start

        public void collision_start (ISceneChildEntity part, ColliderArgs col)
        {
            // Add to queue for all scripts in ObjectID object
            List<DetectParams> det = new List<DetectParams>();

            foreach (DetectedObject detobj in col.Colliders)
            {
                DetectParams d = new DetectParams();
                d.Key = detobj.keyUUID;
                d.Populate(part.ParentEntity.Scene);
                d.LinkNum = part.LinkNum;
                det.Add(d);
            }

            if (det.Count > 0)
            {
                ScriptData[] datas = ScriptEngine.ScriptProtection.GetScripts(part.UUID);

                if (datas == null || datas.Length == 0)
                {
                    //datas = ScriptEngine.ScriptProtection.GetScripts(part.ParentGroup.RootPart.UUID);
                    //if (datas == null || datas.Length == 0)
                        return;
                }
                string functionName = "collision_start";
                object[] param = new Object[] { new LSL_Types.LSLInteger(det.Count) };

                foreach (ScriptData ID in datas)
                {
                    if (CheckIfEventShouldFire(ID, functionName, param))
                        m_scriptEngine.AddToScriptQueue(ID, functionName, det.ToArray(), EventPriority.FirstStart, param);
                }
            }
        }
開發者ID:NickyPerian,項目名稱:Aurora-Sim,代碼行數:34,代碼來源:EventManager.cs

示例7: collision_end

        public void collision_end(uint localID, ColliderArgs col)
        {
            // Add to queue for all scripts in ObjectID object
            List<DetectParams> det = new List<DetectParams>();

            foreach (DetectedObject detobj in col.Colliders)
            {
                DetectParams d = new DetectParams();
                d.Key =detobj.keyUUID;
                d.Populate(myScriptEngine.World);
                det.Add(d);
            }

            if (det.Count > 0)
                myScriptEngine.PostObjectEvent(localID, new EventParams(
                        "collision_end",
                        new Object[] { new LSL_Types.LSLInteger(det.Count) },
                        det.ToArray()));
        }
開發者ID:RadaSangOn,項目名稱:workCore2,代碼行數:19,代碼來源:EventManager.cs

示例8: TriggerScriptLandCollidingEnd

 public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders)
 {
     ScriptColliding handlerLandCollidingEnd = OnScriptLandColliderEnd;
     if (handlerLandCollidingEnd != null)
     {
         foreach (ScriptColliding d in handlerLandCollidingEnd.GetInvocationList())
         {
             try
             {
                 d(localId, colliders);
             }
             catch (Exception e)
             {
                 m_log.ErrorFormat(
                     "[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingEnd failed - continuing.  {0} {1}", 
                     e.Message, e.StackTrace);
             }
         }
     }
 }
開發者ID:CCIR,項目名稱:opensim,代碼行數:20,代碼來源:EventManager.cs

示例9: HandleScriptColliding

 private void HandleScriptColliding(uint localID, ColliderArgs colliders)
 {
     SceneObjectPart part = m_scriptEngine.World.GetSceneObjectPart(localID);
     if (part != null)
     {
         //filter out regular collision
         //might be fun though later on
         if (part.VolumeDetectActive)
         {
             foreach (DetectedObject obj in colliders.Colliders)
             {
                 EntityBase eb = null;
                 if (m_scriptEngine.World.Entities.TryGetValue(obj.keyUUID, out eb))
                 {
                     OnPrimVolumeCollision(localID, eb.LocalId);
                 }
                 else
                     m_log.Warn("[RexScriptEngine]: Could not find object with id " + obj.keyUUID);
             }
         }
     }
     else
         m_log.Warn("[RexScriptEngine]: Could not find object with id "+localID);
 }
開發者ID:jonnenauha,項目名稱:ModreX,代碼行數:24,代碼來源:RexEventManager.cs

示例10: TriggerScriptLandColliding

 public void TriggerScriptLandColliding (ISceneChildEntity part, ColliderArgs colliders)
 {
     ScriptColliding handlerLandColliding = OnScriptLandColliding;
     if (handlerLandColliding != null)
     {
         foreach (ScriptColliding d in handlerLandColliding.GetInvocationList ())
         {
             try
             {
                 d (part, colliders);
             }
             catch (Exception e)
             {
                 MainConsole.Instance.ErrorFormat (
                     "[EVENT MANAGER]: Delegate for TriggerScriptLandColliding failed - continuing.  {0} {1}",
                     e, e.StackTrace);
             }
         }
     }
 }
開發者ID:savino1976,項目名稱:Aurora-Sim,代碼行數:20,代碼來源:ISceneEntity.cs

示例11: PhysicsCollision


//.........這裏部分代碼省略.........
                            SendSound(SoundPlasticCollision, 1, true, 0, 0, false, false);
                        else if (m_material == OpenMetaverse.Material.Rubber)
                            SendSound(SoundRubberCollision, 1, true, 0, 0, false, false);
                        else if (m_material == OpenMetaverse.Material.Stone)
                            SendSound(SoundStoneCollision, 1, true, 0, 0, false, false);
                        else if (m_material == OpenMetaverse.Material.Wood)
                            SendSound(SoundWoodCollision, 1, true, 0, 0, false, false);
                        break; //Play based on material type in prim2prim collisions

                    default:
                        break; //Unclear of what this object is, no sounds
                }
            }
            if (CollisionSprite != UUID.Zero && CollisionSoundVolume > 0.0f) // The collision volume isn't a mistake, its an SL feature/bug
            {
                // TODO: make a sprite!

            }
            if (((AggregateScriptEvents & scriptEvents.collision) != 0) ||
               ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
               ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
               ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
               ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
               ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
               (CollisionSound != UUID.Zero) ||
                PassCollisions != 2)
            {

                if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0)
                {
                    // do event notification
                    if (startedColliders.Count > 0)
                    {
                        ColliderArgs StartCollidingMessage = new ColliderArgs();
                        List<DetectedObject> colliding = new List<DetectedObject>();
                        foreach (uint localId in startedColliders)
                        {
                            if (localId == 0)
                                continue;
                            // always running this check because if the user deletes the object it would return a null reference.
                            if (m_parentGroup == null)
                                return;

                            if (m_parentGroup.Scene == null)
                                return;

                            SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
                            string data = "";
                            if (obj != null)
                            {
                                if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
                                {
                                    bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
                                    //If it is 1, it is to accept ONLY collisions from this object
                                    if (found)
                                    {
                                        DetectedObject detobj = new DetectedObject();
                                        detobj.keyUUID = obj.UUID;
                                        detobj.nameStr = obj.Name;
                                        detobj.ownerUUID = obj._ownerID;
                                        detobj.posVector = obj.AbsolutePosition;
                                        detobj.rotQuat = obj.GetWorldRotation();
                                        detobj.velVector = obj.Velocity;
                                        detobj.colliderType = 0;
                                        detobj.groupUUID = obj._groupID;
                                        colliding.Add(detobj);
開發者ID:NickyPerian,項目名稱:Aurora,代碼行數:67,代碼來源:SceneObjectPart.cs

示例12: collision_end

        public void collision_end(uint localID, ColliderArgs col)
        {
            // Add to queue for all scripts in ObjectID object
            List<DetectParams> det = new List<DetectParams>();

            foreach (DetectedObject detobj in col.Colliders)
            {
                DetectParams d = DetectParams.FromDetectedObject(detobj);
                det.Add(d);
            }

            if (det.Count > 0)
                myScriptEngine.PostObjectEvent(localID, new EventParams(
                        "collision_end",
                        new Object[] { det.Count },
                        det.ToArray()));
        }
開發者ID:kf6kjg,項目名稱:halcyon,代碼行數:17,代碼來源:EventRouter.cs

示例13: PhysicsCollision

        public void PhysicsCollision(EventArgs e)
        {
            // single threaded here
            if (e == null)
            {
                return;
            }

            CollisionEventUpdate a = (CollisionEventUpdate)e;
            Dictionary<uint, ContactPoint> collissionswith = a.m_objCollisionList;
            List<uint> thisHitColliders = new List<uint>();
            List<uint> endedColliders = new List<uint>();
            List<uint> startedColliders = new List<uint>();

            // calculate things that started colliding this time
            // and build up list of colliders this time
            foreach (uint localid in collissionswith.Keys)
            {
                if (localid != 0)
                {
                    thisHitColliders.Add(localid);
                    if (!m_lastColliders.Contains(localid))
                    {
                        startedColliders.Add(localid);
                    }

                    //m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
                }
            }

            // calculate things that ended colliding
            foreach (uint localID in m_lastColliders)
            {
                if (!thisHitColliders.Contains(localID))
                {
                    endedColliders.Add(localID);
                }
            }

            //add the items that started colliding this time to the last colliders list.
            foreach (uint localID in startedColliders)
            {
                m_lastColliders.Add(localID);
            }
            // remove things that ended colliding from the last colliders list
            foreach (uint localID in endedColliders)
            {
                m_lastColliders.Remove(localID);
            }
            if (m_parentGroup == null)
                return;
            if (m_parentGroup.IsDeleted)
                return;

            // play the sound.
            if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f)
            {
                SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0);
            }

            if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0)
            {
                // do event notification
                if (startedColliders.Count > 0)
                {
                    ColliderArgs StartCollidingMessage = new ColliderArgs();
                    List<DetectedObject> colliding = new List<DetectedObject>();
                    foreach (uint localId in startedColliders)
                    {
                        // always running this check because if the user deletes the object it would return a null reference.
                        if (m_parentGroup == null)
                            return;
                        
                        if (m_parentGroup.Scene == null)
                            return;
                        
                        SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
                        if (obj != null)
                        {
                            DetectedObject detobj = new DetectedObject();
                            detobj.keyUUID = obj.UUID;
                            detobj.nameStr = obj.Name;
                            detobj.ownerUUID = obj._ownerID;
                            detobj.posVector = obj.AbsolutePosition;
                            detobj.rotQuat = obj.GetWorldRotation();
                            detobj.velVector = obj.Velocity;
                            detobj.colliderType = 0;
                            detobj.groupUUID = obj._groupID;
                            colliding.Add(detobj);
                        }
                        else
                        {
                            ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();

                            for (int i = 0; i < avlist.Length; i++)
                            {
                                ScenePresence av = avlist[i];

                                if (av.LocalId == localId)
                                {
//.........這裏部分代碼省略.........
開發者ID:intari,項目名稱:OpenSimMirror,代碼行數:101,代碼來源:SceneObjectPart.cs

示例14: land_collision_end

        public void land_collision_end(uint localID, ColliderArgs col)
        {
            List<DetectParams> det = new List<DetectParams>();

            foreach (DetectedObject detobj in col.Colliders)
            {
                DetectParams d = new DetectParams();
                d.Position = detobj.posVector;
                d.Populate(myScriptEngine.World);
                det.Add(d);
                myScriptEngine.PostObjectEvent(localID, new EventParams(
                        "land_collision_end",
                        new Object[] { new LSL_Types.Vector3(d.Position) },
                        det.ToArray()));
            }
         }
開發者ID:RadaSangOn,項目名稱:workCore2,代碼行數:16,代碼來源:EventManager.cs

示例15: TriggerScriptLandCollidingEnd

 public void TriggerScriptLandCollidingEnd (ISceneChildEntity part, ColliderArgs colliders)
 {
     ScriptColliding handlerLandCollidingEnd = OnScriptLandColliderEnd;
     if (handlerLandCollidingEnd != null)
     {
         foreach (ScriptColliding d in handlerLandCollidingEnd.GetInvocationList ())
         {
             try
             {
                 d (part, colliders);
             }
             catch (Exception e)
             {
                 m_log.ErrorFormat (
                     "[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingEnd failed - continuing.  {0} {1}",
                     e.ToString (), e.StackTrace);
             }
         }
     }
 }
開發者ID:salahzar,項目名稱:Aurora-Sim,代碼行數:20,代碼來源:ISceneEntity.cs


注:本文中的OpenSim.Framework.ColliderArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。