示例#1
0
        public Player(Game1 game, World world, float ratio, float strength, Vector2 position,string texture_0_path,string texture_1_path, string texture_2_path, string texture_3_path, string textureMissilePath, string textureParticlePath)
            : base(game, world, texture_0_path,texture_1_path,texture_2_path,texture_3_path)
        {
            var texture_0 = Content.Load<Texture2D>(texture_0_path);
            var texture_1 = Content.Load<Texture2D>(texture_1_path);
            var texture_2 = Content.Load<Texture2D>(texture_2_path);
            var texture_3 = Content.Load<Texture2D>(texture_3_path);

            _missiles = new Missiles(game, world, ratio, textureMissilePath);
            particles = new ParticleEngine(game, textureParticlePath);

            _textureReference = texture_0;

            _ratio = ratio;
            Broken = false;
            Boosting = false;
            _boostTimer = 0;
            _Index = 0;
            Bullets = 4;
            Reload = false;

            CreatePlayerBreakableBody(strength, position);

            //ball = BodyFactory.CreateCircle(world, 5, 1, position: new Vector2(40,36));
            //ball.BodyType = BodyType.Static;
            //ball.CollisionCategories = Category.Cat1;
            //ball.CollidesWith = Category.All;

            avion = new Sprite[4];
            avion[0] = new Sprite(texture_0) { Position = this.Position, Rotation = this.Rotation };
            avion[1] = new Sprite(texture_1) { Position = this.Position, Rotation = this.Rotation };
            avion[2] = new Sprite(texture_2) { Position = this.Position, Rotation = this.Rotation };
            avion[3] = new Sprite(texture_3) { Position = this.Position, Rotation = this.Rotation };
        }
示例#2
0
 public Invader(Game1 game, World world, float ratio, string texturePath, string textureMissilePath, string textureParticlePath, BreakableBody target )
     : base(game, world, texturePath)
 {
     _texture = Content.Load<Texture2D>(texturePath);
     invaders = new List<Sprite>();
     invaderBreakableBody = new List<BreakableBody>();
     _ratio = ratio;
     this.target = target;
     _missiles = new Missiles(game, world, ratio, textureMissilePath);
     particles = new ParticleEngine(game, textureParticlePath);
     Practice = false;
 }