Beispiel #1
0
        public Director()
        {
            source  = new Source(new Vector2(100,300) , 0 , this);
            mirror   = new Mirror(new Vector2(300, 200) , 0 , this);

            mirrors.Add(mirror);
        }
Beispiel #2
0
        public Laser(Vector2 p, float a, Director d , Mirror m)
        {
            position = p;
            director = d;

            sourceMirror = m;

            angle = a + MathHelper.ToRadians(90);
        }
Beispiel #3
0
        private void input()
        {
            MouseState mouseStateCurrent, mouseStatePrevious;
            KeyboardState keyboardStateCurrent, keyboardStatePrevious;
            mouseStateCurrent = Mouse.GetState();
            keyboardStateCurrent = Keyboard.GetState();

            if (mouseStateCurrent.LeftButton == ButtonState.Pressed)
            {
                mirrors.Last().setPosition(new Vector2(mouseStateCurrent.X, mouseStateCurrent.Y));
            }

            if (mouseStateCurrent.RightButton == ButtonState.Pressed)
            {
                mirrors.Last().setAngle(0);
            }

            if (keyboardStateCurrent.IsKeyDown(Keys.Enter) )
            {
                cube.setPosition(new Vector2(mouseStateCurrent.X - 35, mouseStateCurrent.Y - 35));
            }

            if (counter > limit)
            {
                counter = 0;
                if (keyboardStateCurrent.IsKeyDown(Keys.M))
                {
                    Mirror m = new Mirror(new Vector2(mouseStateCurrent.X, mouseStateCurrent.Y), 0, this);
                    m.load(content);
                    mirrors.Add(m);
                }
            }
            else
            {
                counter++;
            }
        }