コード例 #1
0
ファイル: CDI.cs プロジェクト: jrodrigv/KramaxAutoPilot
        public void Start()
        {
            Deb.Log("CDI: Start {0}", this.GetInstanceID());

            GetNavBallRect();
            AdjustRectForNavBallRect();
        }
コード例 #2
0
ファイル: MainWindow.cs プロジェクト: Malsly/TrainStationGTK
    protected void OnChoosVanComboBoxChanged(object sender, EventArgs e)
    {
        Dictionary <int, Van> NumberAndVan = new Dictionary <int, Van>();

        TreeIter iter;

        if (this.ChoosVanComboBox.Model.GetIterFirst(out iter))
        {
            do
            {
                NumberAndVan.Add((int)this.ChoosVanComboBox.Model.GetValue(iter, 0), (Van)this.ChoosVanComboBox.Model.GetValue(iter, 1));
            } while (this.ChoosVanComboBox.Model.IterNext(ref iter));
        }

        NumberAndVan.TryGetValue(Convert.ToInt32(this.ChoosVanComboBox.Active), out choosedVan);

        Deb.Print(choosedVan.Number);

        this.ChooseSeatComboBox.Show();
        this.SeatTextView.Show();

        ListStore DataSourceForSeats = new ListStore(typeof(int), typeof(Seat));

        this.ChooseSeatComboBox.Model = DataSourceForSeats;

        foreach (Seat seat in choosedVan.SeatList)
        {
            if (seat.IsOccuped == false)
            {
                DataSourceForSeats.AppendValues(seat.Number, seat);
            }
        }
    }
コード例 #3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (total_ != null)
            {
                hash ^= Total.GetHashCode();
            }
            if (zap_ != null)
            {
                hash ^= Zap.GetHashCode();
            }
            if (nds_ != null)
            {
                hash ^= Nds.GetHashCode();
            }
            if (deb_ != null)
            {
                hash ^= Deb.GetHashCode();
            }
            if (fin_ != null)
            {
                hash ^= Fin.GetHashCode();
            }
            if (mon_ != null)
            {
                hash ^= Mon.GetHashCode();
            }
            if (oth_ != null)
            {
                hash ^= Oth.GetHashCode();
            }
            return(hash);
        }
コード例 #4
0
        /*
         * Called next.
         */
        public void Start()
        {
            Deb.Log("KramaxAutoPilot: Start {0}", this.GetInstanceID());

            // read in config
            // initialize any variables
            // install any callbacks
            // install in toolbar
            if (UseAppLauncher())
            {
                Kramax.Toolbar.AppLauncherAutoPilot.Start(this.gameObject);
            }
            else
            {
                Kramax.Toolbar.ToolbarMod.Start();
            }

            if (mainPilot != null)
            {
                Deb.Err("KramaxAutoPilot.Start: mainPilot stil exists");
            }
            else
            {
                Deb.Log("KramaxAutoPilot.Start: creating mainPilot");
                mainPilot = AddComponent(typeof(George)) as George;
            }
        }
コード例 #5
0
        private void ComboBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            TrainViewModel o = this.DataContext as TrainViewModel;

            o.Station.SelectedTrain = o.TrainList.Find((item) => item.Name == o.SelectedTrainName);
            this.DataContext        = o;
            Deb.Print(o.Station.SelectedTrain, "<======>");
        }
コード例 #6
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            PassangerViewModel o = this.DataContext as PassangerViewModel;

            o.Station.Passanger = new Model.PassangerModel(o.Name, o.Telephone, o.Email);
            Deb.Print(o.Name);
            Deb.Print(o.Telephone);
            Deb.Print(o.Email);
        }
コード例 #7
0
ファイル: CDI.cs プロジェクト: jrodrigv/KramaxAutoPilot
        public void AdjustRectForNavBallRect()
        {
            // ratios come from measuring at 1600x1200 and using nominal position
            // and size of Rect(655, 965, 300, 255)
            window.width  = (int)(navBallRect.width * (300.0f / 223.0f));
            window.height = (int)(navBallRect.height * (255.0f / 200.0f));
            window.x      = (int)(0.5 + navBallRect.x - ((688.0f - 655.0f) * (window.width / 300.0f)));
            window.y      = (int)(0.5 + navBallRect.y - ((1000 - 965) * (window.height / 255.0f)));

            Deb.Log("CDI overlay rect: {0}", window);
        }
