Пример #1
0
 /// <summary>
 /// Crea un nuevo jumper.
 /// </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 jumnper.</param>
 public void crearJumper(int x, int y, int z, Cubo c)
 {
     //Si el cubo contiene un hueco lo borra.
     if (c.Hole != null)
     {
         Components.Remove(c.Hole);
         c.Hole = null;
     }
     Vector3 position = new Vector3(x, y, z);
     foreach (GameObject o in Components)
     {
         if (o.Position == position)
             return;
     }
     Jumper j = new Jumper(this, position, SIZE_ESCALERA);
     Components.Add(j);
     //Añade el hueco al cubo.
     c.Jumper = j;
 }
Пример #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();
        }