コード例 #1
0
ファイル: PlayerBehavior.cs プロジェクト: dezol/QuickStarters
 public PlayerBehavior(GameplayBehavior behavior)
     : base()
 {
     this.playBehavior = behavior;
     this.speed = Vector2.Zero;
     this.shootRatio = TimeSpan.FromMilliseconds(250);
 }
コード例 #2
0
ファイル: BulletManager.cs プロジェクト: dezol/QuickStarters
        public BulletManager(GameplayBehavior behavior)
            : base()
        {
            this.entity = new Entity("BulletManager");

            var bullets = new Entity[numBullets];

            for (int i = 0; i < numBullets; i++)
            {
                Entity bullet = CreateBullet(true);
                bullet.Enabled = false;
                this.entity.AddChild(bullet);

                bullets[i] = bullet;
            }

            var enemyBullets = new Entity[numEnemyBullets];

            for (int i = 0; i < numEnemyBullets; i++)
            {
                Entity bullet = CreateBullet(false);
                bullet.Enabled = false;
                this.entity.AddChild(bullet);

                enemyBullets[i] = bullet;
            }

            behavior.Bullets = bullets;
            behavior.EnemyBullets = enemyBullets;
        }
コード例 #3
0
 public PlayerBehavior(GameplayBehavior behavior)
     : base()
 {
     this.playBehavior = behavior;
     this.speed        = Vector2.Zero;
     this.shootRatio   = TimeSpan.FromMilliseconds(250);
 }
コード例 #4
0
ファイル: GamePlayScene.cs プロジェクト: dezol/QuickStarters
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");
            camera2d.BackgroundColor = Color.Black;
            EntityManager.Add(camera2d);

            System.Random rnd = new System.Random(23);

            CreateBackground();

            this.gameplayBehavior = new GameplayBehavior();

            this.gameplayBehavior.Scored += gameplayBehavior_Scored;

            this.AddSceneBehavior(this.gameplayBehavior, SceneBehavior.Order.PostUpdate);

            this.CreatePlanet();

            CreatePlayer();

            CreateEnemies(rnd);

            CreateStars();

            CreateHUD();

            this.gameplayBehavior.Reset();
        }