public PlayerBehavior(GameplayBehavior behavior) : base() { this.playBehavior = behavior; this.speed = Vector2.Zero; this.shootRatio = TimeSpan.FromMilliseconds(250); }
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; }
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(); }