Пример #1
0
        public static Pickup GetRandom(Random rnd, int ScreenSize)
        {
            //Roll to generate a random enemy that is different from the previous generated enemy

            Pickup pickup = null;

            //Roll
            var roll = rnd.Next(0, Count);

            //Add pickup here for each roll
            if (roll == 0)
            {
                pickup =
                    PickupPrefabList.GetPrefab
                    <HealthPickup>(PickupName.Health);
            }
            else if (roll == 1)
            {
                pickup =
                    PickupPrefabList.GetPrefab
                    <SpeedUpPickup>(PickupName.SpeedUp);
            }
            else if (roll == 2)
            {
                pickup =
                    PickupPrefabList.GetPrefab
                    <SpeedDownPickup>(PickupName.SpeedDown);
            }
            else if (roll == 3)
            {
                pickup = PickupPrefabList.GetPrefab
                         <WindUpPickup>(PickupName.WindUp);
            }
            else if (roll == 4)
            {
                pickup = PickupPrefabList.GetPrefab
                         <WindDownPickup>(PickupName.WindDown);
            }
            else
            {
                pickup = null;
            }

            if (pickup != null)
            {
                //For Planes
                pickup.Scale(-15.0f);
                pickup.Rotate(0, 0, 180);

                //For models

                //pickup.Scale(3.0f);
                // pickup.Rotate(0, 0, 0);
                pickup.Translate(rnd.Next(0, 1700),
                                 rnd.Next((int)(ScreenSize * -0.4f),
                                          (int)(ScreenSize * 0.4f)));
            }

            return(pickup);
        }
Пример #2
0
        protected void AddVolcano(float height, float pos, RenderContext context)
        {
            //Generate a windVolcano
            var volcano = PickupPrefabList.GetPrefab <WindVulcano>(PickupName.WindVulcano);

            volcano.Create(context);
            var rnd = new Random(Guid.NewGuid().GetHashCode());

            volcano.Rotate(0, 0, 0);
            volcano.Scale(2.5f, 7.0f, 1.0f);
            volcano.Translate(rnd.Next(0, 1700), pos - (height * 1.3f));

            if (volcano != null)
            {
                AddChild(volcano);
            }
        }
Пример #3
0
        public override void Initialize(RenderContext context)
        {
            Ground ground = GroundPrefabList.GetPrefab(Collision.Col1);

            ground.Translate(0, 0);
            AddChild(ground);

            Ground Top = GroundPrefabList.GetPrefab(Collision.Col1);

            Top.Rotate(0, 0, 180);
            Top.Translate(1200, 300);
            AddChild(Top);

            Pickup pickup = PickupPrefabList.GetPrefab <HealthPickup>(PickupName.Health);

            pickup.Translate(1200, 150);
            AddChild(pickup);

            var size = (Vector2)ground.RigidBody.UserData;

            Width = (int)size.X;
            base.Initialize(context);
        }