Exemple #1
0
            public void Update()
            {
                WaterLevelIndex++;
                WaterLevel = WaterLevelCalculator.GetWaterLevelFromIndex(WaterLevelIndex);
                FutureWaterLevelIndex++;
                FutureWaterLevel = WaterLevelCalculator.GetWaterLevelFromIndex(FutureWaterLevelIndex);

                foreach (var objList in ObjectLists)
                {
                    foreach (var obj in objList)
                    {
                        obj.Update();
                    }
                }

                foreach (var objList in ObjectLists)
                {
                    for (int i = 0; i < objList.Count; i++)
                    {
                        if (objList[i].ShouldBeDeleted)
                        {
                            objList.RemoveAt(i);
                            i--;
                        }
                    }
                }

                GlobalTimer++;
            }
Exemple #2
0
            public ObjSlotManager(List <Input> inputs)
            {
                GlobalTimer           = Config.Stream.GetInt(MiscConfig.GlobalTimerAddress);
                WaterLevelIndex       = WaterLevelCalculator.GetWaterLevelIndex();
                WaterLevel            = WaterLevelCalculator.GetWaterLevelFromIndex(WaterLevelIndex);
                FutureWaterLevelIndex = WaterLevelCalculator.GetWaterLevelIndex() + 1;
                FutureWaterLevel      = WaterLevelCalculator.GetWaterLevelFromIndex(FutureWaterLevelIndex);

                YorangeObjects = new List <WaterObject>();
                GreenObjects   = new List <WaterObject>();
                PurpleObjects  = new List <WaterObject>();
                BrownObjects   = new List <WaterObject>();
                ObjectLists    =
                    new List <List <WaterObject> >()
                {
                    YorangeObjects, GreenObjects, PurpleObjects, BrownObjects,
                };

                Rng = new TtcRng();

                MarioObject marioObject = new MarioObject(this, Rng, inputs);

                YorangeObjects.Add(marioObject);

                List <ObjectDataModel> bobombBuddyObjs = Config.ObjectSlotsManager.GetLoadedObjectsWithName("Bob-omb Buddy (Opens Cannon)");

                foreach (var bobombBuddyObj in bobombBuddyObjs)
                {
                    int blinkingTimer = Config.Stream.GetInt(bobombBuddyObj.Address + 0xF4);
                    BobombBuddyObject bobombBuddyObject = new BobombBuddyObject(this, Rng, blinkingTimer);
                    GreenObjects.Add(bobombBuddyObject);
                }

                List <ObjectDataModel> bubbleSpawnerObjs = Config.ObjectSlotsManager.GetLoadedObjectsWithName("Bubble Spawner");

                foreach (var bubbleSpawnerObj in bubbleSpawnerObjs)
                {
                    float y        = Config.Stream.GetFloat(bubbleSpawnerObj.Address + ObjectConfig.YOffset);
                    int   timer    = Config.Stream.GetInt(bubbleSpawnerObj.Address + ObjectConfig.TimerOffset);
                    int   timerMax = Config.Stream.GetInt(bubbleSpawnerObj.Address + 0xF4);
                    BubbleSpawnerObject bubbleSpawnerObject = new BubbleSpawnerObject(this, Rng, y, timer, timerMax);
                    PurpleObjects.Add(bubbleSpawnerObject);
                }

                List <ObjectDataModel> bubbleObjs = Config.ObjectSlotsManager.GetLoadedObjectsWithName("Underwater Bubble");

                foreach (var bubbleObj in bubbleObjs)
                {
                    float        y            = Config.Stream.GetFloat(bubbleObj.Address + ObjectConfig.YOffset);
                    int          timer        = Config.Stream.GetInt(bubbleObj.Address + ObjectConfig.TimerOffset);
                    float        varF4        = Config.Stream.GetFloat(bubbleObj.Address + 0xF4);
                    float        varF8        = Config.Stream.GetFloat(bubbleObj.Address + 0xF8);
                    float        varFC        = Config.Stream.GetFloat(bubbleObj.Address + 0xFC);
                    float        var100       = Config.Stream.GetFloat(bubbleObj.Address + 0x100);
                    BubbleObject bubbleObject = new BubbleObject(this, Rng, y, timer, varF4, varF8, varFC, var100);
                    BrownObjects.Add(bubbleObject);
                }
            }