示例#1
0
        /// <summary>
        /// Crea un nuevo hueco.
        /// </summary>
        /// <param name="x">Coordenada en x.</param>
        /// <param name="y">Coordenada en y.</param>
        /// <param name="z">Coordenada en z.</param>
        /// <param name="c">Cubo en el cual esta el hueco.</param>
        public void crearHueco(int x, int y, int z, Cubo c)
        {
            //Si el cubo contiene un jumper lo borra.
            if (c.Jumper != null)
            {
                Components.Remove(c.Jumper);
                c.Jumper = null;
            }

            Vector3 position = new Vector3(x, y, z);
            foreach (GameObject o in Components)
            {
                if (o.Position == position)
                    return;
            }
            Hole h = new Hole(this, position, SIZE_ESCALERA);
            Components.Add(h);
            //Añade el hueco al cubo.
            c.Hole = h;
        }
示例#2
0
        /// <summary>
        /// Carga el contenido inicial del cubo.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            //El cubo empieza sin hueco ni jumper.
            hole = null;
            jumper = null;
            //Se crean los vertices iniciales del cubo
            vertices = new Vector3[8];
            //Top Left front
            vertices[0] = new Vector3(-1, 1, 1);
            //Top Right front
            vertices[1] = new Vector3(1, 1, 1);
            //Down Right front
            vertices[2] = new Vector3(1, -1, 1);
            //Down Left front
            vertices[3] = new Vector3(-1, -1, 1);
            //Down Right back
            vertices[4] = new Vector3(-1, -1, -1);
            //Top Right back
            vertices[5] = new Vector3(-1, 1, -1);
            //Top Left back
            vertices[6] = new Vector3(1, 1, -1);
            //Down Left back
            vertices[7] = new Vector3(1, -1, -1);

            //Bounding box del cubo.
            boundingBox = BoundingBox.CreateFromPoints(vertices);

            //Lista con los cubos adyacentes a este, ayuda a opimizar calculos.
            cubosAdyacentes = new List<Cubo>();

            setVertices();
        }