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


C# Utils.Vector3S类代码示例

本文整理汇总了C#中MCForge.Utils.Vector3S的典型用法代码示例。如果您正苦于以下问题:C# Vector3S类的具体用法?C# Vector3S怎么用?C# Vector3S使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Vector3S类属于MCForge.Utils命名空间,在下文中一共展示了Vector3S类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadVector3SArray

 static Vector3S[] ReadVector3SArray(this BinaryReader br) {
     Vector3S[] ret = new Vector3S[br.ReadInt32()];
     for (int i = 0; i < ret.Length; i++) {
         ret[i] = br.ReadVector3S();
     }
     return ret;
 }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:7,代码来源:BinaryUtils.cs

示例2: CatchBlock2

 public void CatchBlock2(Player sender, BlockChangeEventArgs args)
 {
     args.Unregister();
     Vector3S FirstBlock = (Vector3S)sender.GetDatapass("CmdDatapassExample_FirstBlock");
     Vector3S SecondBlock = new Vector3S(args.X, args.Z, args.Y);
     sender.SendMessage("This is where we would initiate a Cuboid!");
 }
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:7,代码来源:CmdDatapassExample.cs

示例3: BlockString

        //TODO: fix if target is to close at origin
        IEnumerable<Vector3S> BlockString(string text, Vector3S origin, Vector3S target, Vector3S lvlSize) {
            Font font = new Font("Sans-serief",12);
            Image tmp = new Bitmap(1000, 1000);
            Bitmap img = new Bitmap((int)Graphics.FromImage(tmp).MeasureString(text, font).Width, (int)Graphics.FromImage(tmp).MeasureString(text, font).Height);
            tmp = null;
            Graphics g = Graphics.FromImage(img);
            g.FillRectangle(Brushes.White, 0, 0, img.Width, img.Height);
            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel;
            g.DrawString(text, font, Brushes.Black, new PointF(0, 0));
            List<Vector3S> path = new List<Vector3S>();
            foreach (Vector3S p in origin.PathTo(target)) {
                path.Add(p);
            }
            if (path.Count < 2) yield break;
            for (int x = 0; x < img.Width; x++) {
                for (int y = 0; y < img.Height; y++) {
                    if (img.GetPixel(x, y).ToArgb() != Color.White.ToArgb()) {
                        Vector3S ret = new Vector3S();
                        ret.x = (short)(origin.x + ((path[x % path.Count].x - origin.x) + (path[path.Count - 1].x - origin.x + path[1].x - origin.x) * (x / path.Count)));
                        ret.y = (short)(origin.y + ((path[x % path.Count].y - origin.y) + (path[path.Count - 1].y - origin.y + path[1].y - origin.y) * (x / path.Count)) + img.Height - y);
                        ret.z = (short)(origin.z + ((path[x % path.Count].z - origin.z) + (path[path.Count - 1].z - origin.z + path[1].z - origin.z) * (x / path.Count)));
                        if (ret.x < lvlSize.x && ret.y < lvlSize.y && ret.z < lvlSize.z && ret.x >= 0 && ret.y >= 0 && ret.z >= 0)
                            yield return ret;
                    }
                }
            }

        }
开发者ID:nullpic,项目名称:MCForge-Vanilla,代码行数:29,代码来源:CmdWrite.cs

示例4: Use

 public void Use(Entity.Player p, string[] args) {
     if (args.Length == 1 && args[0] == "stop") {
         p.OnPlayerRotate.Normal -= OnPlayerRotate_Normal;
         p.OnPlayerMove.Normal -= OnPlayerMove_Normal;
         p.OnPlayerBigMove.Normal -= OnPlayerBigMove_Normal;
         p.OnPlayerBlockChange.Normal -= OnPlayerBlockChange_Normal;
         if (p.ExtraData["Cursor"] != null) {
             Vector3S old;
             if (p.ExtraData["Cursor"].GetType() == typeof(Vector3S))
                 old = (Vector3S)p.ExtraData["Cursor"];
             else {
                 old = new Vector3S();
                 old.FromString((string)p.ExtraData["Cursor"]);
             }
             p.SendBlockChange((ushort)old.x, (ushort)old.z, (ushort)old.y, p.Level.GetBlock(old));
             p.ExtraData["Cursor"] = null;
         }
         if (p.ExtraData["CursorGlassCenter"] != null) {
             Vector3S old;
             if (p.ExtraData["CursorGlassCenter"].GetType() == typeof(Vector3S))
                 old = (Vector3S)p.ExtraData["CursorGlassCenter"];
             else {
                 old = new Vector3S();
                 old.FromString((string)p.ExtraData["CursorGlassCenter"]);
             }
             p.ResendBlockChange(surrounder, old);
         }
         return;
     }
     p.OnPlayerRotate.Normal += OnPlayerRotate_Normal;
     p.OnPlayerMove.Normal += OnPlayerMove_Normal;
     p.OnPlayerBigMove.Normal += OnPlayerBigMove_Normal;
     p.OnPlayerBlockChange.Normal += OnPlayerBlockChange_Normal;
 }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:34,代码来源:CmdCursor.cs

示例5: ReadVector3S

 static Vector3S ReadVector3S(this BinaryReader br) {
     Vector3S ret = new Vector3S();
     ret.x = br.ReadInt16();
     ret.z = br.ReadInt16();
     ret.y = br.ReadInt16();
     return ret;
 }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:7,代码来源:BinaryUtils.cs

