Ejemplo n.º 1
0
        private PointF DefineSpawn(PointI ready)
        {
            var chunk = World[ready];

            for (byte x = 0; x < Chunk <Block> .XLength; x++)
            {
                for (byte z = 0; z < Chunk <Block> .ZLength; z++)
                {
                    for (byte y = 253; y > 0; y--)
                    {
                        var p0 = new PointB(x, y, z);
                        var p1 = new PointB(x, (byte)(y + 1), z);
                        var p2 = new PointB(x, (byte)(y + 2), z);
                        if (chunk[p0] != null && chunk[p1] == null && chunk[p2] == null)
                        {
                            return((BlockWorld.GetAbsolutePosition(p1, ready).AsVector() + new Vector3(0.5f, 0, 0.5f))
                                   .AsPointF());
                        }
                    }
                }
            }

            throw new ArgumentException("Не удалось найти подходящего для спавна места", ready.ToString());
        }