Пример #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 Player(LostSoulGame game)
            : base(game)
        {
            Score = 0;

            Texture2D texture = game.ContentLoader.Crosshair;

            bodyBehavior   = new GameObjectBodyBehavior(this);
            renderBehavior = new SpriteRenderBehavior(game, texture);
            RenderBehavior.CenterOrigin();

            inputBehavior  = new PlayerInputBehavior(game);
            actionBehavior = new PlayerActionBehavior();
            healthBehavior = new HealthBehavior(this);
        }
Пример #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);
        }