Ejemplo n.º 1
0
        private void ChaseAndAttack(ref NodeStatus status)
        {
            rotation.Enable();

            if (targetingComponent.HasTarget)
            {
                Owner.Body.Velocity = Vector2.Zero;

                steeringComponent.Disable();

                Console.WriteLine("Has target and at target...");
            }
            else
            {
                steeringComponent.Enable();

                steeringComponent.Current.TargetX = currentTarget.Position.X;
                steeringComponent.Current.TargetY = currentTarget.Position.Y;

                spriterComponent.FlipX = Owner.Body.Velocity.X > 0f;
            }

            resting = elapsed > TARGET_SWAP_TIME;

            if (resting)
            {
                status = NodeStatus.Success;

                rotation.Disable();

                return;
            }

            status = NodeStatus.Running;
        }
Ejemplo n.º 2
0
        private void Attack(ref NodeStatus status)
        {
            NeedsTarget(ref status);

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

            if (status == NodeStatus.Success)
            {
                rotation.Enable();
            }
            else
            {
                rotation.Disable();

                status = NodeStatus.Failed;
            }
        }
Ejemplo n.º 3
0
        private void Attack(ref NodeStatus status)
        {
            TargetingComponent targetingComponent = Owner.FirstComponentOfType <TargetingComponent>();
            SkillRotation      rotation           = Owner.FirstComponentOfType <SkillRotation>();

            if (targetingComponent.HasTarget && targetingComponent.Target.Name.StartsWith("Player"))
            {
                status = NodeStatus.Running;

                rotation.Enable();
            }
            else
            {
                status = NodeStatus.Failed;

                rotation.Disable();
            }
        }
Ejemplo n.º 4
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();
        }