コード例 #8
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            TrainStation.ViewModel.TicketViewModel TicketViewModelObject = new TrainStation.ViewModel.TicketViewModel();
            TicketViewModelObject.Station = PassangerViewModel.GlobalStation;
            this.DataContext = TicketViewModelObject;

            TicketViewModel o = this.DataContext as TicketViewModel;

            this.DataContext = o;

            Deb.Print(o, "selected Seat from vans");
        }
コード例 #9
0
        private void GetSeats_Click(object sender, RoutedEventArgs e)
        {
            SeatViewModel o = this.DataContext as SeatViewModel;

            try
            {
                this.ComboSeats.ItemsSource = o.loadSeats(o.Station.SelectedVan);
            }
            catch
            {
                this.ComboSeats.ItemsSource = new List <SeatModel> {
                };
            }

            Deb.Print(o.Station.SelectedSeat, "selected Seat from vans");
        }
コード例 #10
0
        private void GetVans_Click(object sender, RoutedEventArgs e)
        {
            VanViewModel o = this.DataContext as VanViewModel;

            try
            {
                this.ComboVans.ItemsSource = o.loadVans(o.Station.SelectedTrain);
            }
            catch
            {
                this.ComboVans.ItemsSource = new List <VanModel>()
                {
                };
            }

            Deb.Print(o.Station.SelectedVan, "selected train from vans");
        }
コード例 #11
0
ファイル: MainWindow.cs プロジェクト: Malsly/TrainStationGTK
    protected void OnTicketingBtnClicked(object sender, EventArgs e)
    {
        string placeArrivalText = this.placeArrival.Text;
        int    priceForRoute;
        int    priceForVanClass;
        int    priceForSeatType;

        choosedTrain.RouteAndPrice.TryGetValue(placeArrivalText, out priceForRoute);
        Van.ClassAndPrice.TryGetValue(choosedVan.Class, out priceForVanClass);
        Seat.TypeAndPrice.TryGetValue(choosedSeat.Type, out priceForSeatType);

        int price = priceForRoute + priceForSeatType + priceForVanClass;

        choosedSeat.IsOccuped = true;

        Deb.Print(new Ticket(passanger, price, choosedVan, choosedTrain, choosedSeat, placeArrivalText));
    }
コード例 #12
0
ファイル: CDI.cs プロジェクト: jrodrigv/KramaxAutoPilot
        public void GetNavBallRect()
        {
            // ScreenSafeUI appears to no longer be used, so lets get out of here
            //if (ScreenSafeUI.referenceCam == null)
            //	return;

            var navball = GameObject.FindObjectOfType <NavBall>();

            if (navball == null)
            {
                Deb.Err("GetNavBallArea: no navball object found");
            }

            Deb.Log("Navball game object: {0}", navball);
            Deb.Log("Navball transform: {0}", navball.transform.localToWorldMatrix);
            Deb.Log("Navball transform.position: {0}", navball.transform.position);

            // position is (1.0,0.1,0.0) when visible
            // position is (1.0,-0.1,0.0) when not visible
            //var camera = ScreenSafeUI.referenceCam;

            var camera = UIMasterController.Instance.appCanvas.worldCamera;

            // this looks to be the center of the ball with Y counting up from bottom of screen
            // so 800,85 for 1600x1200 screen.
            Vector3 center = camera.WorldToScreenPoint(navball.transform.position);

            Deb.Log("Navball center in screen point: {0}", center);

            // cannot figure out how to get actual size. Just assume that since we have the center
            // and the Y is offset from 0 the size is about twice that.
            // the 200 and 223 come from measuring this in a 1600x1200 frame
            float height = (float)center.y * (200.0f / 85.6f);
            float width  = (float)center.y * (223.0f / 85.6f);

            // this does not work; maybe only valid inside GUI draw calls
            // Vector2 guiCenter = GUIUtility.ScreenToGUIPoint(new Vector2(center.x, center.y));

            // Just assume as is the case currently with unity that the Y reverses direction
            navBallRect =
                new Rect(center.x - width / 2, Screen.height - height, width, height);

            Deb.Log("Navball Rect calculated to be: {0}", navBallRect);
        }
コード例 #13
0
        public void OnDestroy()
        {
            Deb.Log("KramaxAutoPilot: OnDestroy {0}", this.GetInstanceID());

            if (UseAppLauncher())
            {
                Kramax.Toolbar.AppLauncherAutoPilot.OnDestroy();
            }
            else
            {
                Kramax.Toolbar.ToolbarMod.OnDestroy();
            }

            if (mainPilot)
            {
                Destroy(mainPilot);
                mainPilot = null;
            }
        }