示例6: Vector3S

 IEnumerable<Utils.Vector3S> IBrush.Draw(Vector3S pos, byte block, int size) {
     Vector3S mVec = pos - (size  / 2);
     for (ushort x= 0; x < size; x++)
         for (ushort y = 0; y < size; y++)
             for (short z = 0; z < size; z++) 
                 yield return new Vector3S((ushort)(x + mVec.x),(ushort) (z + mVec.z ) , (ushort)( y + mVec.y));
     yield return pos;
 }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:8,代码来源:CubeBrush.cs

示例7: Level

        private Level(Vector3S size)
        {
            Size = size;
            //data = new byte[Size.x, Size.z, Size.y];
            Data = new byte[TotalBlocks];

            ExtraData = new Dictionary<object, object>();
        }
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:8,代码来源:Level.cs

示例8: CatchBlock

 public void CatchBlock(Player sender, BlockChangeEventArgs args)
 {
     args.Unregister();
     Vector3S FirstBlock = new Vector3S(args.X, args.Z, args.Y);
     sender.SendMessage("Please place another block...");
     sender.SetDatapass("CmdDatapassExample_FirstBlock", FirstBlock);
     sender.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2);
 }
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:8,代码来源:CmdDatapassExample.cs

示例9: onlyAirBetween

 bool onlyAirBetween(Vector3S start, Vector3S end)
 {
     Vector3D s = new Vector3D(start);
     Vector3D e = new Vector3D(end);
     while ((s - e).Length > 1) {
         if (AirMap[(int)s.x, (int)s.z, (int)s.y] == TriBool.True) return false;
     }
     return true;
 }
开发者ID:headdetect,项目名称:MCForge6-Vanilla,代码行数:9,代码来源:BotMap.cs

示例10: PacketSpawnPlayer

 /// <summary>
 /// Initializes a new instance of the <see cref="PacketSpawnPlayer"/> class.
 /// </summary>
 public PacketSpawnPlayer(byte ID, string Name, Vector3S Location, byte Yaw, byte Pitch)
     : base(PacketIDs.SpawnPlayer)
 {
     this.ID = ID;
     this.Location = Location;
     this.Yaw = Yaw;
     this.Pitch = Pitch;
     this.Name = Name;
 }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:12,代码来源:PacketSpawnPlayer.cs

示例11: Add

 /// <summary>
 /// Returns false if the message was only updated
 /// </summary>
 /// <param name="l"></param>
 /// <param name="v"></param>
 /// <param name="message"></param>
 /// <returns></returns>
 public bool Add(Level l, Vector3S v, string message)
 {
     bool ret = false;
     if (!store[l.Name].Contains(v)) {
         store[l.Name].Add(v);
         ret = true;
     }
     l.ExtraData["MessageBlock" + v] = message;
     return ret;
 }
开发者ID:headdetect,项目名称:MCForge6-Vanilla,代码行数:17,代码来源:PluginMessageBlock.cs

示例12: Use

 public void Use(Player p, string[] args)
 {
     if (args.Count() != 0)
     {
         Help(p);
         return;
     }
     Vector3S meep = new Vector3S((short)(p.Level.SpawnPos.x * 32), (short)(p.Level.SpawnPos.z * 32 + 51), (short)(p.Level.SpawnPos.y * 32));
     p.SendToPos(meep, p.Level.SpawnRot);
 }
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:10,代码来源:CmdSpawn.cs

示例13: Use

 public void Use(Player p, string[] args)
 {
     if (args.Count() != 0)
     {
         Help(p);
         return;
     }
     Vector3S meep = new Vector3S((short)(p.Pos.x / 32), (short)(p.Pos.z / 32), (short)(p.Pos.y / 32));
     p.Level.SpawnPos = meep;
     p.Level.SpawnRot = p.Rot;
     p.SendMessage("Spawn location changed.");
 }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:12,代码来源:CmdSetSpawn.cs

示例14: ReadPacket

        public override void ReadPacket(byte[] data) {
            Position = new Vector3S(){
                x = ReadShort(data, 0),
                y = ReadShort(data, 2),
                z = ReadShort(data, 4)
            };

            BlockDeleted = data[5] == 0x00;

            Block = data[6];

        }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:12,代码来源:PacketPlayerSetBlock.cs

示例15: BC2

 public void BC2(Player p, BlockChangeEventArgs args)
 {
     Vector3S _s = new Vector3S();
     p.ExtraData["Mark2"] = new Vector3S(args.X, args.Z, args.Y);
     p.SendMessage("Second coordinate marked. (" + args.X + ", " + args.Z + ", " + args.Y + ")");
     args.Unregister();
     args.Cancel();
     Vector3S m1 = (Vector3S)p.ExtraData["Mark1"];
     Vector3S m2 = (Vector3S)p.ExtraData["Mark2"];
     p.SendMessage("Marked coordinates:");
     p.SendMessage("(" + m1.x + ", " + m1.z + ", " + m1.y + "), (" + m2.x + ", " + m2.z + ", " + m2.y + ")");
     p.ExtraData["HasMarked"] = true;
 }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:13,代码来源:CmdSelect.cs


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