Example #1
0
        // TODO: duplicated code. Crawlerilla melkein sama init logic.
        protected override void OnInitialize()
        {
            MonsterBuilder builder = new ZombieBuilder();

            builder.Build(Owner);

            Tree tree = CreateTree();

            tree.Initialize();

            Owner.AddComponent(tree);

            // Idle, Walk, Attack
            spriterComponent = new SpriterComponent <Texture2D>(Owner, @"Animations\GenericZombie\GenericZombie");
            spriterComponent.Initialize();
            spriterComponent.ChangeAnimation("Walk");
            spriterComponent.Scale = 0.5f;

            Owner.AddComponent(spriterComponent);

            steeringComponent = Owner.FirstComponentOfType <SteeringComponent>();

            SteeringBehavior flee = new FleeBehavior()
            {
                DesiredVelocity = new Vector2(4.25f),
                MaxSpeed        = 3.25f
            };

            SteeringBehavior seek = new SeekBehavior()
            {
                DesiredVelocity = new Vector2(4.25f),
                MaxSpeed        = 3.25f
            };

            steeringComponent.AddBehavior(flee);
            steeringComponent.AddBehavior(seek);

            steeringComponent.ChangeActiveBehavior(typeof(SeekBehavior));
        }
Example #2
0
        protected override void OnInitialize()
        {
            MonsterBuilder builder = new CrawlerBuilder();

            builder.Build(Owner);

            Tree tree = CreateTree();

            tree.Initialize();

            Owner.AddComponent(tree);

            spriterComponent = new SpriterComponent <Texture2D>(Owner, @"Animations\Crawler\crawler");
            spriterComponent.Initialize();
            spriterComponent.ChangeAnimation("NewAnimation");
            spriterComponent.Scale = 0.3f;

            Owner.AddComponent(spriterComponent);

            steeringComponent = Owner.FirstComponentOfType <SteeringComponent>();

            SteeringBehavior flee = new FleeBehavior()
            {
                DesiredVelocity = new Vector2(2.25f),
                MaxSpeed        = 1.25f
            };

            SteeringBehavior seek = new SeekBehavior()
            {
                DesiredVelocity = new Vector2(2.25f),
                MaxSpeed        = 1.25f
            };

            steeringComponent.AddBehavior(flee);
            steeringComponent.AddBehavior(seek);

            steeringComponent.ChangeActiveBehavior(typeof(SeekBehavior));
        }
Example #3
0
        protected override void OnInitialize()
        {
            MonsterBuilder builder = new BlobBuilder();

            builder.Build(Owner);

            Tree tree = CreateTree();

            tree.Initialize();

            Owner.AddComponent(tree);

            spriterComponent = new SpriterComponent <Texture2D>(Owner, @"Animations\Boss\Boss");
            spriterComponent.Initialize();
            spriterComponent.ChangeAnimation("Walk");
            spriterComponent.Scale = 0.75f;

            Owner.AddComponent(spriterComponent);

            steeringComponent = Owner.FirstComponentOfType <SteeringComponent>();

            SteeringBehavior seek = new SeekBehavior()
            {
                DesiredVelocity = new Vector2(1.25f),
                MaxSpeed        = 1.25f
            };

            steeringComponent.AddBehavior(seek);

            steeringComponent.ChangeActiveBehavior(typeof(SeekBehavior));

            rotation           = Owner.FirstComponentOfType <SkillRotation>();
            targetingComponent = Owner.FirstComponentOfType <TargetingComponent>();

            BossHealthComponent c = new BossHealthComponent(Owner);

            c.Initialize();
            Owner.AddComponent(c);

            rotation.Enable();
        }