Exemplo n.º 1
0
        public Booster(Scene scene, DrawComponent dc, TransformComponent tc, BoosterSpecs specs) : base(scene, tc, dc)
        {
            Scene.Game.PM.CreateBoxComponent(new Size(32.0, 32.0), this);

            Direction = specs.Direction;
            Velocity  = specs.Velocity;
            LifeSpan  = specs.LifeSpan;
            Type      = specs.Type;
        }
Exemplo n.º 2
0
        void CreateBooster()
        {
            Random random = new Random();
            int    key    = random.Next(0, 100);

            if (key > 76 && key <= 100)
            {
                BoosterType  bt    = BoosterType.AddHP;
                BoosterSpecs specs = new BoosterSpecs();
                specs.Direction = new Point(0.0, 1.0);
                specs.LifeSpan  = 4;
                specs.Velocity  = 300.0;

                if (key > 76 && key <= 80)
                {
                    bt = BoosterType.AddHP;
                }
                else if (key > 80 && key <= 84)
                {
                    bt = BoosterType.AddDamage;
                }
                else if (key > 84 && key <= 88)
                {
                    bt = BoosterType.AddLazer;
                }
                else if (key > 88 && key <= 92)
                {
                    bt = BoosterType.Bomb;
                }
                else if (key > 92 && key <= 96)
                {
                    bt = BoosterType.Shield;
                }
                else if (key > 96 && key <= 100)
                {
                    bt = BoosterType.ChainsawShield;
                }

                specs.Type = bt;

                Booster booster = new Booster(Scene, new DrawComponent(Scene.Game.AM.GetTexture(bt + ".png"), new Size(32.0, 32.0)), new TransformComponent(TC.Position), specs);
                Scene.NewActors.Add(booster);
            }
        }