Exemplo n.º 1
0
        private async void GameRunner_Load(object sender, EventArgs e)
        {
            #region init
            Codes      = new List <UserControl>();
            _derection = Enums.Derection.Right;

            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.MaximizeBox     = false;
            this.MinimizeBox     = false;

            codeCore.AutoScroll = false;
            codeCore.HorizontalScroll.Enabled = false;
            codeCore.HorizontalScroll.Visible = false;
            codeCore.HorizontalScroll.Maximum = 0;
            codeCore.AutoScroll = true;

            var move1 = new UcFunction();
            move1.Location = new Point(0, codeIndex);
            codeCore.Controls.Add(move1);
            Codes.Add(move1);
            codeIndex += UcFunction.Height;

            var move2 = new UcLoop();
            move2.Location = new Point(10, codeIndex);
            codeCore.Controls.Add(move2);
            Codes.Add(move2);
            codeIndex += UcLoop.Height;
            #endregion

            await LoadInit();
        }
Exemplo n.º 2
0
 private void btnPlay_Click(object sender, EventArgs e)
 {
     _derection = Enums.Derection.Right;
     ResetFontColor();
     codeLine = 0;
     movePx   = 0;
     Run();
 }
Exemplo n.º 3
0
        void GetDerection(Enums.Derection derection)
        {
            if (derection == Enums.Derection.Left)
            {
                switch (_derection)
                {
                case Enums.Derection.None:
                    break;

                case Enums.Derection.Right:
                    _derection = Enums.Derection.Top;
                    break;

                case Enums.Derection.Top:
                    _derection = Enums.Derection.Left;
                    break;

                case Enums.Derection.Left:
                    _derection = Enums.Derection.Down;
                    break;

                case Enums.Derection.Down:
                    _derection = Enums.Derection.Right;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            else if (derection == Enums.Derection.Right)
            {
                switch (_derection)
                {
                case Enums.Derection.None:
                    break;

                case Enums.Derection.Right:
                    _derection = Enums.Derection.Down;
                    break;

                case Enums.Derection.Top:
                    _derection = Enums.Derection.Right;
                    break;

                case Enums.Derection.Left:
                    _derection = Enums.Derection.Top;
                    break;

                case Enums.Derection.Down:
                    _derection = Enums.Derection.Left;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
Exemplo n.º 4
0
 public void SetBound(Bound bound, Enums.Derection derection)
 {
     if (derection == Enums.Derection.Right)
     {
         CurrentRightBounds = bound;
     }
     else
     {
         CurrentLeftBounds = bound;
     }
 }
Exemplo n.º 5
0
 void PlayGame()
 {
     if (!_isGameRunning)
     {
         _derection = Enums.Derection.Right;
         ResetFontColor();
         codeLine = 0;
         movePx   = 0;
         IsGameRunnning(true);
         Run();
     }
     else
     {
         timer1.Stop();
         IsGameRunnning(false);
     }
 }
Exemplo n.º 6
0
    static public void Dash(Rigidbody2D _rigidbody2D, Enums.Derection derection)
    {
        if (enable && !inJump && Enabled)
        {
            _rigidbody2D.velocity        = Vector3.zero;
            _rigidbody2D.angularVelocity = 0;
            _rigidbody2D.AddForce(
                new Vector2(
                    (derection == Enums.Derection.Left ? -1 : 1) * 300,
                    0
                    )
                );

            inJump = true;
            recharge();
        }
    }