Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        // 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);
        }