Esempio n. 1
0
 //Resets the player to starting values (more statements will be added with more features)
 public void Reset()
 {
     health   = maxHealth;
     position = defaultPosition;
     spinPos  = 0;
     hgt      = height.ground;
     move     = state.sit;
 }
Esempio n. 2
0
        private static string getHeight(height height)
        {
            switch (height)
            {
            case height.Item1: return("1m");

            case height.Item3: return("3m");

            case height.Item5: return("5m");

            case height.Item75: return("7.5m");

            case height.Item10: return("10m");
            }
            return("1m");
        }
Esempio n. 3
0
        GetRowsAndColumns
        (
            ICollection <IVertex> oVerticesToLayOut,
            LayoutContext oLayoutContext,
            out Int32 iRows,
            out Int32 iColumns
        )
        {
            Debug.Assert(oVerticesToLayOut != null);
            Debug.Assert(oLayoutContext != null);
            AssertValid();

        #if false
            Some definitions:

            W = rectangle width

                H = rectangle height

                    A = rectangle aspect ratio = W / H

                                                 V = number of vertices in graph

                                                     Vrow = number of vertices per row

                                                            Vcol = number of vertices per column

                                                                   R = number of grid rows = Vcol + 1

                                                                                             C = number of grid columns = Vrow + 1


                                                                                                                          First simulataneous equation, allowing Vrow and Vcol to be fractional
            for now:

            Vrow * Vcol = V


                          Second simulataneous equation:

                          C / R = A


                                  Combining these equations yield this quadratic equation:

                                  2
                                  C + [(-A - 1) * C] +[A * (1 - V)] = 0
Esempio n. 4
0
        static void Main(string[] args)
        {
            Pokemon aPokemon = new Pokemon()
            {
                 name = "妙蛙種子";
                 hp = "60/60";
                 gender = "男";
                 weight kg = "5.94";
                 type = "草/毒";
                 height m = "0.67";
                 Stardust = "271484";
                 Candy = "27";
                 strengthen = "3000, 3";
                 EVO = "25";
                 skill(1) = "藤編";
                 skill(01) = "7";
                 skill(2) = "汙泥炸彈";
                 skill(02) = "80";
             };
             Console.WriteLine(
                  "名稱:{0}, 強度:{1}, 性別:{2}, 體重:{3}, 屬性:{4}, 身高:{5}, 星星沙子:{6}, 妙娃種子的糖果:{7}, 強化:{8}{9}, 進化:{10}, 技能(01):{11}, 技能(02):{12}"
                 , aPokemon.name 
                 , aPokemon.hp 
                 , aPokemon.gender 
                 , aPokemon.weight 
                 , aPokemon.type 
                 , aPokemon.height 
                 , aPokemon.stardust 
                 , aPokemon.candy 
                 , aPokemon.strengthen 
                 , aPokemon.EVO 
                 , aPokemon.skill(1) 
                 , aPokemon.skill(01)
                 , aPokemon.skill(2) 
                 , aPokemon.skill(02)
             };




}
Esempio n. 5
0
 public string fromheightunit(height enumval)
 {
     if (enumval == height.Feet)
     {
         if (lang == Language.English)
         {
             return("Feet");
         }
         else
         {
             return("尺");
         }
     }
     else
     if (lang == Language.English)
     {
         return("Meter");
     }
     else
     {
         return("米");
     }
 }
Esempio n. 6
0
        //PRIVATE METHODS

        //Brings tank back to the ground after a jump. Will most likely be heavily altered when flip is finished.
        private void Fall()
        {
            //If the distance between the player and the ground is less than the previous ground speed then just place player on ground.
            //Prevents clipping through ground
            if (position.Y + fallSpeed >= GroundHeight)
            {
                position.Y = GroundHeight;
                hgt        = height.ground;
                move       = state.sit;
            }

            //If the player is in the air after a jump
            if (hgt == height.air)
            {
                framesFalling++;                                                    //This test is run every frame so if it comes into here another frame has passed
                fallSpeed  = (int)(Math.Ceiling(gravAcceleration * framesFalling)); //Calculate current speed based on acceleration factor and time passed
                position.Y = position.Y + (fallSpeed);
            }
            else //Reset falling speed and falling frames if player is on the ground
            {
                fallSpeed     = 0;
                framesFalling = 0;
            }
        }
Esempio n. 7
0
 WritePng(bytes, width, height, outputFile);
Esempio n. 8
0
 HStack(height: Dim.Sized(1), width: Dim.Fill(), contents: new []
Esempio n. 9
0
        //methods

        /// <summary>
        /// Handles all player input during the game
        /// </summary>
        public void Movement()
        {
            currKState = Keyboard.GetState();
            currMState = Mouse.GetState();

            if (move == state.jump)
            {
                Jump();
            }
            else if (move == state.fall) //If player is off ground and done jumping start falling
            {
                Fall();
            }

            if (currKState.IsKeyDown(Keys.A))
            {
                position.X = position.X - speed;
            }
            if (currKState.IsKeyDown(Keys.D))
            {
                position.X = position.X + speed;
            }
            if (currKState.IsKeyDown(Keys.W))
            {
                if (hgt != height.air)
                {
                    move       = state.jump;
                    hgt        = height.air;
                    spinOnce   = false;
                    spinPos    = 0;
                    position.Y = groundHeight;
                }
            }
            if (hgt == height.air && !spinOnce)
            {
                spinPos += ((float)((spinSpeed) * 2.0 * Math.PI)) / 100f;
                if (spinPos > (2 * Math.PI))
                {
                    spinOnce = true;
                    spinPos  = 0; //Reset the spin Position
                }
            }


            double angle = spinPos / (2 * Math.PI);

            //Update bullet position according to the angle
            //If the tank is sitting on the ground
            if (spinPos == 0)
            {
                bulletPosition.X = position.X + position.Width / 7;
                bulletPosition.Y = position.Y - 20;
            }
            else //If the tank is currently flipping
            {
                bulletPosition = new Rectangle(position.X, position.Y, bulletPosition.Width, bulletPosition.Height);

                if (angle > 0 && angle < .25)
                {
                    bulletPosition = new Rectangle(bulletPosition.X + (int)(Math.Cos(spinPos)), bulletPosition.Y - (int)(Math.Sin(spinPos)), bulletPosition.Width, bulletPosition.Height);
                }
                else if (angle >= .25 && angle < .50)
                {
                    bulletPosition = new Rectangle(bulletPosition.X + (int)(Math.Cos(spinPos)), bulletPosition.Y + (int)(Math.Sin(spinPos)), bulletPosition.Width, bulletPosition.Height);
                }
                else if (angle >= .50 && angle < .75)
                {
                    bulletPosition = new Rectangle(bulletPosition.X - (int)(Math.Cos(spinPos)), bulletPosition.Y + (int)(Math.Sin(spinPos)), bulletPosition.Width, bulletPosition.Height);
                }
                else if (angle >= .75 && angle < 1.00)
                {
                    bulletPosition = new Rectangle(bulletPosition.X - (int)(Math.Cos(spinPos)), bulletPosition.Y - (int)(Math.Sin(spinPos)), bulletPosition.Width, bulletPosition.Height);
                }
            }



            //Check if player shot
            if ((currKState.IsKeyUp(Keys.Space) && prevKState.IsKeyDown(Keys.Space)) || (currMState.LeftButton == ButtonState.Released && prevMstate.LeftButton == ButtonState.Pressed))
            {
                Shoot();
            }


            //Update input states
            prevKState = currKState;
            prevMstate = currMState;
        }
Esempio n. 10
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            try
            {
                var setting = new SQLiteConnection(App.settingpath)
                              .Table <settingsdata>()
                              .ToList()
                              .First();
                lang = setting.language;
                hieg = setting.height;
                wieg = setting.weight;
                pres = setting.bp;
            }
            finally { }

            try
            {
                if (lang == Language.English)
                {
                    lbl0.Text  = "User Information";
                    lbl1.Text  = "Date of Birth";
                    lbl2.Text  = "Height";
                    lbl3.Text  = "Weight";
                    lbl4.Text  = "Systolic Blood pressure";
                    lbl5.Text  = "Diastolic Blood pressure";
                    lbl6.Text  = "Cholesterol level";
                    lbl7.Text  = "HDL level";
                    lbl8.Text  = "Gender";
                    lbl9.Text  = "Are you a smoker?";
                    lbl10.Text = "Do you have diabetes?";
                    //lbl11.Text = "Are you always taking medicine?";
                    height_text.Placeholder = "(in ";
                    if (hieg == Models.height.Meter)
                    {
                        height_text.Placeholder += "cm)";
                    }
                    else
                    {
                        height_text.Placeholder += "feet)";
                    }
                    weight_text.Placeholder = "(in ";
                    if (wieg == Models.weight.Kilogram)
                    {
                        weight_text.Placeholder += "kg)";
                    }
                    else
                    {
                        weight_text.Placeholder += "lb)";
                    }
                    sybp_text.Placeholder = "(in ";
                    dibp_text.Placeholder = "(in ";
                    if (pres == bp.kPa)
                    {
                        sybp_text.Placeholder += "kPa)";
                        dibp_text.Placeholder += "kPa)";
                    }
                    else
                    {
                        sybp_text.Placeholder += "mmHg)";
                        dibp_text.Placeholder += "mmHg)";
                    }
                    chol_text.Placeholder = "(in mg/dL)";
                    hdl_text.Placeholder  = "(in mg/dL)";
                    gend.ItemsSource      = new string[] { "---Choose an item---", "Male", "Female" };
                    smok.ItemsSource      = new string[] { "---Choose an item---", "Yes", "No" };
                    diab.ItemsSource      = new string[] { "---Choose an item---", "Yes", "No" };
                    //tba.ItemsSource= new string[] { "---Choose an item---", "Yes", "No" };
                    Title    = "User Profile";
                    btn.Text = "Submit";
                }
                else if (lang == Language.trad_chi)
                {
                    lbl0.Text  = "用戶資料";
                    lbl1.Text  = "出生日期";
                    lbl2.Text  = "身高";
                    lbl3.Text  = "體重";
                    lbl4.Text  = "血壓(上壓)";
                    lbl5.Text  = "血壓(下壓)";
                    lbl6.Text  = "膽固醇水平";
                    lbl7.Text  = "HDL水平";
                    lbl8.Text  = "性別";
                    lbl9.Text  = "閣下有沒有吸煙的習慣?";
                    lbl10.Text = "閣下有沒有糖尿病?";
                    //lbl11.Text = "閣下是否長期病患?";
                    height_text.Placeholder = "(";
                    if (hieg == Models.height.Meter)
                    {
                        height_text.Placeholder += "公分)";
                    }
                    else
                    {
                        height_text.Placeholder += "尺)";
                    }
                    weight_text.Placeholder = "(";
                    if (wieg == Models.weight.Kilogram)
                    {
                        weight_text.Placeholder += "kg)";
                    }
                    else
                    {
                        weight_text.Placeholder += "lb)";
                    }
                    sybp_text.Placeholder = "(";
                    dibp_text.Placeholder = "(";
                    if (pres == bp.kPa)
                    {
                        sybp_text.Placeholder += "kPa)";
                        dibp_text.Placeholder += "kPa)";
                    }
                    else
                    {
                        sybp_text.Placeholder += "mmHg)";
                        dibp_text.Placeholder += "mmHg)";
                    }
                    chol_text.Placeholder = "(mg/dL)";
                    hdl_text.Placeholder  = "(mg/dL)";
                    gend.ItemsSource      = new string[] { "---請選擇---", "男", "女" };
                    smok.ItemsSource      = new string[] { "---請選擇---", "有", "沒有" };
                    diab.ItemsSource      = new string[] { "---請選擇---", "有", "沒有" };
                    //tba.ItemsSource = new string[] { "---請選擇---", "是", "否" };
                    Title    = "個人檔案";
                    btn.Text = "提交";
                }

                else
                {
                    lbl0.Text  = "用户资料";
                    lbl1.Text  = "出生日期";
                    lbl2.Text  = "身高";
                    lbl3.Text  = "体重";
                    lbl4.Text  = "血压(上压)";
                    lbl5.Text  = "血压(下压)";
                    lbl6.Text  = "胆固醇水平";
                    lbl7.Text  = "HDL水平";
                    lbl8.Text  = "性別";
                    lbl9.Text  = "阁下有沒有吸烟的习惯?";
                    lbl10.Text = "阁下有沒有糖尿病?";
                    //lbl11.Text = "阁下是否长期病患?";
                    height_text.Placeholder = "(";
                    if (hieg == Models.height.Meter)
                    {
                        height_text.Placeholder += "公分)";
                    }
                    else
                    {
                        height_text.Placeholder += "尺)";
                    }
                    weight_text.Placeholder = "(";
                    if (wieg == Models.weight.Kilogram)
                    {
                        weight_text.Placeholder += "kg)";
                    }
                    else
                    {
                        weight_text.Placeholder += "lb)";
                    }
                    sybp_text.Placeholder = "(";
                    dibp_text.Placeholder = "(";
                    if (pres == bp.kPa)
                    {
                        sybp_text.Placeholder += "kPa)";
                        dibp_text.Placeholder += "kPa)";
                    }
                    else
                    {
                        sybp_text.Placeholder += "mmHg)";
                        dibp_text.Placeholder += "mmHg)";
                    }
                    chol_text.Placeholder = "(mg/dL)";
                    hdl_text.Placeholder  = "(mg/dL)";
                    gend.ItemsSource      = new string[] { "---请选择---", "男", "女" };
                    smok.ItemsSource      = new string[] { "---请选择---", "有", "沒有" };
                    diab.ItemsSource      = new string[] { "---请选择---", "有", "沒有" };
                    //tba.ItemsSource = new string[] { "---请选择---", "是", "否" };
                    Title    = "个人档案";
                    btn.Text = "提交";
                }
            }
            catch (Exception) { }
            using (SQLiteConnection dbim = new SQLiteConnection(App.DBPATH))
            {
                dbim.CreateTable <DB_pdata>();
                List <DB_pdata> dBs;
                try
                {
                    dBs = dbim.Table <DB_pdata>().ToList();
                    height_text.Text   = dBs.First().heig.ToString();
                    weight_text.Text   = dBs.First().weig.ToString();
                    sybp_text.Text     = dBs.First().Sbp.ToString();
                    dibp_text.Text     = dBs.First().Dbp.ToString();
                    chol_text.Text     = dBs.First().Cho.ToString();
                    hdl_text.Text      = dBs.First().hdll.ToString();
                    DOB.Date           = dBs.First().dob;
                    gend.SelectedIndex = bootoint(dBs.First().genD);
                    smok.SelectedIndex = bootoint(dBs.First().smoK);
                    diab.SelectedIndex = bootoint(dBs.First().diaB);
                    //tba.SelectedIndex = bootoint(dBs.First().medic);
                }
                catch (Exception)
                {
                    gend.SelectedIndex = 0;
                    smok.SelectedIndex = 0;
                    diab.SelectedIndex = 0;
                    //tba.SelectedIndex = 0;
                    DOB.Date = DateTime.Today;
                }
            }
            DOB.MaximumDate = DateTime.Today;
        }
Esempio n. 11
0
 get => new Vector2(height, WIDTH);
Esempio n. 12
0
 StaggeredBracketLimits(height, minY, 3, bracketNumber, false);
Esempio n. 13
0
        GetRowsAndColumns
        (
            ICollection <IVertex> oVerticesToLayOut,
            LayoutContext oLayoutContext,
            out Int32 iRows,
            out Int32 iColumns
        )
        {
            Debug.Assert(oVerticesToLayOut != null);
            Debug.Assert(oLayoutContext != null);
            AssertValid();

        #if false
            Some definitions:

            W = rectangle width

                H = rectangle height

                    A = rectangle aspect ratio = W / H

                                                 V = number of vertices in graph

                                                     R = number of grid rows

                                                         C = number of grid columns


                                                             First simulataneous equation, allowing R and C to be fractional for
now:

            R * C = V


                    Second simulataneous equation:

                    C / R = A


                            Combining these equations yields:

                            1 / 2
                            C = (V * A)
        #endif

            Int32 V = oVerticesToLayOut.Count;

            // Compute the aspect ratio.

            RectangleF oRectangleF = oLayoutContext.GraphRectangle;
            Debug.Assert(oRectangleF.Height != 0);
            Double A = oRectangleF.Width / oRectangleF.Height;

            Double C = Math.Sqrt(V * A);
            Debug.Assert(A != 0);
            Double R = C / A;

            // Try the floor/ceiling combinations.

            // C floor, R floor

            iColumns = (Int32)Math.Floor(C);
            iRows    = (Int32)Math.Floor(R);

            if (RowsAndColumnsAreSufficient(iRows, iColumns, V))
            {
                return;
            }

            // C floor, R ceiling

            iRows++;

            if (RowsAndColumnsAreSufficient(iRows, iColumns, V))
            {
                return;
            }

            // C ceiling, R floor

            iColumns = (Int32)Math.Ceiling(C);
            iRows    = (Int32)Math.Floor(R);

            if (RowsAndColumnsAreSufficient(iRows, iColumns, V))
            {
                return;
            }

            // C ceiling, R ceiling

            iRows++;

            Debug.Assert(RowsAndColumnsAreSufficient(iRows, iColumns, V));
        }
 cubeMapTexture.PositiveX.MipMaps.Add(ReadFaceTexture(stream, width, height, blockFormat, dataForEachFace));