Esempio n. 1
0
    IComponent component;            //now only objects inheriting IComponent can be assigned here

    public void DrawComponent()
    {
        unit u = component as unit;

        if (u != null)
        {
            u.Draw();
        }
        enemy e = component as enemy;

        if (e != null)
        {
            e.DrawIfVisible();
        }
    }