コード例 #1
0
        public EBoss(World world, SpriteBatch spriteBatch, Vector2 position)
            : base(world, spriteBatch, position)
        {
            this.Mass = 1;
            this.Name = EBoss.NAME;

            //Load the boss' information from the XML file
            LoadBossXmlFile();

            //Load the boss' Roles
            SetUpRoles();

            //Create the Animation Player and give it the Idle Animation
            this.animationPlayer = new AnimationPlayer(spriteBatch, currentRole.AnimationMap["Idle"]);

            //Set the current animation
            currentAnimation = animationPlayer.Animation;

            //Set the current state
            currentState = "Idle";

            //Set the Velocity
            Velocity = new Vector2(0, 0);

            //Set the position
            this.Position = position;

            didBulletCollide = false;

            //Set the facing
            facing = SpriteEffects.FlipHorizontally;

            //Set the Death push back
            deathPushBack = new Vector2(-1.0f, 0);

            //Set Movement Speed
            this.groundVelocity = new Vector2(0.5f, 0);

            // set up our FAKE jump velocity
            this.jumpVelocity = new Vector2(0f, 13f);

            List<CollisionHotspot> hotspots = new List<CollisionHotspot>();
            hotspots.Add(new CollisionHotspot(this, new Vector2(13, -27), HOTSPOT_TYPE.top));
            hotspots.Add(new CollisionHotspot(this, new Vector2(1, -6), HOTSPOT_TYPE.left));
            hotspots.Add(new CollisionHotspot(this, new Vector2(1, 12), HOTSPOT_TYPE.left));
            hotspots.Add(new CollisionHotspot(this, new Vector2(17, -6), HOTSPOT_TYPE.right));
            hotspots.Add(new CollisionHotspot(this, new Vector2(17, 12), HOTSPOT_TYPE.right));
            hotspots.Add(new CollisionHotspot(this, new Vector2(11, 30), HOTSPOT_TYPE.bottom));

            Hotspots = hotspots;

            //Setup the Bounding Box
            boundingBoxHeight = 59;
            boundingBoxWidth = 34;
            this.boundingBoxOffset = new Vector2();
            this.boundingBoxOffset.X = boundingBoxWidth / 2;
            this.boundingBoxOffset.Y = boundingBoxHeight / 2;

            laughingAIState = new EBossLaughingState(this);
            shootAIState = new EBossShootState(this, this.ParentScreen);
            jumpAIState = new EBossJumpState(this.ParentScreen, this);
            moveAIState = new EbossMoveState(this);
            hitAIState = new EBossHitState(this);
        }
コード例 #2
0
 private void SetAIState(EBossState state)
 {
     if (currentAIState != state)
     {
         currentAIState = state;
     }
 }