Exemple #1
0
        private void GenerateBonusTypes()
        {
            BonusType lType1 = new BonusType()
            {
                BitmapFrame     = mBonusHealthBitmapFrame,
                Size            = 30,
                Speed           = 5,
                PlusHealth      = 20,
                PlusMissiles    = 0,
                Value           = 0.005,
                Invulnerability = 0
            };
            BonusType lType2 = new BonusType()
            {
                BitmapFrame     = mMissileBitmapFrame,
                Size            = 30,
                Speed           = 2,
                PlusHealth      = 0,
                PlusMissiles    = 15,
                Value           = 0.005,
                Invulnerability = 0
            };

            mBonusTypes.Add(lType1);
            mBonusTypes.Add(lType2);
        }
Exemple #2
0
        public Bonus(BitmapFrame aBitmapFrame,
                     Point aPosition,
                     double aDirection, double aSpeed,
                     double aSize, BonusType aType)
            : base(aSize, aSize, aBitmapFrame, aPosition, aDirection, aSpeed)
        {
            SetImageAngle(Direction);

            mAngle = Direction;
            mCollisionBehavior.Add(typeof(Rocket), DefaultCollisionSolve);

            CollisionMask.Add(new Circle(aSize / 2 * 4.5 / 5, this.Position, 0, 0));
            Depth           = -1;
            Health          = aType.PlusHealth;
            MissileTime     = aType.PlusMissiles;
            Invulnerability = aType.Invulnerability;
        }
Exemple #3
0
        public Bonus CreateBonus(BonusType aType)
        {
            double lBonusX    = 0;
            double lBonusY    = 0;
            double lDirection = 0;

            double lBonusSize = aType.Size;
            double lSpeed     = aType.Speed;

            #region position_direction
            //left /right
            if (mRandom.Next(2) == 0)
            {
                lBonusY = mRandom.Next((int)GameRoom.RoomHeight);
                //left
                if (mRandom.Next(2) == 0)
                {
                    lBonusX    = -lBonusSize / 2;
                    lDirection = -90 + mRandom.Next(181);
                }
                else//right
                {
                    lBonusX    = (int)GameRoom.RoomWidth + lBonusSize / 2;
                    lDirection = 90 + mRandom.Next(181);
                }
            }
            else //top/bottom
            {
                lBonusX = mRandom.Next((int)GameRoom.RoomWidth);
                //top
                if (mRandom.Next(2) == 0)
                {
                    lBonusY    = -lBonusSize / 2;
                    lDirection = mRandom.Next(181);
                }
                else //bottom
                {
                    lBonusY    = (int)GameRoom.RoomHeight + lBonusSize / 2;
                    lDirection = 180 + mRandom.Next(181);
                }
            }
            #endregion
            return(new Bonus(aType.BitmapFrame, new Point(lBonusX, lBonusY), lDirection, lSpeed, lBonusSize, aType));
        }
Exemple #4
0
 public void AddBonusType(BonusType aType)
 {
     mBonusTypes.Add(aType);
 }