当前位置: 首页>>代码示例>>C#>>正文


C# Vector3d.GetBytes方法代码示例

本文整理汇总了C#中Vector3d.GetBytes方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3d.GetBytes方法的具体用法?C# Vector3d.GetBytes怎么用?C# Vector3d.GetBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vector3d的用法示例。


在下文中一共展示了Vector3d.GetBytes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SphereEffect

        /// <summary>
        /// Create a particle swirl around a target position using a <seealso cref="ViewerEffectPacket"/> packet
        /// </summary>
        /// <param name="globalOffset">global offset</param>
        /// <param name="color">A <see cref="Color4"/> object containing the combined red, green, blue and alpha 
        /// color values of particle beam</param>
        /// <param name="duration">a float representing the duration the parcicle beam will last</param>
        /// <param name="effectID">A Unique ID for the beam</param>
        public void SphereEffect(Vector3d globalOffset, Color4 color, float duration, UUID effectID)
        {
            ViewerEffectPacket effect = new ViewerEffectPacket();

            effect.AgentData.AgentID = Client.Self.AgentID;
            effect.AgentData.SessionID = Client.Self.SessionID;

            effect.Effect = new ViewerEffectPacket.EffectBlock[1];
            effect.Effect[0] = new ViewerEffectPacket.EffectBlock();
            effect.Effect[0].AgentID = Client.Self.AgentID;
            effect.Effect[0].Color = color.GetBytes();
            effect.Effect[0].Duration = duration;
            effect.Effect[0].ID = effectID;
            effect.Effect[0].Type = (byte)EffectType.Sphere;

            byte[] typeData = new byte[56];
            Buffer.BlockCopy(UUID.Zero.GetBytes(), 0, typeData, 0, 16);
            Buffer.BlockCopy(UUID.Zero.GetBytes(), 0, typeData, 16, 16);
            Buffer.BlockCopy(globalOffset.GetBytes(), 0, typeData, 32, 24);

            effect.Effect[0].TypeData = typeData;

            Client.Network.SendPacket(effect);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:32,代码来源:AgentManager.cs

示例2: LookAtEffect

        /// <summary>
        /// Start a particle stream between an agent and an object
        /// </summary>
        /// <param name="sourceAvatar"><seealso cref="UUID"/> Key of the source agent</param>
        /// <param name="targetObject"><seealso cref="UUID"/> Key of the target object</param>
        /// <param name="globalOffset">A <seealso cref="Vector3d"/> representing the beams offset from the source</param>
        /// <param name="type">A <seealso cref="T:PointAtType"/> which sets the avatars lookat animation</param>
        /// <param name="effectID"><seealso cref="UUID"/> of the Effect</param>
        public void LookAtEffect(UUID sourceAvatar, UUID targetObject, Vector3d globalOffset, LookAtType type,
            UUID effectID)
        {
            ViewerEffectPacket effect = new ViewerEffectPacket();

            effect.AgentData.AgentID = Client.Self.AgentID;
            effect.AgentData.SessionID = Client.Self.SessionID;

            float duration;

            switch (type)
            {
                case LookAtType.Clear:
                    duration = 2.0f;
                    break;
                case LookAtType.Hover:
                    duration = 1.0f;
                    break;
                case LookAtType.FreeLook:
                    duration = 2.0f;
                    break;
                case LookAtType.Idle:
                    duration = 3.0f;
                    break;
                case LookAtType.AutoListen:
                case LookAtType.Respond:
                    duration = 4.0f;
                    break;
                case LookAtType.None:
                case LookAtType.Select:
                case LookAtType.Focus:
                case LookAtType.Mouselook:
                    duration = Single.MaxValue / 2.0f;
                    break;
                default:
                    duration = 0.0f;
                    break;
            }

            effect.Effect = new ViewerEffectPacket.EffectBlock[1];
            effect.Effect[0] = new ViewerEffectPacket.EffectBlock();
            effect.Effect[0].AgentID = Client.Self.AgentID;
            effect.Effect[0].Color = new byte[4];
            effect.Effect[0].Duration = duration;
            effect.Effect[0].ID = effectID;
            effect.Effect[0].Type = (byte)EffectType.LookAt;

            byte[] typeData = new byte[57];
            Buffer.BlockCopy(sourceAvatar.GetBytes(), 0, typeData, 0, 16);
            Buffer.BlockCopy(targetObject.GetBytes(), 0, typeData, 16, 16);
            Buffer.BlockCopy(globalOffset.GetBytes(), 0, typeData, 32, 24);
            typeData[56] = (byte)type;

            effect.Effect[0].TypeData = typeData;

            Client.Network.SendPacket(effect);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:65,代码来源:AgentManager.cs

示例3: PointAtEffect

        /// <summary>
        /// Start a particle stream between an agent and an object
        /// </summary>
        /// <param name="sourceAvatar"><seealso cref="UUID"/> Key of the source agent</param>
        /// <param name="targetObject"><seealso cref="UUID"/> Key of the target object</param>
        /// <param name="globalOffset"></param>
        /// <param name="type">The type from the <seealso cref="T:PointAtType"/> enum</param>
        /// <param name="effectID">A unique <seealso cref="UUID"/> for this effect</param>
        public void PointAtEffect(UUID sourceAvatar, UUID targetObject, Vector3d globalOffset, PointAtType type,
            UUID effectID)
        {
            ViewerEffectPacket effect = new ViewerEffectPacket();

            effect.AgentData.AgentID = Client.Self.AgentID;
            effect.AgentData.SessionID = Client.Self.SessionID;

            effect.Effect = new ViewerEffectPacket.EffectBlock[1];
            effect.Effect[0] = new ViewerEffectPacket.EffectBlock();
            effect.Effect[0].AgentID = Client.Self.AgentID;
            effect.Effect[0].Color = new byte[4];
            effect.Effect[0].Duration = (type == PointAtType.Clear) ? 0.0f : Single.MaxValue / 4.0f;
            effect.Effect[0].ID = effectID;
            effect.Effect[0].Type = (byte)EffectType.PointAt;

            byte[] typeData = new byte[57];
            if (sourceAvatar != UUID.Zero)
                Buffer.BlockCopy(sourceAvatar.GetBytes(), 0, typeData, 0, 16);
            if (targetObject != UUID.Zero)
                Buffer.BlockCopy(targetObject.GetBytes(), 0, typeData, 16, 16);
            Buffer.BlockCopy(globalOffset.GetBytes(), 0, typeData, 32, 24);
            typeData[56] = (byte)type;

            effect.Effect[0].TypeData = typeData;

            Client.Network.SendPacket(effect);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:36,代码来源:AgentManager.cs

示例4: OutViewerEffectHandler

        private Packet OutViewerEffectHandler(Packet packet, IPEndPoint sim)
        {
            if (form.Mode != xtrafxMode.Disabled)
            {
                ViewerEffectPacket ViewerEffect = (ViewerEffectPacket)packet;
                bool inject = false;
                foreach (ViewerEffectPacket.EffectBlock effect in ViewerEffect.Effect)
                {
                    if (effect.Type == (byte)EffectType.Beam)
                    {

                        if (form.Mode == xtrafxMode.Speak)
                        {
                            oldTime = System.Environment.TickCount;
                            Vector3d newVec = new Vector3d(effect.TypeData, 32);

                            if (curentOn == false)
                            {
                                shoutOut(9000, "start");
                                curentOn = true;
                            }
                            if ((lastVec.Equals(newVec) == false))
                            {

                                lastVec = newVec;
                                shoutOut(9000, this.lastVec.ToString());
                            }
                            return null;

                        }

                        inject = true;
                        Buffer.BlockCopy(
                            plugin.SharedInfo.rainbow[form.xtrafx_Index], 0, effect.Color, 0, 4);
                        form.xtrafx_Index++;

                        if (form.xtrafx_Index >= plugin.SharedInfo.rainbow.Length)
                        {
                            form.xtrafx_Index = 0;
                        }

                        if (form.Mode == xtrafxMode.Quad)
                        {
                            // trial: multi-beam
                            Vector3d position = new Vector3d(effect.TypeData, 32);
                            Logger.Log("Sending a effect to " + Utils.BytesToHexString(effect.TypeData,"effect"), Helpers.LogLevel.Info);
                            ViewerEffectPacket[][][] ve = new ViewerEffectPacket[2][][];
                            for (int x = 0; x < 2; x++)
                            {
                                ve[x] = new ViewerEffectPacket[2][];
                                for (int y = 0; y < 2; y++)
                                {
                                    ve[x][y] = new ViewerEffectPacket[2];
                                    for (int z = 0; z < 2; z++)
                                    {
                                        ve[x][y][z] = new ViewerEffectPacket();
                                        ve[x][y][z].HasVariableBlocks = true;
                                        ve[x][y][z].Type = PacketType.ViewerEffect;
                                        ve[x][y][z].AgentData = new ViewerEffectPacket.AgentDataBlock();
                                        ve[x][y][z].AgentData.AgentID = frame.AgentID;
                                        ve[x][y][z].AgentData.SessionID = frame.SessionID;
                                        ve[x][y][z].Effect = new ViewerEffectPacket.EffectBlock[1];
                                        ve[x][y][z].Effect[0] = new ViewerEffectPacket.EffectBlock();
                                        ve[x][y][z].Effect[0].ID = UUID.Random();
                                        ve[x][y][z].Effect[0].AgentID = effect.AgentID;
                                        ve[x][y][z].Effect[0].Type = effect.Type;
                                        ve[x][y][z].Effect[0].Duration = effect.Duration;
                                        ve[x][y][z].Effect[0].Color = effect.Color;
                                        ve[x][y][z].Effect[0].TypeData = effect.TypeData;
                                        double ox = ((double)x - 0.5f);
                                        double oy = ((double)y - 0.5f);
                                        double oz = ((double)z - 0.5f);
                                        Vector3d pos = new Vector3d(ox + position.X, oy + position.Y, oz + position.Z);
                                        Buffer.BlockCopy(pos.GetBytes(), 0, ve[x][y][z].Effect[0].TypeData, 32, 24);
                                        ve[x][y][z].Header.Reliable = false;
                                        proxy.InjectPacket(ve[x][y][z], Direction.Outgoing);
                                    }
                                }
                            }
                        }
                        if (form.Mode == xtrafxMode.Circles)
                        {
                            Vector3d TargetPosition = new Vector3d(effect.TypeData, 32);
                            int MapX = ((int)(plugin.SharedInfo.RegionHandle >> 32) );
                            int MapY = ((int)(plugin.SharedInfo.RegionHandle & 0x00000000FFFFFFFF) );
                            Vector3d myPos = new Vector3d(
                                MapX + plugin.SharedInfo.AvPosition.X,
                                MapY + plugin.SharedInfo.AvPosition.Y,
                                 plugin.SharedInfo.AvPosition.Z);
                            Vector3d myLine = TargetPosition - myPos;
                            float duration = effect.Duration * (float)(((double)38 - (myLine.Length()*(2/3))) / 20);
                            if (duration > effect.Duration) duration = effect.Duration;

                            //proxy.writethis("my pos is " + myPos.ToString() + " and target is " + TargetPosition.ToString() + " and myline is " + myLine.ToString(),ConsoleColor.Cyan,ConsoleColor.Black);
                            for (float i = 0; i < (float)Math.Round(myLine.Length()); i+=1.0F)
                            {
                                Vector3d circlePos = myPos + (Vector3d.Normalize(myLine)*i);
                               sendSwirlPoint(circlePos,effect.Color,duration);
                            }
                            sendSwirlPoint(TargetPosition,effect.Color, duration);
//.........这里部分代码省略.........
开发者ID:zadark,项目名称:par,代码行数:101,代码来源:RainbowParticles.cs

示例5: sendSwirlPoint

        public void sendSwirlPoint(Vector3d vec,byte[] color, float dur)
        {
            ViewerEffectPacket v = new ViewerEffectPacket();
            v.Type = PacketType.ViewerEffect;
            v.HasVariableBlocks = true;
            v.AgentData = new ViewerEffectPacket.AgentDataBlock();
            v.AgentData.AgentID = frame.AgentID;
            v.AgentData.SessionID = frame.SessionID;
            v.Effect = new ViewerEffectPacket.EffectBlock[1];
            v.Effect[0] = new ViewerEffectPacket.EffectBlock();
            v.Effect[0].ID = UUID.Random();
            v.Effect[0].AgentID = frame.AgentID;
            v.Effect[0].Type = (byte)EffectType.Beam;
            v.Effect[0].Duration = dur;
            v.Effect[0].Color = color;
            v.Effect[0].TypeData = new byte[56];
                Buffer.BlockCopy(UUID.Zero.GetBytes(),0,v.Effect[0].TypeData,0,16);
                Buffer.BlockCopy(UUID.Zero.GetBytes(),0,v.Effect[0].TypeData,16,16);
                Buffer.BlockCopy(vec.GetBytes(), 0, v.Effect[0].TypeData, 32, 24);

            v.Header.Reliable = false;
            v.Header.Resent = false;
            proxy.InjectPacket(v, Direction.Outgoing);
        }
开发者ID:zadark,项目名称:par,代码行数:24,代码来源:RainbowParticles.cs

示例6: BeamEffect

        /// <summary>
        /// Create a particle beam between an avatar and an primitive
        /// </summary>
        /// <param name="sourceAvatar"><seealso cref="Guid"/> of sources avatar</param>
        /// <param name="targetObject"><seealso cref="Guid"/> of the target</param>
        /// <param name="globalOffset"><seealso cref="Vector3d"/>global offset</param>
        /// <param name="color"><seealso cref="Color4"/>Color values of beam</param>
        /// <param name="duration">a float representing the duration the beam will last</param>
        /// <param name="effectID"><seealso cref="Guid"/> of the Effect</param>
        public void BeamEffect(Guid sourceAvatar, Guid targetObject, Vector3d globalOffset, Color4 color,
            float duration, Guid effectID)
        {
            ViewerEffectPacket effect = new ViewerEffectPacket();

            effect.AgentData.AgentID = Client.Self.AgentID;
            effect.AgentData.SessionID = Client.Self.SessionID;

            effect.Effect = new ViewerEffectPacket.EffectBlock[1];
            effect.Effect[0] = new ViewerEffectPacket.EffectBlock();
            effect.Effect[0].AgentID = Client.Self.AgentID;
            effect.Effect[0].Color = color.GetBytes();
            effect.Effect[0].Duration = duration;
            effect.Effect[0].ID = effectID;
            effect.Effect[0].Type = (byte)EffectType.Beam;

            byte[] typeData = new byte[56];
            Buffer.BlockCopy(sourceAvatar.GetBytes(), 0, typeData, 0, 16);
            Buffer.BlockCopy(targetObject.GetBytes(), 0, typeData, 16, 16);
            Buffer.BlockCopy(globalOffset.GetBytes(), 0, typeData, 32, 24);

            effect.Effect[0].TypeData = typeData;

            Client.Network.SendPacket(effect);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:34,代码来源:AgentManager.cs


注:本文中的Vector3d.GetBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。