Пример #1
0
        public LostSoul(LostSoulGame game, LostSoulClass klass)
            : base(game)
        {
            Klass        = klass;
            bodyBehavior = new GameObjectBodyBehavior(this);

            renderBehavior = new SpriteRenderBehavior(game, game.ContentLoader.SkullLeft);
            Render.CenterOrigin();
            Render.Color = klass.Color;
            Render.Scale = klass.Scale;

            bodyBehavior.Size = Vector2.Multiply(renderBehavior.Size, klass.Scale);

            movementBehavior             = new MovementBehavior();
            animationBehavior            = new LostSoulAnimation(game);
            collisionBehavior            = new CollisionBehavior(this);
            healthBehavior               = new HealthBehavior(this);
            HealthBehavior.Health        = klass.Health;
            HealthBehavior.DeathEvent   += OnDeath;
            HealthBehavior.DamagedEvent += OnDamaged;

            positionObserver = new LostSoulPositionObserver(this);
            foreach (FactorModifierActor actor in game.World.EnemySpeedModifierActors)
            {
                if (!actor.Expired)
                {
                    movementBehavior.AddSpeedModifier(actor);
                }
            }
            game.World.SpeedModifierActorAdded += World_SpeedModifierActorAdded;
        }
Пример #2
0
        public Explosion(LostSoulGame game)
            : base(game)
        {
            bodyBehavior      = new GameObjectBodyBehavior(this);
            renderBehavior    = new SpriteRenderBehavior(game, game.ContentLoader.Explosion[0]);
            bodyBehavior.Size = renderBehavior.Size;
            var animationBehavior = new AnimationBehavior(AnimationFrame.MkCentered(game.ContentLoader.Explosion), 0.1f);

            animationBehavior.MarkEntityAsExpiredWhenDone = true;
            this.animationBehavior = animationBehavior;
            collisionBehavior      = new CollisionBehavior(this);
            CollisionBehavior.CollisionDetected += CollisionDetectedHandler;
        }
Пример #3
0
        public Bonus(LostSoulGame game, BonusClass bonusClass)
            : base(game)
        {
            this.bonusClass = bonusClass;

            bodyBehavior      = new GameObjectBodyBehavior(this);
            bodyBehavior.Size = new Vector2(32.0f, 32.0f);

            renderBehavior = bonusClass.MkRender(this);
            renderBehavior.CenterOrigin();

            healthBehavior             = new HealthBehavior(this);
            healthBehavior.DeathEvent += OnDeathHandler;

            collisionBehavior = new CollisionBehavior(this);
            actionBehavior    = new ExpirationActionBehavior(2.0f);
        }
Пример #4
0
 public void RegisterCollision(CollisionBehavior collisionBehavior)
 {
     collisions.Add(collisionBehavior);
 }