| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- namespace Tutorial026.Sprites
- {
- public class Sprite : Component
- {
- protected Texture2D _texture;
- public Vector2 Position;
- public Rectangle Rectangle
- {
- get
- {
- return new Rectangle((int)Position.X, (int)Position.Y, _texture.Width, _texture.Height);
- }
- }
- public bool IsRemoved { get; set; }
- public Sprite(Texture2D texture)
- {
- _texture = texture;
- }
- public override void Update(GameTime gameTime)
- {
- }
- public virtual void OnCollide(Sprite sprite)
- {
- }
- public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
- {
- spriteBatch.Draw(_texture, Position, Color.White);
- }
- }
- }
|