public generator() { picxy = new Bitmap(Form1.Default.sizexyx, Form1.Default.sizexyy); gfxxy = System.Drawing.Graphics.FromImage(picxy); picxz = new Bitmap(Form1.Default.sizexzx, Form1.Default.sizexzz); gfxxz = System.Drawing.Graphics.FromImage(picxz); piczy = new Bitmap(Form1.Default.sizezyz, Form1.Default.sizezyy); gfxzy = System.Drawing.Graphics.FromImage(piczy); agentcount = new int[Form1.Default.agent + 1]; agentname = new string[Form1.Default.agent + 1]; agentrange = new int[Form1.Default.agent + 1, 3, 2]; agentrangeabsolute = new bool[Form1.Default.agent + 1]; agentcolour = new System.Drawing.Color[Form1.Default.agent + 1]; initialenergy = new int[Form1.Default.agent + 1]; stepenergy = new int[Form1.Default.agent + 1]; bumpenergy = new int[Form1.Default.agent + 1]; aging = new bool[Form1.Default.agent + 1]; agelimit = new int[Form1.Default.agent + 1]; asr = new bool[Form1.Default.agent + 1]; asrtime = new int[Form1.Default.agent + 1]; asrenergy = new int[Form1.Default.agent + 1]; occupied = new bool[Form1.Default.xn + 1, Form1.Default.yn + 1, Form1.Default.zn + 1]; action = new int[Form1.Default.agent + 1, Form1.Default.agent + 1, 7]; maxcell = Form1.Default.xn * Form1.Default.zn * Form1.Default.yn; InitializeComponent(); //Added to support default instance behavour in C# if (defaultInstance == null) defaultInstance = this; }
static void defaultInstance_FormClosed(object sender, FormClosedEventArgs e) { defaultInstance = null; }