コード例 #14
0
    static void Main(string[] args)
    {
        string  LON   = Console.ReadLine();
        string  LAT   = Console.ReadLine();
        decimal longB = decimal.Parse(LON.Replace(",", "."));
        decimal latB  = decimal.Parse(LAT.Replace(",", "."));

        int     N      = int.Parse(Console.ReadLine());
        decimal min    = 0;
        Deb     minDeb = null;

        for (int i = 0; i < N; i++)
        {
            string DEFIB = Console.ReadLine();
            var    data  = DEFIB.Split(';');
            var    defib = new Deb()
            {
                Id      = data[0],
                Nom     = data[1],
                Adresse = data[2],
                Tel     = data[3],
                Long    = decimal.Parse(data[4].Replace(",", ".")),
                Lat     = decimal.Parse(data[5].Replace(",", "."))
            };
            var x = (defib.Long - longB) * (decimal)Math.Cos((double)(defib.Lat + latB) / 2);
            var y = defib.Long - longB;
            var d = (decimal)Math.Sqrt(Math.Pow((double)x, 2) + Math.Pow((double)y, 2)) * 6371;
            Console.Error.WriteLine($"{defib.Nom} d = {d}");
            if (i == 0 || min > d)
            {
                min    = d;
                minDeb = defib;
                Console.Error.WriteLine($"{minDeb.Long}");
            }
        }
        Console.Error.WriteLine("=========");
        Console.WriteLine(minDeb.Nom);
        // Write an action using Console.WriteLine()
        // To debug: Console.Error.WriteLine("Debug messages...");
    }
コード例 #15
0
 public void Awake()
 {
     Deb.Log("PresetManager.Awake: creating singleton instance");
     instance = this;
 }
コード例 #16
0
 public void Start()
 {
     Deb.Log("PresetManager.Start: initialize");
     loadPresetsFromFile();
     DontDestroyOnLoad(this);
 }
コード例 #17
0
 public void MergeFrom(ActiveData other)
 {
     if (other == null)
     {
         return;
     }
     if (other.total_ != null)
     {
         if (total_ == null)
         {
             total_ = new global::Grpc.Business.ExpressService.Pair();
         }
         Total.MergeFrom(other.Total);
     }
     if (other.zap_ != null)
     {
         if (zap_ == null)
         {
             zap_ = new global::Grpc.Business.ExpressService.Pair();
         }
         Zap.MergeFrom(other.Zap);
     }
     if (other.nds_ != null)
     {
         if (nds_ == null)
         {
             nds_ = new global::Grpc.Business.ExpressService.Pair();
         }
         Nds.MergeFrom(other.Nds);
     }
     if (other.deb_ != null)
     {
         if (deb_ == null)
         {
             deb_ = new global::Grpc.Business.ExpressService.Pair();
         }
         Deb.MergeFrom(other.Deb);
     }
     if (other.fin_ != null)
     {
         if (fin_ == null)
         {
             fin_ = new global::Grpc.Business.ExpressService.Pair();
         }
         Fin.MergeFrom(other.Fin);
     }
     if (other.mon_ != null)
     {
         if (mon_ == null)
         {
             mon_ = new global::Grpc.Business.ExpressService.Pair();
         }
         Mon.MergeFrom(other.Mon);
     }
     if (other.oth_ != null)
     {
         if (oth_ == null)
         {
             oth_ = new global::Grpc.Business.ExpressService.Pair();
         }
         Oth.MergeFrom(other.Oth);
     }
 }
コード例 #18
0
ファイル: CDI.cs プロジェクト: jrodrigv/KramaxAutoPilot
 public void Awake()
 {
     Debug.Log("CDI: awaken");
     Deb.Log("CDI: Awake {0}", this.GetInstanceID());
 }
コード例 #19
0
 /*
  * Called after the scene is loaded.
  */
 public void Awake()
 {
     Deb.Log("KramaxAutoPilot: Awake {0}", this.GetInstanceID());
 }
コード例 #20
0
 /*
  * Caution: as it says here: http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.Awake.html,
  * use the Awake() method instead of the constructor for initializing data because Unity uses
  * Serialization a lot.
  */
 public KramaxAutoPilot()
 {
     Deb.Log("KramaxAutoPilot: ctor {0}", this.GetInstanceID());
 }
