Exemple #1
0
        private void InitializeGameplay()
        {
            heightDisplay = new HeightDisplay();
            player        = new Player(heightDisplay);
            lava          = new Lava(GraphicsDevice);
            background    = new Background();

            List <Platform> platforms = new List <Platform>();
            List <Hazard>   hazards   = new List <Hazard>();
            List <Particle> particles = new List <Particle>();

            platformHelper  = new PlatformHelper(platforms, lava);
            collisionHelper = new CollisionHelper(player, lava, platforms, hazards);
            particleHelper  = new ParticleHelper(particles);

            Platform.Initialize(hazards);
            ParticleFactory.Initialize(particles);

            SimpleEvent.AddEvent(EventTypes.RESET, null);
        }
        protected override void OnInitialized()
        {
            base.OnInitialized();
            if (this.ExtendedItem != null)
            {
                RelativePlacement placementHeight = new RelativePlacement(HorizontalAlignment.Right, VerticalAlignment.Stretch);
                placementHeight.XOffset    = 10;
                _heightDisplay             = new HeightDisplay();
                _heightDisplay.DataContext = this.ExtendedItem.Component;

                RelativePlacement placementWidth = new RelativePlacement(HorizontalAlignment.Stretch, VerticalAlignment.Bottom);
                placementWidth.YOffset    = 10;
                _widthDisplay             = new WidthDisplay();
                _widthDisplay.DataContext = this.ExtendedItem.Component;

                this.AddAdorners(placementHeight, _heightDisplay);
                this.AddAdorners(placementWidth, _widthDisplay);
                _heightDisplay.Visibility = Visibility.Hidden;
                _widthDisplay.Visibility  = Visibility.Hidden;
            }
        }
Exemple #3
0
        private int SummitLaunchReset(On.Celeste.Player.orig_SummitLaunchUpdate orig, Player self)
        {
            var level = Engine.Scene as Level;

            if (this.InRandomizer && self.Y < level.Bounds.Y - 8)
            {
                // teleport to spawn point
                self.Position = level.Session.RespawnPoint.Value;

                // reset camera
                var tmp = level.CameraLockMode;
                level.CameraLockMode   = Level.CameraLockModes.None;
                level.Camera.Position  = level.GetFullCameraTargetAt(self, self.Position);
                level.CameraLockMode   = tmp;
                level.CameraUpwardMaxY = level.Camera.Y + 180f;

                // remove effects
                AscendManager mgr   = null;
                Entity        fader = null;
                HeightDisplay h     = null;
                BadelineDummy b     = null;
                foreach (var ent in Engine.Scene.Entities)
                {
                    if (ent is AscendManager manager)
                    {
                        mgr = manager;
                    }
                    if (ent.GetType().Name == "Fader")
                    {
                        fader = ent;
                    }
                    if (ent is HeightDisplay heightDisplay)
                    {
                        h = heightDisplay;
                    }
                    if (ent is BadelineDummy bd)
                    {
                        b = bd;
                    }
                }
                if (mgr != null)
                {
                    level.Remove(mgr);
                }
                if (fader != null)
                {
                    level.Remove(fader);
                }
                if (h != null)
                {
                    level.Remove(h);
                }
                if (b != null)
                {
                    level.Remove(b);
                }
                level.NextTransitionDuration = 0.65f;

                // return to normal
                return(Player.StNormal);
            }
            else
            {
                return(orig(self));
            }
        }