Пример #1
0
 public BackgroundObject(Texture2D texture, Vector2 position, float rotation, float size, Strategy strategy)
 {
     _sprite = new Sprite(texture);
     Position = position;
     _sprite.Position = position;
     _sprite.Scale = new Vector2(size);
     _sprite.Color = ColorFromSize(size);
     _sprite.CenterOrigin();
     _rotation = rotation;
     _strategy = strategy;
 }
Пример #2
0
        public LevelSelectWindow(WindowHandler windowHandler)
        {
            _windowHandler = windowHandler;
            GraphicsDevice graphicsDevice = _windowHandler.Game.GraphicsDevice;
            _spriteBatch = new SpriteBatch(graphicsDevice);
            _camera = new Camera2D(graphicsDevice);

            _spriteList = new List<Sprite>();

            _background = new Sprite(Game1.contentManager.Load<Texture2D>(@"Images\LevelSelectMan"));
            float windowScaleRatio = graphicsDevice.Viewport.Height / _background.OriginalSize.Y;
            _background.Scale = new Vector2(windowScaleRatio / START_ZOOM);
            _background.CenterOrigin();

            _background.Position = Utils.GetScreenCenter(graphicsDevice);

            _dot = new Sprite(Game1.contentManager.Load<Texture2D>(@"Images\Dot"));
            _dot.CenterOrigin();
            _dot.Color = Color.DarkRed;

            _spriteList.Add(_background);

            Vector2 imageScaledSize = _background.ScaledSize / 2;

            HEART_POSITION = Utils.GetScreenCenter(graphicsDevice);
            KNEE_POSITION = Utils.GetScreenCenter(graphicsDevice);
            NECK_POSITION = Utils.GetScreenCenter(graphicsDevice);
            BRAIN_POSITION = Utils.GetScreenCenter(graphicsDevice);

            HEART_POSITION.X += imageScaledSize.X * -0.005f;
            HEART_POSITION.Y += imageScaledSize.Y * -0.41f;

            KNEE_POSITION.X += imageScaledSize.X * 0.06f;
            KNEE_POSITION.Y += imageScaledSize.Y * 0.43f;

            NECK_POSITION.X += imageScaledSize.X * -0.01f;
            NECK_POSITION.Y += imageScaledSize.Y * -0.65f;

            BRAIN_POSITION.X += imageScaledSize.X * -0.01f;
            BRAIN_POSITION.Y += imageScaledSize.Y * -0.85f;

            BodyPartPositions[BodyPartType.BRAIN] = BRAIN_POSITION;
            BodyPartPositions[BodyPartType.HEART] = HEART_POSITION;
            BodyPartPositions[BodyPartType.NECK] = NECK_POSITION;
            BodyPartPositions[BodyPartType.KNEE] = KNEE_POSITION;
        }
Пример #3
0
 private void Init()
 {
     InitCellTextures();
     Sprite = new Sprite(_sadTexture);
     Sprite.CenterOrigin();
     Sprite.Scale = new Vector2(0.14f);
     _virusResistance = 5;
     CreateBody();
     Body.LinearDamping = 1;
 }
Пример #4
0
 private void init()
 {
     Strategy.Owner = this;
     _virusType = Shared.Random.Next(4);
     _virusType = 0;
     InitCellTextures();
     Sprite = new Sprite(_virusTexture);
     Sprite.CenterOrigin();
     Sprite.Scale = new Vector2(0.08f);
     CreateBody();
     Body.UserData = this;
 }