Beispiel #1
0
        public Player(
            Vector2 startingPos,
            AssetsLoader assetsLoader,
            InfartGame gameManagerReference)
            : base(1.0f, startingPos, gameManagerReference.GroundObjects())
        {
            _fillColor          = _overlayColor;
            Position            = startingPos;
            HorizontalMoveSpeed = 300f;
            _origin             = Vector2.Zero;

            _gameManagerReference = gameManagerReference;

            _scoreggiaSystem = new ScoreggiaParticleSystem(10, assetsLoader.Textures, assetsLoader.TexturesRectangles["ScoreggiaParticle"]);
            _jalapenoSystem  = new JalapenoParticleSystem(10, assetsLoader);
            _broccoloSystem  = new BroccoloParticleSystem(8, assetsLoader);
            _beanSystem      = new BeanParticleSystem(10, assetsLoader);

            LoadAnimation("idle", assetsLoader.PlayerIdleRects,
                          true, 0.1f, assetsLoader.Textures);

            LoadAnimation("run", assetsLoader.PlayerRunRects,
                          true, 0.05f, assetsLoader.Textures);

            LoadAnimation("fall", assetsLoader.PlayerFallRects,
                          true, 0.01f, assetsLoader.Textures);

            LoadAnimation("fart_sustain_up", assetsLoader.PlayerFartRects,
                          true, 0.05f, assetsLoader.Textures);

            LoadAnimation("truck", assetsLoader.PlayerMerdaRects,
                          true, 0.01f, assetsLoader.Textures);

            PlayAnimation("fall");
        }
Beispiel #2
0
        public GrattacieliAutogeneranti(
            Texture2D texture,
            IDictionary <string, Rectangle> grattaRects,
            string layerName,
            int grattaNumber,
            Camera playerCamera,
            InfartGame gameManagerReference)
        {
            _gameManagerReference = gameManagerReference;

            CurrentCamera = playerCamera;
            _cameraW      = CurrentCamera.ViewPortWidth;

            _textureReference = texture;

            _resolutionH = playerCamera.ViewPortHeight;

            NextGrattacieloPosition = new Vector2(0.0f, _resolutionH);

            CachedObjectList  = new List <Grattacielo>();
            GrattacieliToDraw = new List <Grattacielo>();

            LoadGrattacieli(layerName, grattaRects, grattaNumber);

            _innestGemma = layerName == "ground";
        }
Beispiel #3
0
        public BackgroundManager(
            Camera cameraInstance,
            AssetsLoader assetsLoader,
            InfartGame gameManagerReference)
        {
            CurrentCamera = cameraInstance;
            OldCameraXPos = CurrentCamera.Position.X;

            SfondoRectangle  = assetsLoader.TexturesRectangles["background"];
            TextureReference = assetsLoader.Textures;
            SfondoOrigin     = new Vector2(0.0f, SfondoRectangle.Height);
            SfondoScale      = Vector2.One;

            _grattacieliFondo = new GrattacieliAutogeneranti(
                assetsLoader.TexturesBuildingsBack, assetsLoader.TexturesRectangles, "back", 69, cameraInstance, gameManagerReference);

            SfondoScale = new Vector2(1.8f);

            _grattacieliMid = new GrattacieliAutogeneranti(
                assetsLoader.TexturesBuildingsMid, assetsLoader.TexturesRectangles, "mid", 69, cameraInstance, gameManagerReference);

            _parallaxSpeedFondo = DefaultParallaxSpeedFondo;
            _parallaxSpeedMid   = DefaultParallaxSpeedMid;

            List <Rectangle> tmp = new List <Rectangle>
            {
                assetsLoader.TexturesRectangles["nuvola1"],
                assetsLoader.TexturesRectangles["nuvola2"],
                assetsLoader.TexturesRectangles["nuvola3"]
            };

            _nuvolificioVicino = new Nuvolificio(
                Color.White, 0.6f, new Vector2(45, 60f),
                _nuvoleDefaultSpawnYRange, cameraInstance, tmp, assetsLoader.Textures);

            _nuvolificioMedio = new Nuvolificio(
                new Color(9, 50, 67), 0.4f, new Vector2(30f, 40f),
                _nuvoleDefaultSpawnYRange, cameraInstance, tmp, assetsLoader.Textures);

            _nuvolificioLontano = new Nuvolificio(
                new Color(5, 23, 40), 0.2f, new Vector2(10f, 20f),
                _nuvoleDefaultSpawnYRange, cameraInstance, tmp, assetsLoader.Textures);

            _starfield = new StarFieldParticleSystem(8, assetsLoader);

            CurrentCamera = cameraInstance;
            OldCameraXPos = CurrentCamera.Position.X;
        }
Beispiel #4
0
        public GroundManager(
            Camera currentCamera,
            AssetsLoader assetsLoader,
            InfartGame gameManagerReference)
        {
            CurrentCamera = currentCamera;

            _grattacieliCamminabili = new GrattacieliAutogeneranti(
                assetsLoader.TexturesBuildingsGround,
                assetsLoader.TexturesRectangles,
                "ground",
                69,
                currentCamera,
                gameManagerReference);

            _gameManagerReference = gameManagerReference;
        }