示例#1
0
        public Circle(Vector2 offset, RigidBody owner, float ray)
        {
            relativePosition = offset;
            RigidBody        = owner;
            Ray = ray;

            if (Debug)
            {
                IsActive       = true;
                circleCollider = new Sprite(ray * 2, ray * 2);
                texture        = GfxManager.GetSpritesheet("circle").Item1;
                Layer          = DrawManager.Layer.Foreground;
                DrawManager.AddItem(this);
                UpdateManager.AddItem(this);
            }
        }
示例#2
0
文件: Rect.cs 项目: ngaeta/Bomberman
        public Rect(Vector2 offset, RigidBody owner, float width, float height)
        {
            relativePosition = offset;
            RigidBody        = owner;
            HalfWidth        = width / 2;
            HalfHeight       = height / 2;

            if (Debug)
            {
                IsActive     = true;
                rectCollider = new Sprite(width, height);
                texture      = GfxManager.GetSpritesheet("rectangle").Item1;
                Layer        = DrawManager.Layer.Foreground;
                DrawManager.AddItem(this);
                UpdateManager.AddItem(this);
            }
        }
示例#3
0
        public GameObject(
            Vector2 spritePosition, string spriteSheetName,
            DrawManager.Layer drawLayer = DrawManager.Layer.Playground)
        {
            Tuple <Texture, List <Animation> > ss = GfxManager.GetSpritesheet(spriteSheetName);

            texture         = ss.Item1;
            animations      = ss.Item2;
            Animation       = animations[0];
            sprite          = new Sprite(Game.PixelsToUnit(Animation.FrameWidth), Game.PixelsToUnit(Animation.FrameHeight));
            sprite.position = spritePosition;
            sprite.pivot    = new Vector2(Width / 2, Height / 2);
            layer           = drawLayer;
            IsActive        = true;

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