void Regulus.Game.IStage.Enter()
            {
                for (int i = 0; i < _Groups.Length; ++i )
                {
                    var energy = new Energy(3);
                    var eg = new EnergyGroup() { Energy = energy, Round = Regulus.Utility.Random.Next(0, 3) } ;
                    Func<bool>[] incs1 =
                    {
                        energy.IncGreen , energy.IncRed , energy.IncYellow
                    };
                    incs1[Regulus.Utility.Random.Next(0, incs1.Length)]();
                    incs1[Regulus.Utility.Random.Next(0, incs1.Length)]();

                    Func<bool>[] incs2 =
                    {
                        energy.IncPower , ()=>{eg.Hp = 1; return true;} , ()=>{eg.Change = 1; return true;}
                    };

                    incs2[Regulus.Utility.Random.Next(0, incs2.Length)]();
                    _Groups[i] = eg ;
                }

                foreach (var capture in _Capturers)
                {
                    capture.Player.OnSpawnCaptureEnergy(capture);
                    capture.Initial(_Groups);
                    capture.CaptureEvent += _OnCapture;
                }

                _Timeout = new Utility.TimeCounter();
            }
Exemple #2
0
        public Program()
        {
            scriptStartTime = DateTime.Now;
            tag_match       = new System.Text.RegularExpressions.Regex(tag_pattern);
            SCAN_RATE       = Convert.ToInt32(SCAN_DISTANCE * SCAN_DISTANCE_PER_TICK);


            LCDDisplay = new LCDGroup("Display", this);
            LCDDebug   = new LCDGroup("Debug", this);
            LCDScan    = new LCDGroup("Scan", this);
            LCDRemote  = new LCDGroup("Remote", this);
            SG         = new ScanGyro(this);
            Cameras    = new CameraGroup(this);
            Power      = new EnergyGroup(this);

            states.Add(ProgramStates.Startup, new StartupState(this, ProgramStates.Startup));
            states.Add(ProgramStates.Error, new ErrorState(this, ProgramStates.Error));
            states.Add(ProgramStates.Idle, new IdleState(this, ProgramStates.Idle));

            transitions.Add(ProgramTransitions.error, new ErrorTransition(this));
            transitions.Add(ProgramTransitions.boot, new BootTransition(this));

            _CurrentState = states[ProgramStates.Startup];
            _CurrentState.Init();

            //Runtime.UpdateFrequency = UpdateFrequency.Update10;
            try { Echo(DrawApp()); Echo(DrawDev()); } catch (Exception e) { Echo("Exception in DrawApp() " + e.Message); }

            LCDDebug.writeToLine("Booting...");
            LCDDisplay.writeToLine("Booting...");
            LCDScan.writeToLine("Booting...");
            LCDRemote.writeToLine("Booting...");
        }
 public void Initial(EnergyGroup[] energy_group)
 {
     _EnergyGroup = energy_group;
 }