Пример #1
0
        public override void Create()
        {
            Stage.BackgroundColor = Color.Black;

            CreateStarField();
            Layers.Add("debris", -1)
                .SetBlendState(BlendState.NonPremultiplied);

            World.AddGameObject("ship")
                .Set.Position(60, 360)
                .Set.RotationDegrees(90)
                .Add.SpriteRenderer("ship")
                .Add.AudioSource("fire")
                .Add.Component(new ShipBehavior());

            var shakeBehavior = new ShakeBehavior();
            Camera.Add.Component(shakeBehavior);

            World.AddGameObject()
                .Add.Component(new SpawnEnemyBehavior(shakeBehavior));
        }
Пример #2
0
 public SpawnEnemyBehavior(ShakeBehavior cameraShaker)
 {
     _cameraShaker = cameraShaker;
 }
Пример #3
0
 public EnemyShipBehavior(float speed, ShakeBehavior cameraShaker)
 {
     _speed = speed;
     _direction = new Vector2(-1, 0);
     _cameraShaker = cameraShaker;
 }