コード例 #21
0
        public static Station InitalizationData()
        {
            List <Train>     TrainList     = new List <Train>();
            List <Passanger> PassangerList = new List <Passanger>();
            Station          station       = new Station(TrainList, PassangerList);

            SerailizationAndDeserealization ser = new SerailizationAndDeserealization();
            string configRoutesAndDates         = Environment.GetEnvironmentVariable("RoutesAndDates");
            string configRoutesAndPrices        = Environment.GetEnvironmentVariable("RoutesAndPrices");
            string configWithSerialize          = Environment.GetEnvironmentVariable("WithSerialize");

            if (configWithSerialize == "False")
            {
                Deb.Print("Start without serialization");

                List <Dictionary <string, DateTime> > RoutesAndDates  = ser.DeserializeListRoutesAndDates(configRoutesAndDates);
                List <Dictionary <string, int> >      RoutesAndPrices = ser.DeserializeListRoutesAndPrices(configRoutesAndPrices);

                var DatesAndPrices = RoutesAndDates.Zip(RoutesAndPrices, (n, w) => new { Routes = n, Prices = w });

                foreach (var rp in DatesAndPrices)
                {
                    station.AddTrain(rp.Routes.Keys.First(), rp.Routes.Keys.Last(), rp.Routes, rp.Prices, new List <Van>());
                }
            }
            else
            {
                Deb.Print("Start with serialization");

                Dictionary <string, int> RouteAndPriceKievChernigiv = new Dictionary <string, int>
                {
                    { "Kiev", 0 },
                    { "Kozelets", 30 },
                    { "Desna", 60 },
                    { "Chernigiv", 100 }
                };

                Dictionary <string, int> RouteAndPriceKievLugansk = new Dictionary <string, int>
                {
                    { "Kiev", 0 },
                    { "Kozelets", 30 },
                    { "Charkiv", 45 },
                    { "Zhitomir", 75 },
                    { "Lugansk", 130 }
                };

                Dictionary <string, int> RouteAndPriceLvivKiev = new Dictionary <string, int>
                {
                    { "Lviv", 0 },
                    { "Gorodishe", 90 },
                    { "Donetsk", 145 },
                    { "Pomoshna", 275 },
                    { "Kiev", 330 }
                };

                Dictionary <string, DateTime> RouteAndDateKievChernigiv = new Dictionary <string, DateTime>
                {
                    { "Kiev", DateTime.Now },
                    { "Kozelets", DateTime.Now + new TimeSpan(0, 3, 0, 0) },
                    { "Desna", DateTime.Now + new TimeSpan(0, 4, 0, 0) },
                    { "Chernigiv", DateTime.Now + new TimeSpan(1, 0, 0, 0) }
                };

                Dictionary <string, DateTime> RouteAndDateKievLugansk = new Dictionary <string, DateTime>
                {
                    { "Kiev", DateTime.Now },
                    { "Kozelets", DateTime.Now + new TimeSpan(0, 3, 0, 0) },
                    { "Charkiv", DateTime.Now + new TimeSpan(1, 0, 0, 0) },
                    { "Zhitomir", DateTime.Now + new TimeSpan(1, 5, 0, 0) },
                    { "Lugansk", DateTime.Now + new TimeSpan(1, 13, 0, 0) }
                };

                Dictionary <string, DateTime> RouteAndDateLvivKiev = new Dictionary <string, DateTime>
                {
                    { "Lviv", DateTime.Now },
                    { "Gorodishe", DateTime.Now + new TimeSpan(0, 3, 0, 0) },
                    { "Donetsk", DateTime.Now + new TimeSpan(0, 8, 0, 0) },
                    { "Pomoshna", DateTime.Now + new TimeSpan(0, 16, 0, 0) },
                    { "Kiev", DateTime.Now + new TimeSpan(1, 3, 0, 0) }
                };

                List <Dictionary <string, DateTime> > RoutesAndDates = new List <Dictionary <string, DateTime> >
                {
                    { RouteAndDateKievChernigiv },
                    { RouteAndDateKievLugansk },
                    { RouteAndDateLvivKiev }
                };

                List <Dictionary <string, int> > RoutesAndPrices = new List <Dictionary <string, int> >
                {
                    { RouteAndPriceKievChernigiv },
                    { RouteAndPriceKievLugansk },
                    { RouteAndPriceLvivKiev }
                };

                ser.SerializeListRoutesAndDates("RoutesAndDates.json", RoutesAndDates);
                ser.SerializeListRoutesAndPrices("RoutesAndPrices.json", RoutesAndPrices);

                ser.SerializeRouteAndPrice("RouteAndPriceKievChernigiv.json", RouteAndPriceKievChernigiv);
                ser.SerializeRouteAndPrice("RouteAndPriceKievLugansk.json", RouteAndPriceKievLugansk);
                ser.SerializeRouteAndPrice("RouteAndPriceLvivKiev.json", RouteAndPriceLvivKiev);

                ser.SerializeRouteAndDate("RouteAndDateKievChernigiv.json", RouteAndDateKievChernigiv);
                ser.SerializeRouteAndDate("RouteAndDateKievLugansk.json", RouteAndDateKievLugansk);
                ser.SerializeRouteAndDate("RouteAndDateLvivKiev.json", RouteAndDateLvivKiev);

                station.AddTrain("Kiev", "Chernigiv", RouteAndDateKievChernigiv, RouteAndPriceKievChernigiv, new List <Van>());
                station.AddTrain("Kiev", "Lugansk", RouteAndDateKievLugansk, RouteAndPriceKievLugansk, new List <Van>());
                station.AddTrain("Lviv", "Kiev", RouteAndDateLvivKiev, RouteAndPriceLvivKiev, new List <Van>());
            }

            foreach (Train train in station.TrainList)
            {
                train.CreateVansForTrain(10, "Plackart");
                train.CreateVansForTrain(2, "Cupe");
                foreach (Van van in train.VanList)
                {
                    van.CreateSeatForVan(3, "Main");
                    van.CreateSeatForVan(3, "Side");
                }
            }

            Van.AddClassAndPrice("Plackart", 0);
            Van.AddClassAndPrice("Cupe", 20);

            Seat.AddTypeAndPrice("Main", 0);
            Seat.AddTypeAndPrice("Side", 0);

            return(station);
        }
        public static bool Invoke(LG_WardenObjective_Reactor __instance)
        {
            float num1 = (1f - __instance.m_currentWaveProgress) * __instance.m_currentDuration;

            switch (__instance.m_currentState.status)
            {
            case eReactorStatus.Active_Idle:
                __instance.SetGUIMessage(false);
                break;

            case eReactorStatus.Startup_intro:
                __instance.SetGUIMessage(true, "REACTOR STARTUP TEST (" + (object)__instance.m_currentWaveCount + " of " + (object)__instance.m_waveCountMax + ") WARMING UP.. ", ePUIMessageStyle.Default);
                int num2 = (int)__instance.m_sound.SetRTPCValue(GAME_PARAMETERS.REACTOR_POWER, __instance.m_currentWaveProgress * 100f);
                if (!__instance.m_alarmCountdownPlayed && (double)num1 <= 10.0)
                {
                    int num3 = (int)__instance.m_sound.Post(EVENTS.REACTOR_ALARM_COUNTDOWN);
                    __instance.m_alarmCountdownPlayed = true;
                }
                if (!WardenObjectiveManager.ActiveWardenObjective(__instance.SpawnNode.LayerType).LightsOnDuringIntro)
                {
                    float num3 = (float)((double)__instance.m_currentWaveProgress * (double)__instance.m_currentWaveProgress * 0.400000005960464 + 0.0500000007450581);
                    __instance.UpdateLightCollection(true, true, true, 32f, 2f, num3, num3);
                    break;
                }
                break;

            case eReactorStatus.Startup_intense:
                __instance.SetGUIMessage(true, "REACTOR PERFORMING HIGH INTENSITY TEST (" + (object)__instance.m_currentWaveCount + "/" + (object)__instance.m_waveCountMax + ")");
                __instance.UpdateLightCollection(false, true, true, 32f, 2f);
                if (!__instance.m_alarmCountdownPlayed && (double)num1 <= 10.0)
                {
                    int num3 = (int)__instance.m_sound.Post(EVENTS.REACTOR_ALARM_WARNING_3);
                    __instance.m_alarmCountdownPlayed = true;
                    break;
                }
                break;

            case eReactorStatus.Startup_waitForVerify:
                if (__instance.m_currentWaveData.HasVerificationTerminal)
                {
                    __instance.SetGUIMessage(true, "VERIFICATION (" + (object)__instance.m_currentWaveCount + "/" + (object)__instance.m_waveCountMax + "). CODE REQUIRED FOR <color=orange>REACTOR_VERIFY</color> LOCATED IN LOG FILE IN <color=orange>" + __instance.m_currentWaveData.VerificationTerminalSerial + "</color>", ePUIMessageStyle.Warning, timerPrefix: "<size=125%>TIME UNTIL RESET: ", timerSuffix: "</size>");
                }
                else
                {
                    __instance.SetGUIMessage(true, "SECURITY VERIFICATION (" + (object)__instance.m_currentWaveCount + "/" + (object)__instance.m_waveCountMax + "). USE COMMAND <color=orange>REACTOR_VERIFY</color> AND CODE <color=orange>" + __instance.CurrentStateOverrideCode + "</color> BEFORE SAFETY RESET!", ePUIMessageStyle.Warning, timerPrefix: "<size=125%>TIME UNTIL RESET: ", timerSuffix: "</size>");
                }
                __instance.m_lightCollection.UpdateRandomMode(100f);
                break;

            case eReactorStatus.Startup_complete:
                __instance.SetGUIMessage(true, "REACTOR STARTUP SEQUENCE COMPLETED", ePUIMessageStyle.Default, false);
                if (SNetwork.SNet.IsMaster && (double)Clock.Time > (double)__instance.m_objectiveCompleteTimer)
                {
                    __instance.AttemptInteract(eReactorInteraction.Goto_active);
                    WardenObjectiveManager.OnLocalPlayerSolvedObjectiveItem(__instance.SpawnNode.LayerType, __instance.TryCast <iWardenObjectiveItem>());
                    break;
                }
                break;

            case eReactorStatus.Shutdown_waitForVerify:
                __instance.SetGUIMessage(true, "SECURITY VERIFICATION REQUIRED. USE COMMAND <color=orange>REACTOR_VERIFY</color> AND CODE <color=orange>" + __instance.CurrentStateOverrideCode + "</color> TO VERIFY.", ePUIMessageStyle.Warning, false);
                break;

            case eReactorStatus.Shutdown_puzzleChaos:
                __instance.SetGUIMessage(false);
                break;

            case eReactorStatus.Shutdown_complete:
                if ((double)Clock.Time > (double)__instance.m_objectiveCompleteTimer)
                {
                    if (!__instance.m_shutdownCompleteShown)
                    {
                        GuiManager.PlayerLayer.m_wardenIntel.ShowSubObjectiveMessage("", "REACTOR SHUTDOWN SEQUENCE COMPLETED");
                        __instance.m_shutdownCompleteShown = true;
                    }
                    if (SNetwork.SNet.IsMaster)
                    {
                        __instance.AttemptInteract(eReactorInteraction.Goto_inactive);
                        WardenObjectiveManager.OnLocalPlayerSolvedObjectiveItem(__instance.SpawnNode.LayerType, __instance.TryCast <iWardenObjectiveItem>());
                        break;
                    }
                    break;
                }
                break;
            }
            if (!SNetwork.SNet.IsMaster)
            {
                return(false);
            }

            if (__instance.m_spawnEnemies && __instance.m_currentEnemyWaveIndex < __instance.m_currentWaveData.EnemyWaves.Count)
            {
                ReactorWaveEnemyData enemyWave = __instance.m_currentWaveData.EnemyWaves[__instance.m_currentEnemyWaveIndex];

                if ((double)__instance.m_currentWaveProgress > (double)enemyWave.SpawnTimeRel)
                {
                    Debug.Log(Deb.Enemy("Reactor Spawning wave at " + (object)enemyWave.SpawnTimeRel + " with type: " + (object)enemyWave.SpawnType));
                    if (Mastermind.Current.TryGetEvent(__instance.m_enemyWaveID, out Mastermind.MastermindEvent masterMindEvent))
                    {
                        masterMindEvent.StopEvent();
                    }

                    ushort m_enemyWaveID;
                    switch (enemyWave.SpawnType)
                    {
                    case eReactorWaveSpawnType.ClosestToReactorNoPlayerBetween:
                        if (Mastermind.Current.TriggerSurvivalWave(__instance.m_reactorArea.m_courseNode, enemyWave.WaveSettings, enemyWave.WavePopulation, out m_enemyWaveID, SurvivalWaveSpawnType.ClosestToSuppliedNodeButNoBetweenPlayers))
                        {
                            __instance.m_enemyWaveID = m_enemyWaveID;
                        }
                        else
                        {
                            __instance.m_enemyWaveID = 0;
                        }
                        ++__instance.m_currentEnemyWaveIndex;
                        break;

                    case eReactorWaveSpawnType.InElevatorZone:
                        if (Mastermind.Current.TriggerSurvivalWave(Builder.GetElevatorZone().m_courseNodes[0], enemyWave.WaveSettings, enemyWave.WavePopulation, out m_enemyWaveID, SurvivalWaveSpawnType.InSuppliedCourseNodeZone))
                        {
                            __instance.m_enemyWaveID = m_enemyWaveID;
                        }
                        else
                        {
                            __instance.m_enemyWaveID = 0;
                        }
                        ++__instance.m_currentEnemyWaveIndex;
                        break;
                    }
                }
            }
            if (!__instance.m_progressUpdateEnabled)
            {
                return(false);
            }

            __instance.m_currentWaveProgress += Clock.Delta / __instance.m_currentDuration;
            __instance.AttemptInteract(eReactorInteraction.Update_stateProgress, __instance.m_currentWaveProgress);
            if ((double)__instance.m_currentWaveProgress < 1.0)
            {
                return(false);
            }

            Debug.Log("MASTER, startupStateProgress done, current status: " + __instance.m_currentState.status + " currennt count: " + __instance.m_currentWaveCount);
            switch (__instance.m_currentState.status)
            {
            case eReactorStatus.Startup_intro:
                __instance.AttemptInteract(eReactorInteraction.Intensify_startup, __instance.m_currentWaveProgress);
                break;

            case eReactorStatus.Startup_intense:
                __instance.AttemptInteract(eReactorInteraction.WaitForVerify_startup, __instance.m_currentWaveProgress);
                break;

            case eReactorStatus.Startup_waitForVerify:
                __instance.AttemptInteract(eReactorInteraction.Verify_fail, __instance.m_currentWaveProgress);
                break;

            case eReactorStatus.Shutdown_intro:
                __instance.AttemptInteract(eReactorInteraction.WaitForVerify_shutdown, __instance.m_currentWaveProgress);
                break;

            default:
                Debug.LogError("MASTER, Reactor m_startupStateProgress reached 1 in a state withouth action, status: " + __instance.m_currentState.status);
                break;
            }
            return(false);
        }
