public void CheckMatrice()
        {
            var xPos = (int)(x * labyrinthSize / Width) % labyrinthSize;
            var yPos = (int)(y * labyrinthSize / Height) % labyrinthSize;

            //Console.WriteLine("position x:" + xPos + " y:" + yPos + "state:" + matrice[currentMatrice, yPos, xPos] + " width:" + Width + " height:" + Height);

            if (state == 0 && matrice[currentMatrice, yPos, xPos] == S.Start)
            {
                state = 1;
            }
            else if (state == 1 && matrice[currentMatrice, yPos, xPos] == S.Wall)
            {
                state = 2;
                timer.Stop();
                GamePanel.GameEnded(false);
            }
            else if (state == 1 && matrice[currentMatrice, yPos, xPos] == S.End)
            {
                state = 3;
                timer.Stop();
                GamePanel.GameEnded(true);
            }

            UpdateView();
        }
Exemple #2
0
        private void TimerClock(object sender, EventArgs e)
        {
            StopLine      = Width - 100;
            ComputerSpeed = StopLine / 100;

            if (state == State.Starting)
            {
                startingTime += 1;

                if (startingTime == 30)
                {
                    state = State.Started;
                }
            }
            else
            {
                xComputer += ComputerSpeed;
                xPlayer   += (speed * StopLine / 320);

                if (xComputer >= StopLine)
                {
                    timer.Stop();

                    state = State.Finished;

                    GamePanel.GameEnded(false);
                }
                else if (xPlayer >= StopLine)
                {
                    timer.Stop();

                    state = State.Finished;

                    GamePanel.GameEnded(true);
                }

                UpdateView();
            }
        }
Exemple #3
0
        private void TimerClock(object sender, EventArgs e)
        {
            Console.WriteLine("distance Raw X " + distanceRawX);
            Console.WriteLine("distance Raw Y " + distanceRawY);
            Console.WriteLine("distance Raw Z " + distanceRawZ);

            distanceRawX = distanceRawY = distanceRawZ = 0;

            switch (moves[current])
            {
            case Move.Up:
                break;

            case Move.Down:
                break;

            case Move.Left:
                break;

            case Move.Right:
                break;
            }

            current++;

            if (current == moves.Length - 1)
            {
                ok = true;

                timer.Stop();

                state = State.Finished;

                GamePanel.GameEnded(true);
            }

            UpdateView();
        }
Exemple #4
0
        private void TimerClock(object obj, EventArgs ea)
        {
            if (state == State.Starting)
            {
                if (startingTime == 0)
                {
                    state = State.Started;
                    viewTimer.Start();
                }
                startingTime--;
                UpdateView();
            }
            else
            {
                if (time == 0)
                {
                    state = State.Lost;
                    timer.Stop();
                    viewTimer.Stop();
                    Invalidate(true);
                    GamePanel.GameEnded(false);
                }
                if (state == State.Won)
                {
                    timer.Stop();
                    viewTimer.Stop();
                    Invalidate(true);
                    GamePanel.GameEnded(true);
                }

                if (Wm.WiimoteState.Rumble)
                {
                    Wm.SetRumble(false);
                }

                time--;
            }
        }
Exemple #5
0
        private void TimerClock(object sender, EventArgs e)
        {
            if (a == buttonState.A && b == buttonState.B && one == buttonState.One && two == buttonState.Two &&
                up == buttonState.Up && down == buttonState.Down && right == buttonState.Right && left == buttonState.Left)
            {
                sucess++;

                if (sucess == 5)
                {
                    ok = true;

                    timer.Stop();

                    state = State.Finished;

                    GamePanel.GameEnded(true);
                }
                else
                {
                    var random = new Random().Next(8);

                    a = b = one = two = left = right = up = down = false;

                    switch (random)
                    {
                    case 0:
                        a       = b = true;
                        message = "A + B";
                        break;

                    case 1:
                        b       = true;
                        message = "B";
                        break;

                    case 2:
                        a       = true;
                        message = "A";
                        break;

                    case 3:
                        one     = two = true;
                        message = "1 + 2";
                        break;

                    case 4:
                        two     = true;
                        message = "2";
                        break;

                    case 5:
                        down    = b = true;
                        message = "DOWN + B";
                        break;

                    case 6:
                        up      = b = true;
                        message = "UP + B";
                        break;

                    case 7:
                        down    = true;
                        message = "DOWN";
                        break;
                    }
                }
            }
            else
            {
                ok = false;

                timer.Stop();

                state = State.Finished;

                GamePanel.GameEnded(false);
            }

            UpdateView();
        }