Exemplo n.º 1
0
    void GenerateSegments(BuildingParams buildingParams, Material material, Transform parent)
    {
        foundation = new Foundation(material, parent, foundationParams, buildingParams);

        for (int i = 0; i < floorCount; i++)
        {
            if (i == 0)
            {
                bases[i] = new Base(ref baseParams[i], foundation.obj.transform, material, buildingParams, null);
                bases[i].GenerateDoor(baseParams[i].doorParams, material);
            }
            else
            {
                bases[i] = new Base(ref baseParams[i], bases[i - 1].obj.transform, material, buildingParams, baseParams[i - 1]);
            }


            bases[i].GenerateWindows(baseParams[i], material);
        }

        attic = new Attic(material, atticParams, bases[floorCount - 1].obj.transform);
        attic.GenerateWindows(material);

        roof = new Roof(material, baseParams[floorCount - 1], roofParams, bases[floorCount - 1].obj.transform);

        chimney = new Chimney(chimneyParams, material, roof.obj.transform);
    }
Exemplo n.º 2
0
 // END CUT HERE
 // BEGIN CUT HERE
 public static void Main()
 {
     Chimney ___test = new Chimney();
     ___test.run_test(-1);
     try {
     } catch(Exception e) {
     //Console.WriteLine(e.StackTrace);
     Console.WriteLine(e.ToString());
     }
 }
Exemplo n.º 3
0
// END CUT HERE
// BEGIN CUT HERE
    public static void Main()
    {
        Chimney ___test = new Chimney();

        ___test.run_test(-1);
        try {
        } catch (Exception e) {
//Console.WriteLine(e.StackTrace);
            Console.WriteLine(e.ToString());
        }
    }
Exemplo n.º 4
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        Chimney chimney = collider.gameObject.GetComponent <Chimney>();

        if (chimney != null)
        {
            if (!isJeykll && charge.isCharging)
            {
                Debug.Log("You live");
            }
            else
            {
                Die();
            }
        }
    }
Exemplo n.º 5
0
    void OnCollisionEnter2D(Collision2D collided)
    {
        if (collided.collider.tag == "ChimneyEntrance")
        {
            santa.score++;

            Chimney chimney = collided.gameObject.GetComponentInParent <Chimney>();

            if (santa.score != 0 && santa.score % 20 == 0)
            {
                spawner.chimneySpeed++;
            }
        }
        else
        {
            santa.lives--;
        }

        Destroy(gameObject);
    }
Exemplo n.º 6
0
        private void build_grid_Click(object sender, EventArgs e)
        {
            double X, Y, Z, dx, dy, dz, wind_direction, wind_speed;

            try
            {
                X                            = Double.Parse(range_X.Text);
                Y                            = Double.Parse(range_Y.Text);
                Z                            = Double.Parse(range_Z.Text);
                dx                           = Double.Parse(this.dx.Text);
                dy                           = Double.Parse(this.dy.Text);
                dz                           = Double.Parse(this.dz.Text); //"this" is Form1
                wind_direction               = Double.Parse(this.wind_direction.Text);
                wind_speed                   = Double.Parse(this.wind_speed.Text);
                grid                         = new Range(X, Y, Z, dx, dy, dz, wind_direction, wind_speed);
                grid_nums                    = grid.get_grid_nums();
                ground                       = grid.get_ground();
                chim_sum                     = new Chimney(grid_nums);
                chimney_info.Text           += "網格建立完成\r\n";
                build_grid.Enabled           = false;
                range_X.ReadOnly             = true;
                range_Y.ReadOnly             = true;
                range_Z.ReadOnly             = true;
                this.dx.ReadOnly             = true;
                this.dy.ReadOnly             = true;
                this.dz.ReadOnly             = true;
                this.wind_direction.ReadOnly = true;
                this.wind_speed.ReadOnly     = true;
                build_chimney.Enabled        = true;
                this.chimney_x.ReadOnly      = false;
                this.chimney_y.ReadOnly      = false;
                this.chimney_z.ReadOnly      = false;
                this.emission.ReadOnly       = false;
            }
            catch
            {
                MessageBox.Show("輸入錯誤,請重新輸入");
            }
        }
Exemplo n.º 7
0
        private void build_chimney_Click(object sender, EventArgs e)  //
        {
            double X, Y, Z, Q;

            X = Double.Parse(this.chimney_x.Text);
            Y = Double.Parse(this.chimney_y.Text);
            Z = Double.Parse(this.chimney_z.Text);
            Q = Double.Parse(this.emission.Text);

            chimney[count] = new Chimney(X, Y, Z, Q, grid_nums);
            grid.shift(chimney[count].get_x(), chimney[count].get_y());
            chimney[count].cal(grid);
            chim_sum = chim_sum + chimney[count];
            count++;
            chimney_info.Text          += count + "號煙囪位置(X,Y,Z) : (" + X + "," + Y + "," + Z + ")  汙染物排放濃度:" + Q + "   \r\n";
            chimney_info.SelectionStart = chimney_info.Text.Length;
            chimney_info.ScrollToCaret();
            Max_concentration.Enabled = true;
            if (count == 20)
            {
                build_chimney.Enabled = false;
            }
        }