Beispiel #1
0
 /// <summary>Raises the MeanCollision event</summary>
 /// <param name="e">A MeanCollisionEventArgs object containing the
 /// data returned from the data server</param>
 protected virtual void OnMeanCollision(MeanCollisionEventArgs e)
 {
     EventHandler<MeanCollisionEventArgs> handler = m_MeanCollision;
     if (handler != null)
         handler(this, e);
 }
Beispiel #2
0
 public override void Self_OnMeanCollision(object sender, MeanCollisionEventArgs e)
 {
     if (!MaintainEffects) return;
         EventQueue.Enqueue(() =>
         {
             SimObject perpAv, victimAv;
             if (TryGetSimObject(e.Aggressor, out perpAv) &&
                 TryGetSimObject(e.Victim, out victimAv))
             {
                 // if (victimAv.Name == client.Self.Name)
                 //   WriteLine(perpAv.Name + " bumped into $bot like " + type);
                 // else if (perpAv.Name == client.Self.Name)
                 //   WriteLine("$bot bumped into " + victimAv.Name + " like " + type);   
                 CogbotEvent newSimObjectEvent = ACogbotEvent.CreateEvent(sender,
                                             "MeanCollisionType-" + e.Type, SimEventType.Once | SimEventType.SOCIAL | SimEventType.REGIONAL,
                                             ToParameter("primaryObjectMoving", perpAv),
                                             ToParameter("objectActedOn", victimAv),
                                             ToParameter("initialSpeedOfPrimaryObjectMoving", "MetersPerSecond", e.Magnitude));
                 perpAv.LogEvent(newSimObjectEvent);
             }
         });
 }
Beispiel #3
0
 public virtual void Self_OnMeanCollision(object sender, MeanCollisionEventArgs e) { OnEvent("On-Mean-Collision", paramNamesOnMeanCollision, paramTypesOnMeanCollision, e); }
Beispiel #4
0
        // Test
        private void Network_MeanCollisionAlertHandler(object sender, PacketReceivedEventArgs e)
        {
            Debug.WriteLine("collision detected ");

            var packet = e.Packet;

            MeanCollisionAlertPacket collision = (MeanCollisionAlertPacket)packet;

            for (int i = 0; i < collision.MeanCollision.Length; i++)
            {
                MeanCollisionAlertPacket.MeanCollisionBlock block = collision.MeanCollision[i];

                DateTime time = Utils.UnixTimeToDateTime(block.Time);
                MeanCollisionType type = (MeanCollisionType)block.Type;

                //Self_OnMeanCollision(e.Simulator, new MeanCollisionEventArgs(type, block.Perp, block.Victim, block.Mag, time));
                MeanCollisionEventArgs mc = new MeanCollisionEventArgs(type, block.Perp, block.Victim, block.Mag, time);
                Debug.WriteLine("Attacker = " + mc.Aggressor);
            }
        }
Beispiel #5
0
        // Seperate thread
        private void Self_Collision(object sender, MeanCollisionEventArgs e)
        {
            // The av has collided with an object or avatar

            string cty = string.Empty;

            try
            {
                BeginInvoke(new MethodInvoker(delegate()
                {
                    if (e.Type == MeanCollisionType.Bump)
                    {
                        cty = "Bumped in by: (" + e.Time.ToString(CultureInfo.CurrentCulture) + " - " + e.Magnitude.ToString(CultureInfo.CurrentCulture) + "): ";
                    }
                    else if (e.Type == MeanCollisionType.LLPushObject)
                    {
                        cty = "Pushed by: (" + e.Time.ToString(CultureInfo.CurrentCulture) + " - " + e.Magnitude.ToString(CultureInfo.CurrentCulture) + "): ";
                    }
                    else if (e.Type == MeanCollisionType.PhysicalObjectCollide)
                    {
                        cty = "Physical object collided (" + e.Time.ToString() + " - " + e.Magnitude.ToString(CultureInfo.CurrentCulture) + "): ";
                    }

                    chatManager.PrintAlertMessage(cty + e.Aggressor.ToString());
                }));
            }
            catch
            {
               ;
            }
        }