Пример #1
0
        static void Main(string[] args)
        {
            //Console.WriteLine("Hello World!");
            Factoy myfactory = new Factoy();
            Shape shape1 = myfactory.CreateShape("Triangle", 1, 1, 1);
            Shape shape2 = myfactory.CreateShape("Triangle", 2, 2, 2);
            Shape shape3 = myfactory.CreateShape("Triangle", 3, 3, 3);
            Shape shape4 = myfactory.CreateShape("Triangle", 4, 4, 4);
            Shape shape5 = myfactory.CreateShape("Rectangle", 1, 2);
            Shape shape6 = myfactory.CreateShape("Rectangle", 3, 4);
            Shape shape7 = myfactory.CreateShape("Rectangle", 5, 6);
            Shape shape8 = myfactory.CreateShape("Square", 1);
            Shape shape9 = myfactory.CreateShape("Square", 2);
            Shape shape10 = myfactory.CreateShape("Square", 3);

            Console.WriteLine( Convert.ToString(shape1.CalArea()+shape2.CalArea()+shape3.CalArea()+shape4.CalArea()
                +shape5.CalArea()+shape6.CalArea()+shape7.CalArea()+shape8.CalArea()+shape9.CalArea()
                +shape10.CalArea())
                );
        }
Пример #2
0
    public void Load_building(Gui_building_icon icon)
    {
        GameObject           temp = null;
        Data_player_building data = new Data_player_building()
        {
            Id = 0, Id_building = 0, Id_list = 0, Id_player = 0, Location = "0,0,0"
        };

        if (icon.Data.Id_type == 0)
        {
            temp = new Shop().Get_new_objectSQL(data, icon.Data);
        }
        if (icon.Data.Id_type == 1)
        {
            temp = new Factoy().Get_new_objectSQL(data, icon.Data);
        }
        if (icon.Data.Id_type == 2)
        {
            temp = new House().Get_new_objectSQL(data, icon.Data);
        }
        if (icon.Data.Id_type == 3)
        {
            temp = new Farm().Get_new_objectSQL(data, icon.Data);
        }
        if (temp != null)
        {
            GameObject budynki = GameObject.Find("budynki");
            if (budynki is null)
            {
                budynki = new GameObject("budynki");
            }

            temp.transform.parent = budynki.transform;
            Acction a1 = new A_place(temp);
            Acction a2 = new A_send_to_DB(temp, icon.Data);
            temp.GetComponent <Entity>().Add_action(a1);
            temp.GetComponent <Entity>().Add_action(a2);
            temp.GetComponent <Entity>().Start_actions();
        }
    }