public StationalEnemy3(Stage stage, float x, float y, int width, int height, int HP)
            : base(stage, x, y, width, height,HP)
        {
            LoadXML("StationalEnemy3", "Xml\\Objects_Enemy_Stage3.xml");
            turret = new Turret(stage, this, new Vector2(5), 5, 5, 0, 1, 1, false, true);

            Load();
        }
        public WindTurret(Stage stage, float x, float y, int width, int height, int HP, Character user, Turret turret)
            : base(stage, x, y, width, height, HP, user)
        {
            //LoadXML("Enemy", "Xml\\Objects_Base.xml");
            if (turret == null) turret = new Turret(stage, this, position, 32, 32, 0, 1, 1, false, true, 0, 0, 5);
            Load();

            turret.isBeingUsed = true;
        }
        public ShootingEnemy(Stage stage,  float x, float y, int width, int height, int HP)
            : base(stage, x, y, width, height, HP)
        {
            LoadXML("ShootingEnemy", "Xml\\Objects_Enemy_Stage1.xml");
            turret = new Turret(stage, this, shootPosition, 32, 32, 0, 1 ,1, false, true, 0, 0, 4);
            stage.weapons.Add(turret);

            Load();
        }
        public Thunder(Stage stage, Turret turret, int width, int height, int degree)
            : base(stage, turret, width, height)
        {
            this.degree = degree;
            maxWidth = width + 300;
            defaultWidth = width;
            rect = new Rectangle(0, 0, width, height);

            Load();
        }
 public FlyingEnemy3(Stage stage, float x, float y, int width, int height, int HP)
     : base(stage, x, y, width, height,HP)
 {
     //turret = new Turret(stage, this, new Vector2(5, 5), 5, 5, 0, 1);// ビームを放つタイプ:実装としてはThunderの方が近いのでそっちで.
     turret = new Turret(stage, this, new Vector2(5), 5, 5, 0, 0, 1, false, true, 0, 0);
     turret.bulletSpeed = new Vector2(0, 10);
     /*baseクラスの定数に割り当てようとしてもbaseクラスコンストラクタ内でしかできないのでエラー、しかしnewして新しく定義してもbaseクラスの定数を使う処理では
      当然baseクラスで定義されている定数が使われるので反映されない。困った...
      これの解決策としてはreadonlyを外すしかないのでは...?
      →Load()のoverrideで上手くできそう→できたっぽい*/
 }
        // コンストラクタ
        public Fuujin(Stage stage, float x, float y, int width, int height, int HP, float vx, int bulletType, int shootType)
            : base(stage, x, y, width, height, HP, bulletType, shootType)
        {
            bindSize = new Vector2(180, 100);
            bindPos = new Vector2(50, 50);
            defBindPos = new Vector2(95, 83);
            defBindPosOther = new Vector2(width - defBindPos.X - bindSize.X, 50);

            this.defaultPosition = position;
            tmpPosition = defaultPosition + new Vector2(-100, -200);
            attackPosition = new Vector2(defaultPosition.X - 720, defaultPosition.Y);// new Vector2(defaultPosition.X - 500, defaultPosition.Y);
            animation = new Animation(380, 310);
            resWaitTime = 240;

            //bindSize = new Vector2(260, 260);
            //animation2 = new Animation(210, 210);

            obstacles = new List<Obstacle>();
            obstacleMeteor = new Obstacle(stage, this, x, y, 32, 64, 2, 0);
            obstacleIcicleRandom = new Obstacle(stage, this, x, y, 32, 64, 2, 1);
            //obstacleIcicleAlternate = new Obstacle(stage, this, x, y, 32, 64, 2, 1);
            obstacleTornadeSmall = new Obstacle(stage, this, x, y, 32, 32, 2, 3);
            obstacleTornadeLarge = new Obstacle(stage, this, x, y, 32, 32, 2, 4);

            // !reuseBullet版
            //cutterTurret5Way = new Turret(stage, this, new Vector2(150, 100), 32, 32, 0, 5, 5, false, true, 0, 4);
            //cutterTurret1WayBurst = new Turret(stage, this, new Vector2(150, 100), 32, 32, 0, 1, 10, false, true, 0, 4, 10, 320, 10);
            cutterTurret5Way = new Turret(stage, this, new Vector2(150, 100), 32, 32, 0, 5, 5, false, true, 0, 4, 10, 60, 10, Vector2.Zero, false, false);
            cutterTurret1WayBurst = new Turret(stage, this, new Vector2(150, 100), 32, 32, 0, 1, 10, false, true, 0, 4, 10, 320, 10, Vector2.Zero, false, false);
            cutterTurret1WayBurst.isMarked = true;
            cutterTurretAlternate = new Turret(stage, this, new Vector2(150, 100), 32, 32, 0, 5, 2, false, true, 0, 4, 10, 60, 10, Vector2.Zero, false, true, new int[] { 5, 1 });// bulSpeed 5→10
            // shootInterval == 120だと、連発した時にPlayerを最初しか上手く追尾しない?

            obstacles.Add(obstacleMeteor);
            obstacles.Add(obstacleIcicleRandom);
            obstacles.Add(obstacleTornadeSmall);
            obstacles.Add(obstacleTornadeLarge);
            foreach (Obstacle obs in obstacles) weapons.Add(obs);
            turrets.Add(cutterTurret5Way);
            weapons.Add(cutterTurret5Way);
            turrets.Add(cutterTurret1WayBurst);
            weapons.Add(cutterTurret1WayBurst);
            turrets.Add(cutterTurretAlternate);
            weapons.Add(cutterTurretAlternate);

            largeWind = new Weapon(stage, x, y, 64, 400, this);
            weapons.Add(largeWind);

            jumpingEnemy = new JumpingEnemy(stage, position.X, position.Y, 32, 32, 2, this);
            stage.characters.Add(jumpingEnemy);

            foreach (Weapon weapon in weapons) stage.weapons.Add(weapon);
        }
        public Beam(Stage stage, Turret turret, int width, int height, int type, int disappearType)
            : base(stage, turret, width, height)
        {
            // turretに追従させるパターン
            this.shootPosition = turret.position;
            this.position = shootPosition;
            this.disappearPattern = disappearType;

            animation2 = new Animation(48, 24);
            animations = new Animation[10];
            for (int i = 0; i < animations.Length; i++)
                animations[i] = new Animation(64, 64);
        }
        public FlyingEnemy2(Stage stage, float x, float y, int width, int height, int HP, int motionType)
            : base(stage, x, y, width, height, HP, motionType)
        {
            LoadXML("FlyingEnemy2", "Xml\\Objects_Enemy_Stage2.xml");
            //thread = new Thread(stage, 200, 100, 8, 32, 0, 45,150);
            thread = new Thread(stage, x, y - 150, 2, 150, 45, 150);// lengthは適当.あとで追加
            stage.dynamicTerrains.Add(thread);

            turret = new Turret(stage, this, Vector2.Zero/*new Vector2(width/2, height/2)*/, 8, 8, 0, 5, 2, false, true, 0, 3, 5, 180, 20, Vector2.Zero, false, false);
            //turret = new Turret(stage, this, new Vector2(width / 2, height / 2), 8, 8, 0, 5, 2, false, true, 0, 3, 2, 120, 20, Vector2.Zero, false, false); // こっちに変えても発射位置の問題は直らなかった
            stage.weapons.Add(turret);
            turret.isBeingUsed = true;
            //turret = new Turret(stage, this, shootPosition[0], 32, 32, 5, bulletType)

            Load();
        }
        /*private Rectangle rect;
        private int maxWidth;
        private int defaultWidth;*/
        public Beam(Stage stage, Turret turret, int width, int height)
            : base(stage, turret, width, height)
        {
            // Turretに管理させるパターン
            // 射撃位置に合わせる
            this.shootPosition = turret.position;
            this.position.X = shootPosition.X;
            this.position.Y = shootPosition.Y;

            isShot = false;
            animation = new Animation(width, height);
            animation2 = new Animation(48, 24);             // 完全にエフェクト専用にしてハードコーディング
            animations = new Animation[10];					// 汎用的にやるのは面倒なので。これくらいあれば十分だろう.
            for (int i = 0; i < animations.Length; i++)
                animations[i] = new Animation(64, 64);
        }
        public FlyingEnemy(Stage stage, float x, float y, int width, int height, int HP, int attackType)
            : base(stage, x, y, width, height, HP)
        {
            LoadXML("FlyingEnemy", "Xml\\Objects_Enemy_Stage1.xml");
            this.attackType = attackType;

            // 動き回る仕様
            isMovingAround = true;
            delayTime = motionDelayTime + 1;
            flappingSoundInstance.Volume = 1.0f;

            // 弾を射撃するか否か
            if (attackType == 1) {
                shootPosition = new Vector2(5);
                turret = new Turret(stage, this, shootPosition, 32, 32, 0, 1, 1, false, true, 0, 1, 6);
                stage.weapons.Add(turret);
            }
        }
        public Sword(Stage stage, float x, float y, int width, int height, Character user)
            : base(stage, x, y, width, height)
        {
            this.user = user;
            //if (stage.player != null) this.player = stage.player;
            if (user is Player) this.player = user as Player;

            position = new Vector2();
            //criterionVector = new Vector2(this.player.position.X + player.width / 2, player.position.Y + player.height / 2);
            criterionVector = new Vector2(this.user.position.X + user.width / 2, user.position.Y + user.height / 2);

            damagedObjects = new List<Object>();
            degree = 100;
            //swordBeam = new Bullet(stage,this,null,this.position,40,8);
            beamTurret = new Turret(stage, this, new Vector2(5, 5), 40, 8, 0, 1, 1);
            animation = new Animation(64, 96);
            animation2 = new Animation(128, 80);

            Load();
        }
        public Bullet(Stage stage, Turret turret, int width, int height, int textureType, int dissapearType, string seName)
            : base(stage, width, height)
        {
            this.turret = turret;
            this.shootPosition = turret.position;
            this.position = turret.position;
            this.textureType = textureType;
            this.disappearPattern = dissapearType;
            activeDistance = stage.inBossBattle ? Game1.Width * 2 : Game1.Width + 120; ;
            marginalDistance = stage.inBossBattle ? Game1.Width * 2 : 320;

            // Load後にテクスチャのサイズから取得した方がいいよな...?
            switch (textureType) {
                case 0:
                    this.width = 32;//32;
                    this.height = 32;//32;
                    break;
                case 1:
                    this.width = 32;//32;
                    this.height = 32;//32;
                    break;
                case 2:
                    this.width = 32;//32;
                    this.height = 32;//32;
                    break;
                case 3:
                    this.width = 32;//32;
                    this.height = 32;//16;
                    //degree = -180;
                    break;
            }
            //animation = new Animation(texture.Width, texture.Height);//(this.width, this.height);
            if (seName != "") {
                shootSound = game.Content.Load<SoundEffect>("Audio\\SE\\" + seName);
                shootSoundInstance = shootSound.CreateInstance();
                shootSoundInstance.Volume = .5f;
            }
            isHostile = true;

            Load();
        }
        // コンストラクタ
        public Rival(Stage stage, float x, float y, int width, int height, int HP, float vx, int bulletType, int shootType)
            : base(stage, x, y, width, height, HP, bulletType, shootType)
        {
            bind = new Object(stage, x, y, 16, 16);
            sword = new Sword(stage, 200, 100, 64, 8, this);
            thunderTurret = new Turret(stage, this, new Vector2(5), 64, 48, 2, 0, 3, false, true, 3, 3);
            cutterTurret = new Turret(stage, this, this.position, 32, 32, 0, 0, 1, false, true, 0, 4);
            cutterTurret.bulletSpeed = new Vector2(-20, 0);
            syuriken = new Turret(stage, this, new Vector2(5), 32, 32, 0, 0, 1, false, true, 0, 2, 10, 10, 5, new Vector2(-10, 0), false, false, "katana");
            //syuriken = new Turret(stage, this, this.position, 32, 32, 0, 1, 1, false, true, false, 3, 0, 2, 10, 120, 30, new Vector2(-10, 0), false, false);
            //syuriken = new Turret(stage, this, this.position, 32, 32, 0, 0, 1, false, true, false, 3, 0, 4);
            //syuriken.bulletSpeed = new Vector2(-10, 0);
            turrets.Add(thunderTurret);
            turrets.Add(cutterTurret);
            turrets.Add(syuriken);
            weapons.Add(thunderTurret);

            obstacleWindSmall = new Obstacle(stage, this, x, y, 32, 32, 2, 3);	// =MapObjectsを生成 // 2
            obstacleWindLarge = new Obstacle(stage, this, x, y, 32, 32, 2, 4);
            weapons.Add(obstacleWindSmall);
            weapons.Add(obstacleWindLarge);
            weapons.Add(sword);
            foreach (Turret tur in turrets) weapons.Add(tur);
            foreach (Weapon weapon in weapons) stage.weapons.Add(weapon);		// stageのweaponsに追加

            defaultPosition = new Vector2(x, y);// 15000, 360
            defPosOtherSide = new Vector2(x - 480, y);
            attackPosition = new Vector2(x, y - 200);							// 雷撃とか用
            CenterPos = new Vector2(defaultPosition.X - 240, 240);
            //turnsRight = true;
            animation = new Animation(48, 48);
            jumpAnimation = new Animation(48, 48);
            rnd = new Random();
            maxSpeed = 28;
            //Load();
        }
 public Bullet(Stage stage, Turret turret, int width, int height, int textureType)
     : this(stage, turret, width, height, textureType, 0, "")
 {
 }
 // コンストラクタ
 public Bullet(Stage stage, Turret turret, int width, int height)
     : this(stage, turret, width, height, 0)
 {
 }
		public Raijin(Stage stage, float x, float y, int width, int height, int HP)
			: base(stage, x, y, width, height, HP)
		{
			this.defaultPosition = position;

            bindSize = new Vector2(130, 200);
            defBindPos = new Vector2(120, 50);//(100, 0);
            defBindPosOther = new Vector2(width - defBindPos.X - bindSize.X , 0);
            

			tmpPosition = defaultPosition + new Vector2(-150, -50);
			attackPosition = new Vector2(defaultPosition.X - 640, defaultPosition.Y - 50);
			singleLightning = new Weapon(stage, position.X, position.Y, 16, 200, this);					// アニメーションの関係でWeaponじゃ処理しきれないのでBeamに移行
			dividingLightning = new DivisionWeapon(stage, position.X, position.Y, 32, 32, this, 1.0f);
			obstacle = new Obstacle(stage, this, x, y, 32, 64, 0);
			ballTurret = new Turret(stage, this, position, 32, 32, 0, 0, 1, false, false, 0, 1);		// 他目的の雲object生成  , , 0
			ballTurret.bulletSpeed = new Vector2(0, 8);

			thunderTurret = new Turret(stage, this, this.position, 64, 48, 2, 0, 3, false, false, 3, 3, 14, 120, 10);//, , 3...2
			thunderTurret.isVisible = true;
			thunderTurret2 = new Turret(stage, this, this.position, 64, 48, 2, 0, 3, false, false, 3, 3, 14, 120, 10);//, , 3...2
			thunderTurret3 = new Turret(stage, this, this.position, 64, 48, 2, 3, 3, false, false, 3, 3, 14, 120, 10);//, , 3...2
            thunderTurret.isVisible = true; thunderTurret2.isVisible = true; thunderTurret3.isVisible = true;

			beamTurret = new Turret(stage, this, new Vector2(width / 2 - 16, height - 32), 32, 32, 1, 0, 1, true);//, , 2 //new Vector2(width / 2 + 32, height)
			thunderTurret8Way = new Turret(stage, this, this.position, 64, 48, 2, 3, 8, false, false, 3, 3, 14, 360, 30);//...3
            thunderTurret8Way.isVisible = true;

			for (int i = 0; i < 10; i++) {// 10
				thunderTurrets.Add(new Turret(stage, this, this.position, 64, 48, 2, 1, 5, false, false, 3, 3, 14, 240, 40));//...1 // 240
                thunderTurrets[i].isVisible = true;
            }
			thunderTurrets[0].isMarked = true;
			thunderTurrets3Way.Add(thunderTurret);
			thunderTurrets3Way.Add(thunderTurret2);
			thunderTurrets3Way.Add(thunderTurret3);
			turrets.Add(thunderTurret8Way);

			// Add them to turrets
			turrets.Add(ballTurret);
			turrets.Add(beamTurret);
			foreach (Turret tur in thunderTurrets) {
				turrets.Add(tur);
			}
			foreach (Turret tur in thunderTurrets3Way) {
				turrets.Add(tur);
			}

			obstacleNum = 10;
			for (int i = 0; i < obstacleNum; i++) {
				obstacles.Add(new Obstacle(stage, this, x, y, 32, 64, 0));//OdueOPSNOa
			}

			// Add them to this.weapons
			weapons.Add(singleLightning);
			weapons.Add(dividingLightning);
			weapons.Add(obstacle);
			foreach (Turret tur in turrets) weapons.Add(tur);
			foreach (Obstacle obs in obstacles) weapons.Add(obs);

			// Add weapons to stage.weapons
			foreach (Weapon weapon in weapons) stage.weapons.Add(weapon);
			foreach (Weapon weapon in weapons) stage.objects.Add(weapon);

			jumpingEnemy = new JumpingEnemy(stage, position.X, position.Y, 32, 32, 2, this);
			stage.characters.Add(jumpingEnemy);

			Initialize();
		}
Exemple #17
0
 public Beam(Stage stage, Turret turret, int width, int height, int type)
     : this(stage, turret, width, height, type, 0)
 {
 }
		private void ControlTurret(Turret targetTurret, int type, float speedX)
		{
			targetTurret.isBeingUsed = true;
			switch (type) {
				case 0:
					//targetTurret.RoundTripMotion(defaultPosition - new Vector2(200, 0), 200, speedX);
					break;
				case 1:
					targetTurret.speed = new Vector2(-speedX, 0);
					targetTurret.position += targetTurret.speed * timeCoef;
					break;
				//UpdateTurrets(3);
			}

			if (!targetTurret.isAlive) {
				targetTurret.isBeingUsed = false;
				isUsingTurret = false;
			}
		}
 public Thunder(Stage stage, Turret turret, int width, int height)
     : this(stage, turret, width, height, 0)
 {
 }