Пример #1
0
        void CheckBlocks(Position pos)
        {
            try {
                Vec3U16 P     = (Vec3U16)pos.BlockCoords;
                AABB    bb    = ModelBB.OffsetPosition(Pos);
                int     index = level.PosToInt(P.X, P.Y, P.Z);

                if (level.Config.SurvivalDeath)
                {
                    PlayerPhysics.Drown(this, bb);
                    PlayerPhysics.Fall(this, bb);
                }
                lastFallY = bb.Min.Y;

                PlayerPhysics.Walkthrough(this, bb);
                oldIndex = index;
            } catch (Exception ex) {
                Logger.LogError(ex);
            }
        }
Пример #2
0
        public static byte[] MakeSelection(byte id, string label, Vec3U16 p1, Vec3U16 p2,
                                           short r, short g, short b, short opacity)
        {
            byte[] buffer = new byte[86];
            buffer[0] = Opcode.CpeMakeSelection;
            buffer[1] = id;
            NetUtils.WriteAscii(label, buffer, 2);

            NetUtils.WriteU16(p1.X, buffer, 66);
            NetUtils.WriteU16(p1.Y, buffer, 68);
            NetUtils.WriteU16(p1.Z, buffer, 70);
            NetUtils.WriteU16(p2.X, buffer, 72);
            NetUtils.WriteU16(p2.Y, buffer, 74);
            NetUtils.WriteU16(p2.Z, buffer, 76);

            NetUtils.WriteI16(r, buffer, 78);
            NetUtils.WriteI16(g, buffer, 80);
            NetUtils.WriteI16(b, buffer, 82);
            NetUtils.WriteI16(opacity, buffer, 84);
            return(buffer);
        }
Пример #3
0
 /// <summary> Returns whether the given coordinates lie within this level's boundaries </summary>
 public bool IsValidPos(Vec3U16 pos)
 {
     return(pos.X < Width && pos.Y < Height && pos.Z < Length);
 }
Пример #4
0
 public static Vec3U16 Min(Vec3U16 a, Vec3U16 b)
 {
     return(new Vec3U16(Math.Min(a.X, b.X), Math.Min(a.Y, b.Y), Math.Min(a.Z, b.Z)));
 }
Пример #5
0
 public Vec3U16 Min(Vec3U16 b)
 {
     return(Min(this, b));
 }
Пример #6
0
 public Vec3U16 Max(Vec3U16 b)
 {
     return(Max(this, b));
 }
Пример #7
0
 public float Dot(Vec3U16 b)
 {
     return(X * b.X + Y * b.Y + Z * b.Z);
 }
Пример #8
0
 public bool Equals(Vec3U16 other)
 {
     return(X == other.X & Y == other.Y && Z == other.Z);
 }