Beispiel #1
0
        //******************* Player Effects Like Kicking and Punching ***************************
        /// <summary>
        /// Bash with the hand on the ground
        /// </summary>
        /// <param name="h"></param>
        public void bash(Hand h)
        {
            float hSpeed = h.getHorizontalSpeed();
            float speed = h.moveVector.Length();
            //hit ground
            if (h.pos.Y > 620 && speed > 5)//.Y > 10 && h.moveVector.Y > 0
            {
                EffectUtil.createShockwave(Game1.particleSimulator.psNoGrav, h.pos);
                EffectUtil.createExplosion(Game1.particleSimulator.psGrav, h.pos, new Vector2(0, -4), new Vector2(6, 2), 2);
                killPeople(h.pos);
                return;
            }

            //hit house
            if (hSpeed > 20)
            {
                for (int i = 0; i < buildingList.Count; i++)
                {
                    Floor f = buildingList[i].ishit(h.pos, 30, 200);
                    if (f != null)
                    {
                        f.damage(10 + rand.Next(5));
                        EffectUtil.createExplosionWithSmoke(Game1.particleSimulator.psGrav, h.pos, h.moveVector.X);
                        EffectUtil.createExplosion(Game1.particleSimulator.psGrav, h.pos, new Vector2(0, -4), new Vector2(6, 2), 2);
                    }
                }
            }
        }
Beispiel #2
0
        //******************* Player Effects Like Kicking and Punching ***************************
        /// <summary>
        /// Bash with the hand on the ground
        /// </summary>
        /// <param name="h"></param>
        public void bash(Hand h)
        {
            float hSpeed = h.getHorizontalSpeed();
            //hit ground
            if (h.pos.Y > 620 && h.moveVector.Y > 10 && h.moveVector.Y > 0)
            {
                EffectUtil.createShockwave(Game1.particleSimulator.psNoGrav, h.pos);
                EffectUtil.createExplosion(Game1.particleSimulator.psGrav, h.pos, new Vector2(0, -4), new Vector2(6, 2), 2);
                killPeople(h.pos);
                return;
            }

            //hit house
            if (hSpeed > 30)
            {
                for (int i = 0; i < buildingList.Count; i++)
                {
                    if (buildingList[i].ishit(h.pos, 30, 200))
                    {
                        EffectUtil.createExplosionWithSmoke(Game1.particleSimulator.psGrav, h.pos, 2);
                        EffectUtil.createExplosionWithSmoke(Game1.particleSimulator.psGrav, h.pos, -2);
                    }
                }
            }
        }