public void AddRenderer(GraphicsDevice gd, SpriteTransparency transparency) { if (Renderer == null) { bool isOpaque = transparency == SpriteTransparency.Opaque ? true : false; Renderer = new Renderer(this, gd, isOpaque); components.Add(Renderer); } ComponentAdded(Renderer); }
public static GameObject CreateStaticGO(GraphicsDevice graphicsDevice, Texture2D sprite, SpriteTransparency transparency) { GameObject staticGO = new GameObject(); staticGO.AddTransform(); staticGO.AddStaticSprite(sprite); staticGO.AddRenderer(graphicsDevice, transparency); return(staticGO); }
// TODO: Create factory helper with GD and Content. Make Tex a string, load in factory. public static GameObject CreateStaticPhysicsGO(GraphicsDevice graphicsDevice, Texture2D sprite, SpriteTransparency transparency, bool fixedRotation = false, float friction = 2f) { GameObject staticGO = CreateStaticGO(graphicsDevice, sprite, transparency); staticGO.AddStaticRigidBody(new Vector2(sprite.Bounds.Width, sprite.Bounds.Height), fixedRotation, friction); return(staticGO); }