Example #1
0
        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();
        }
        protected override void ResolveDependencies()
        {
            base.ResolveDependencies();

            var leftJoystickEntity = this.EntityManager.Find(LeftJoystickEntityPath);

            if (leftJoystickEntity != null)
            {
                this.leftJoystick = leftJoystickEntity.FindComponent <JoystickComponent>();
            }
            var fireButtonEntity = this.EntityManager.Find(FireButtonEntityPath);

            if (fireButtonEntity != null)
            {
                this.fireButton = this.EntityManager.Find(FireButtonEntityPath).FindComponent <JoystickComponent>();
            }

            var gamePlayEntity = this.EntityManager.Find(GamePlayEntityPath);

            if (gamePlayEntity != null)
            {
                this.gamePlay            = this.EntityManager.Find(GamePlayEntityPath).FindComponent <GameplayBehavior>();
                this.gamePlay.Player     = this.Owner;
                this.gamePlay.GameReset += this.GamePlayGameReset;
            }
        }
Example #3
0
        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;
        }
Example #4
0
        protected override void Initialize()
        {
            base.Initialize();

            var gamePlayEntity = this.EntityManager.Find(GamePlayEntityPath);

            if (gamePlayEntity != null)
            {
                this.gamePlay = this.EntityManager.Find(GamePlayEntityPath).FindComponent <GameplayBehavior>();
            }
        }
        protected override void ResolveDependencies()
        {
            base.ResolveDependencies();

            var gamePlayEntity = this.EntityManager.Find(GamePlayEntityPath);

            if (gamePlayEntity != null)
            {
                this.gamePlay            = this.EntityManager.Find(GamePlayEntityPath).FindComponent <GameplayBehavior>();
                this.gamePlay.GameReset += this.GamePlayGameReset;
            }
        }
Example #6
0
        protected override void ResolveDependencies()
        {
            base.ResolveDependencies();

            this.gamePlay = this.EntityManager.Find(GamePlayEntityPath).FindComponent <GameplayBehavior>();
        }