Esempio n. 1
0
    void Generate()
    {
        GameObject gb = null;

        for (int i = 0; i < 20; i++)
        {
            for (int j = 0; j < 5; j++)
            {
                gb = Instantiate <GameObject>(_resMgr.Cube);
                gb.transform.parent = transform;
                if ((i + j) % 23 == 0)
                {
                    gb.transform.localPosition = new Vector3(j * SIZE - 1, 0, i * SIZE);
                }
                else
                {
                    gb.transform.localPosition = new Vector3(j * SIZE - 1, -SIZE, i * SIZE);
                }
            }
        }

        BlockMonitor blockMonitor = gb.AddComponent <BlockMonitor>();

        blockMonitor.RegisterBlock(this, _blockMgr);
    }
        public void AddMap(string monitorChannel, string reportChannel, ISession databaseSession)
        {
            lock (this.monitors)
            {
                var monitor = new BlockMonitor {
                    MonitorChannel = monitorChannel, ReportChannel = reportChannel
                };

                using (var txn = databaseSession.BeginTransaction(IsolationLevel.ReadCommitted))
                {
                    databaseSession.SaveOrUpdate(monitor);
                    txn.Commit();
                }

                if (!this.monitors.ContainsKey(monitorChannel))
                {
                    this.monitors[monitorChannel] = new HashSet <string>();
                }

                this.monitors[monitorChannel].Add(reportChannel);
            }
        }