コード例 #23
0
        public virtual double ResponseD(double input, bool useIntegral)
        {
            if (active_setpoint != target_setpoint)
            {
                if (debug)
                {
                    Deb.Log("ResponseD: ease setpoint.");
                }

                increment += easing * TimeWarp.fixedDeltaTime * 0.01;
                if (active_setpoint < target_setpoint)
                {
                    if (active_setpoint + increment > target_setpoint)
                    {
                        active_setpoint = target_setpoint;
                    }
                    else
                    {
                        active_setpoint += increment;
                    }
                }
                else
                {
                    if (active_setpoint - increment < target_setpoint)
                    {
                        active_setpoint = target_setpoint;
                    }
                    else
                    {
                        active_setpoint -= increment;
                    }
                }
            }

            if (debug)
            {
                Deb.Log("ResponseD: raw input:{0:F2}, set:{1:F2}", input, active_setpoint);
            }

            input = (invertInput ? -1 : 1) * Utils.Clamp(input, inMin, inMax);

            dt    = TimeWarp.fixedDeltaTime;
            error = input - active_setpoint;

            if (debug)
            {
                Deb.Log("ResponseD: input:{0:F2} dt:{1:F2} error:{2:F2}", input, dt, error);
            }


            if (skipDerivative)
            {
                if (debug)
                {
                    Deb.Log("ResponseD: skipDerivative");
                }


                skipDerivative = false;
                previous       = input;
            }

            var prop_error  = proportionalError(error);
            var sum_error   = integralError(error, useIntegral);
            var delta_error = derivativeError(input);

            if (debug)
            {
                Deb.Log("ResponseD: sum={0:F2}, P:{1:F2}, I:{2:F2}, D:{3:F2}",
                        sum, prop_error, sum_error, delta_error);
            }

            lastOutput =
                (invertOutput ? -1 : 1) * Utils.Clamp(prop_error + sum_error + delta_error, outMin, outMax);

            if (debug)
            {
                Deb.Log("ResponseD: out:{0:F3}", lastOutput);
            }

            return(lastOutput);
        }