Ejemplo n.º 1
0
        public void loadMap(char[][] map)
        {
            int rows = map.Length;
            int cols = map.Max(subArray => subArray.Length);

            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < cols; j++)
                {
                    if (map[i][j] == 'P')
                    {
                        Cube c = new Cube(new Vector3(j, 0.5f, i));
                        c.LoadContent(Content);
                        cubeMap.Add(c);
                    }
                    if (map[i][j] == 'I')
                    {
                        player.position = new Vector3(j, 0.5f, i);
                    }
                    if (map[i][j] == 'T')
                    {
                        Booster b = new Booster(new Vector3(j, 0.5f, i));
                        b.LoadContent(Content);
                        timeBoosters.Add(b);
                    }
                    if (map[i][j] == 'F')
                    {
                        finalBlock = new FinalBlock(new Vector3(j, 0.5f, i));
                        finalBlock.LoadContent(Content);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public bool CheckForCollisions(FinalBlock modelo)
 {
     for (int i = 0; i < model.Meshes.Count; i++)
     {
         BoundingSphere boundingSphere;
         boundingSphere.Radius = 0.6f;
         boundingSphere.Center = _position;
         for (int j = 0; j < modelo.model.Meshes.Count; j++)
         {
             BoundingSphere otherBoundingSphere = modelo.model.Meshes[j].BoundingSphere;
             otherBoundingSphere.Radius = 0.6f;
             otherBoundingSphere.Center = modelo.position;
             if (boundingSphere.Intersects(otherBoundingSphere))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Ejemplo n.º 3
0
 public bool CheckForCollisions(FinalBlock modelo)
 {
     for (int i = 0; i < model.Meshes.Count; i++)
     {
         BoundingSphere boundingSphere;
         boundingSphere.Radius = 0.6f;
         boundingSphere.Center = _position;
         for (int j = 0; j < modelo.model.Meshes.Count; j++)
         {
             BoundingSphere otherBoundingSphere = modelo.model.Meshes[j].BoundingSphere;
             otherBoundingSphere.Radius = 0.6f;
             otherBoundingSphere.Center = modelo.position;
             if (boundingSphere.Intersects(otherBoundingSphere))
                 return true;
         }
     }
     return false;
 }
Ejemplo n.º 4
0
        public void loadMap(char[][] map)
        {
            int rows = map.Length;
            int cols = map.Max(subArray => subArray.Length);

            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < cols; j++)
                {
                    if (map[i][j] == 'P')
                    {
                        Cube c = new Cube(new Vector3(j, 0.5f, i));
                        c.LoadContent(Content);
                        cubeMap.Add(c);
                    }
                    if (map[i][j] == 'I')
                    {
                        player.position = new Vector3(j, 0.5f, i);
                    }
                    if (map[i][j] == 'T')
                    {
                        Booster b = new Booster(new Vector3(j, 0.5f, i));
                        b.LoadContent(Content);
                        timeBoosters.Add(b);
                    }
                    if (map[i][j] == 'F')
                    {
                        finalBlock = new FinalBlock(new Vector3(j, 0.5f, i));
                        finalBlock.LoadContent(Content);
                    }
                }
            }
        }