Ejemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            //GL.ShadeModel (All.Flat);
            GL.ShadeModel(All.Smooth);
            GL.ClearColor(0, 0, 0, 1);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            GL.ClearDepth(1.0f);
            GL.Enable(All.DepthTest);
            GL.DepthFunc(All.Lequal);

            GLTextureAdmin.UnLoadGLTextures();
            GLTextureAdmin.AddTexturesFromResource(Context, new string[]
                                                   { "earth", "moon", "tex", "darkgray", "f_spot", "pattern", "borg" });

            _scene.LoadFromAndroidAsset(Context, "scene.xml");

            var ent = _scene.GetObjectByName("Enterprise") as GLSpaceShip;

            ent.MoveToCenter();
            ent.Magnify(0.12);
            ent.OrbitEllipse.RadiusMajor = 6;
            ent.OrbitEllipse.RadiusMinor = 5;
            ent.OrbitAngle = 90;

            SetupCamera();
        }
Ejemplo n.º 2
0
        public void NewLevel()
        {
            GLTextureAdmin.UnLoadGLTextures();

            GLTextureAdmin.AddTexturesFromResource(Context, new string[]
            {
                "blue0", "blue1", "labBottomF", "labBottomL", "labBottomS",
                "labTop", "labTopF", "labTopL", "labTopS",
                "labWall0", "labWall1", "labWall2", "labWall3",
                "labWallF", "labWallL", "labWallS",
                "money", "moneySmall", "blue0", "labBottom"
            });

            var labyrinth = (_scene.GetObjectByName("labyrinth") as GLLabyrinthObj);

            int moves;
            int items;

            if (labyrinth.Level <= 5) // 1 .. 5 level => 5 * 2 .. 25 * 10
            {
                moves = labyrinth.Level * 5;
                items = labyrinth.Level * 2;
            }
            else
            if (labyrinth.Level <= 20) // 6 .. 20 level =>  26 * 11 .. 40 * 25
            {
                moves = 20 + labyrinth.Level;
                items = 5 + labyrinth.Level;
            }
            else
            {
                moves = 40;
                items = 25;
            }

            labyrinth.Generate(Context, moves, items);

            _scene.Observer.Position = labyrinth.LabPointToScenePoint(labyrinth.StartPos);
            _scene.Observer.Rotation = new GLVector(0, 180, 0);

            _lastTapCrossMove  = null;
            _lastTapRotateMove = null;

            UpdateDisplays();
        }