Exemple #1
0
        public void Update()
        {
            if (GetComponent <KeyboardHandler>().KeyPressed(Keys.Right))
            {
                MainCube.TurnRight();
            }
            else if (GetComponent <KeyboardHandler>().KeyPressed(Keys.Left))
            {
                MainCube.TurnLeft();
            }
            else if (GetComponent <KeyboardHandler>().KeyPressed(Keys.Up))
            {
                MainCube.FlipUp();
            }
            else if (GetComponent <KeyboardHandler>().KeyPressed(Keys.Down))
            {
                MainCube.FlipDown();
            }

            if (GetComponent <KeyboardHandler>().KeyPressed(Keys.W))
            {
                MoveFormation(new Vector3(0, 0, -1));
            }
            if (GetComponent <KeyboardHandler>().KeyPressed(Keys.A))
            {
                MoveFormation(new Vector3(-1, 0, 0));
            }
            if (GetComponent <KeyboardHandler>().KeyPressed(Keys.S))
            {
                MoveFormation(new Vector3(0, 0, 1));
            }
            if (GetComponent <KeyboardHandler>().KeyPressed(Keys.D))
            {
                MoveFormation(new Vector3(1, 0, 0));
            }

            MainCube.Update();

            for (int i = 0; i < Cubes.Count; i++)
            {
                var cube = Cubes[i];
                cube.Update();
                if (cube.CanBeRemoved)
                {
                    Cubes.Remove(cube);
                    i--;
                }
            }
            for (int i = 0; i < Projections.Count; i++)
            {
                var proj = Projections[i];
                proj.Update();
                if (proj.CanBeRemoved)
                {
                    Projections.Remove(proj);
                    i--;
                }
            }
        }
Exemple #2
0
 public void LoadContent()
 {
     MainCube = new MainCube();
     MainCube.LoadContent();
 }