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); } }
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); } }
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); }