예제 #1
0
        public GameObject(Vector2 spritePosition, string spritesheetName, DrawManager.Layer drawLayer = DrawManager.Layer.Playground)
        {
            Tuple <Texture, List <Animation> > spritesheet = GfxManager.GetSpritesheet(spritesheetName);

            texture    = spritesheet.Item1;
            Animations = spritesheet.Item2;
            Animation  = Animations[0];
            sprite     = new Sprite(Animation.FrameWidth, Animation.FrameHeight)
            {
                position = spritePosition
            };

            /*texture = GfxManager.GetTexture(textureName);
             * sprite = new Sprite(spriteWidth > 0 ? spriteWidth : texture.Width, spriteHeight > 0 ? spriteHeight : texture.Height)
             * {
             *  position = spritePosition
             * };*/
            layer = drawLayer;

            IsActive = true;

            UpdateManager.AddItem(this);
            DrawManager.AddItem(this);

            //Animation = new Animation((int)sprite.Width, (int)sprite.Height, cols, rows, fps, loop);
        }
예제 #2
0
        public override void Start()
        {
            base.Start();

            GfxManager.Init();
            GfxManager.Load();

            /*GfxManager.AddTexture("player", "Assets/playerShip.png");
             * GfxManager.AddTexture("bg", "Assets/spaceBg.png");
             * GfxManager.AddTexture("bullets", "Assets/beams.png");
             * GfxManager.AddTexture("fire", "Assets/fireGlobe.png");
             * GfxManager.AddTexture("enemy", "Assets/enemy.png");
             * GfxManager.AddTexture("redEnemy", "Assets/enemy2.png");
             * GfxManager.AddTexture("botEnemy", "Assets/omega.png");
             * GfxManager.AddTexture("bonus", "Assets/FF8_UFO.png");
             * GfxManager.AddTexture("explosion", "Assets/explosion.png");
             * GfxManager.AddTexture("playerBar", "Assets/loadingBar_bar.png");
             * GfxManager.AddTexture("barFrame", "Assets/loadingBar_frame.png");*/

            UpdateManager.Init();
            DrawManager.Init();
            PhysicsManager.Init();
            BulletManager.Init();
            SpawnManager.Init();

            player = new Player("player", new Vector2(Game.Window.Width / 2, Game.Window.Height / 2));
            bg     = new Background("bg", Vector2.Zero, -300);

            timer = 2f;
        }
예제 #3
0
 public override void OnExit()
 {
     UpdateManager.RemoveAll();
     DrawManager.RemoveAll();
     PhysicsManager.RemoveAll();
     GfxManager.RemoveAll();
     BulletManager.RemoveAll();
     SpawnManager.RemoveAll();
 }
예제 #4
0
        public Bar(Vector2 position, string textureName = "playerBar", float maxValue = 100, int height = 0) : base(position, textureName, DrawManager.Layer.GUI)
        {
            barWidth = texture.Width;
            value    = MaxValue = maxValue;

            frameTexture = GfxManager.GetSpritesheet("barFrame").Item1;
            frame        = new Sprite(frameTexture.Width, frameTexture.Height)
            {
                position = position
            };
        }