示例#1
0
        public DemonSprite(SpriteBasis sb)
        {
            animationAtlas = new Dictionary<AnimationState, Filmstrip>();
            animationAtlas[AnimationState.Idle] = createFilmstrip( 0 );
            animationAtlas[AnimationState.Pressing] = createFilmstrip( 1 );
            animationAtlas[AnimationState.Disappearing] = createFilmstrip( new[] { 1, 2, 3, 4, 5, 6 } );
            animationAtlas[AnimationState.Disappearing].FrameDuration = 120;
            animationAtlas[AnimationState.Hidden] = createFilmstrip( 6 );
            animationAtlas[AnimationState.Reappearing] = createFilmstrip( new[] { 6, 5, 4, 3, 2, 1} );
            animationAtlas[AnimationState.Reappearing].FrameDuration = 120;

            DemonSprite that = this;

            animationAtlas[AnimationState.Disappearing].OnEnd = ( Filmstrip fs ) => {

                that.SetAnimationState( AnimationState.Hidden );

                return this.currentAnimation.FinishProcessAnimation( 0 );
            };

            animationAtlas[AnimationState.Reappearing].OnEnd = ( Filmstrip fs ) => {
                that.SetAnimationState( AnimationState.Idle );

                return this.currentAnimation.FinishProcessAnimation( 0 );
            };

            this.currentAnimation = animationAtlas[AnimationState.Idle];
            this.Sprite = new Sprite(sb, currentAnimation);
        }
示例#2
0
        public WindowSprite( SpriteBasis sb )
        {
            //this.Sprite = new Sprite( sb, null, 0,0,false ); // let's just get a tmp sprite for calculation.  Trust me on this.

            animationAtlas = new Dictionary<AnimationState, Filmstrip>();
            animationAtlas[AnimationState.NormalIdle] = createFilmstrip( 0 );
            animationAtlas[AnimationState.Breaking] = createFilmstrip( new[] { 1, 2, 3 } );
            animationAtlas[AnimationState.Breaking].FrameDuration = 60;
            animationAtlas[AnimationState.AngryDude] = createFilmstrip( new[] { 4,5 } );
            animationAtlas[AnimationState.AngryDude].FrameDuration = 150;
            animationAtlas[AnimationState.DyingDude] = createFilmstrip( new[] { 6, 7 } );
            animationAtlas[AnimationState.DyingDude].FrameDuration = 150;
            animationAtlas[AnimationState.EmptyIdle] = createFilmstrip( 8 );

            WindowSprite that = this;

            animationAtlas[AnimationState.Breaking].OnEnd = ( Filmstrip fs ) => {

                that.SetAnimationState( AnimationState.AngryDude );

                return this.currentAnimation.FinishProcessAnimation( 0 );
            };

            animationAtlas[AnimationState.DyingDude].OnEnd = ( Filmstrip fs ) => {
                that.SetAnimationState( AnimationState.EmptyIdle );

                return this.currentAnimation.FinishProcessAnimation( 0 );
            };

            this.currentAnimation = animationAtlas[AnimationState.NormalIdle];
            this.Sprite = new Sprite(sb, currentAnimation);
        }
示例#3
0
        public BulletSprite(SpriteBasis sb)
        {
            animationAtlas = new Dictionary<AnimationState, Filmstrip>();
            animationAtlas[AnimationState.Bullet] = createFilmstrip(new[] { 0, 1 }, true);

            this.currentAnimation = animationAtlas[AnimationState.Bullet];
            this.Sprite = new Sprite(sb, currentAnimation);
        }
示例#4
0
        public CivvieSprite(SpriteBasis sb)
        {
            animationAtlas = new Dictionary<AnimationState, Filmstrip>();
            animationAtlas[AnimationState.Idle] = createFilmstrip(0);
            animationAtlas[AnimationState.WalkingRight] = createFilmstrip(new[] { 1, 0, 2, 0 }, true);
            animationAtlas[AnimationState.WalkingLeft] = createFilmstrip(new[] { 3, 7, 4, 7 }, true);
            animationAtlas[AnimationState.Flying] = createFilmstrip(5);
            animationAtlas[AnimationState.Dead] = createFilmstrip(6);

            this.currentAnimation = animationAtlas[AnimationState.Idle];
            this.Sprite = new Sprite(sb, currentAnimation);
        }
示例#5
0
        public DoorSprite( SpriteBasis sb )
        {
            animationAtlas = new Dictionary<AnimationState, Filmstrip>();
            animationAtlas[AnimationState.Stopped] = createFilmstrip( new[] { 0 } );
            animationAtlas[AnimationState.Slow] = createFilmstrip(new[] { 0, 1, 2, 1 });
            animationAtlas[AnimationState.Medium] = createFilmstrip(new[] { 0, 1, 2, 1 }, 75);
            animationAtlas[AnimationState.Fast] = createFilmstrip(new[] { 3, 4 });

            DrawDoor = (int x, int y) => {
                Sprite.Update();
                Sprite.Draw();
            };

            this.currentAnimation = animationAtlas[AnimationState.Slow];
            this.Sprite = new Sprite(sb, currentAnimation);
        }
示例#6
0
        public Sprite(SpriteBasis spr_basis, Filmstrip anim, int x_coord, int y_coord, bool visibility)
        {
            basis = spr_basis;
            deleted = false;

            // Positioning stuff
            hitbox = new Rectangle(x_coord, y_coord, spr_basis.default_hitbox.Width, spr_basis.default_hitbox.Height);
            exact_pos = new Vector2((float) x_coord, (float) y_coord);
            velocity = acceleration = Vector2.Zero;
            destination = new Rectangle(x_coord - spr_basis.default_hitbox.X, y_coord - spr_basis.default_hitbox.Y, spr_basis.frame_width, spr_basis.frame_height);

            // Display stuff
            opacity = 1.0f;
            rate = 1.0f;
            fixed_frame = -1;
            time_to_next = 0;
            visible = visibility;
            set_animation(anim);

            last_draw_tick = last_logic_tick = VERGEGame.game.tick;
        }
示例#7
0
 private void _SetAnimationStateHelper(AnimationState state)
 {
     this.CurrentState = state;
     this.currentAnimation = animationAtlas[state];
     Sprite.set_animation( currentAnimation );
     Sprite.cur_filmstrip.ResetAnimation();
 }
示例#8
0
 public void SetAnimationState(AnimationState state)
 {
     this.currentAnimation = animationAtlas[state];
     Sprite.set_animation(currentAnimation);
 }
示例#9
0
 public Sprite(SpriteBasis spr_basis, Filmstrip anim)
     : this(spr_basis, anim, 0, 0, false)
 {
 }
示例#10
0
 public void set_animation(Filmstrip anim)
 {
     cur_filmstrip = anim;
 }