Beispiel #1
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(graphics.GraphicsDevice);

            GameServices.AddService <GraphicsDevice>(graphics.GraphicsDevice);
            GameServices.AddService <SpriteBatch>(spriteBatch);
            GameServices.AddService <ContentManager>(Content);

            SpriteSturcture spriteSturcture = new SpriteSturcture("player", "Player", 2, 3);
            MotionStructure motionStructure = new MotionStructure(Center, 300f);
            DrawStructure   drawStructure   = new DrawStructure(Vector2.One, 0f, Color.White, SpriteEffects.None, 1.0f);
            Animation       animation       = new Animation("Flash", new List <int> {
                1, 2, 3, 4, 5, 6
            }, 10);
            AnimationStructure animationStructure = new AnimationStructure(animation);

            GameObject gameObject = new GameObject(spriteSturcture, motionStructure, drawStructure, animationStructure);

            GameContent.AddObject(gameObject);
        }
        public AnimatedObject(Texture2D texture, int Width, int Height)
            : base(texture)
        {
            animations = new Dictionary <String, AnimationStructure>();

            sourceRectangle = new Rectangle(0, 0, Width, Height);
            origin          = new Vector2(sourceRectangle.Width / 2, sourceRectangle.Height / 2);

            AnimationStructure animationDefault;

            animationDefault                 = new AnimationStructure();
            animationDefault.frameWidth      = Width;
            animationDefault.frameHeight     = Height;
            animationDefault.startX          = 0;
            animationDefault.startY          = 0;
            animationDefault.framesPerSecond = 100;
            animationDefault.frameCount      = 1;
            animationDefault.framesPerLine   = 1;
            this.AddAnimation("default", animationDefault);
        }
        public AnimatedObject(Texture2D textura, int Width, int Height)
            : base(textura)
        {
            animations = new Dictionary<String, AnimationStructure>();

            sourceRectangle = new Rectangle(0, 0, Width, Height);
            VetorDeOrigem = new Vector2 (sourceRectangle.Width / 2, sourceRectangle.Height / 2);

            AnimationStructure animationDefault;
            animationDefault = new AnimationStructure();
            animationDefault.frameWidth = Width;
            animationDefault.frameHeight = Height;
            animationDefault.X = 0;
            animationDefault.Y = 0;
            animationDefault.framesPerSecond = 100;
            animationDefault.frameCount = 1;
            this.AddAnimation("default", animationDefault);

            animationTime = new TimeSpan();

            this.ChangeAnimation("default");
        }
Beispiel #4
0
        public AnimatedObject(Texture2D textura, int Width, int Height)
            : base(textura)
        {
            animations = new Dictionary <String, AnimationStructure>();

            sourceRectangle = new Rectangle(0, 0, Width, Height);
            VetorDeOrigem   = new Vector2(sourceRectangle.Width / 2, sourceRectangle.Height / 2);


            AnimationStructure animationDefault;

            animationDefault                 = new AnimationStructure();
            animationDefault.frameWidth      = Width;
            animationDefault.frameHeight     = Height;
            animationDefault.X               = 0;
            animationDefault.Y               = 0;
            animationDefault.framesPerSecond = 100;
            animationDefault.frameCount      = 1;
            this.AddAnimation("default", animationDefault);

            animationTime = new TimeSpan();

            this.ChangeAnimation("default");
        }
 public void ChangeAnimation(String name)
 {
     animation = animations[name];
 }
 public void AddAnimation(String name, AnimationStructure animation)
 {
     animations.Add(name, animation);
 }
Beispiel #7
0
 public void ChangeAnimation(String name)
 {
     animation = animations[name];
 }
Beispiel #8
0
 public void AddAnimation(String name, AnimationStructure animation)
 {
     animations.Add(name, animation);
 }
Beispiel #9
0
 public GameObject(SpriteSturcture spriteSturcture, MotionStructure motionStructure, DrawStructure drawStructure, AnimationStructure animationStructure) : base(spriteSturcture, motionStructure, drawStructure, animationStructure)
 {
     Generic = (GameObject)base.MemberwiseClone();
 }