public MapBorder() { m_actionManager = new SingleActionManager(); m_sprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("score_background"), m_transform); m_transform.Position = new Vector2(168, 72); pixelPlayer = new Sprite(Program.TheGame, TextureLibrary.PixelSpriteSheet, new Transform(m_transform, true)); pixelPlayer.Colour = new Vector4((float)255 / (float)255, (float)251 / (float)255, (float)240 / (float)255, 1); pixelPlayer.Transform.PosX = -4; pixelPlayer.Transform.Scale = new Vector2(2, 2); pixelTotem = new Sprite(Program.TheGame, TextureLibrary.PixelSpriteSheet, new Transform(m_transform, true)); pixelTotem.Colour = new Vector4((float)255 / (float)255, (float)251 / (float)255, (float)240 / (float)255, 1); pixelTotem.Origin = new Vector2(0.5f, 1); pixelTotem.Transform.PosY = m_mapFloor; pixelTotem.Transform.Scale = new Vector2(2, m_mapCeiling); m_slideToScreen = new MoveToStaticAction(Program.TheGame, m_transform, positionOnScreen, 1); m_slideToScreen.Interpolator = new PSmoothstepInterpolation(); m_slideToScreen.Timer.Interval = durationSlide; m_slideOutOfScreen = new MoveToStaticAction(Program.TheGame, m_transform, positionOutOfScreen, 1); m_slideOutOfScreen.Interpolator = new PSmoothstepInterpolation(); m_slideOutOfScreen.StartPosition = positionOnScreen; m_slideOutOfScreen.Timer.Interval = durationSlide; }
// TODO NOTE // Si besoin de créer des particules, il faut un générateur de particules ( ParticleGenerator<ClasseDeParticle> ) /* * "J'ai un système de particules statique deans Game1, Il te faut un générateur de particules pour créer des particules" */ public Soul(Vector2 initialPosition, Player player) { //m_transform.ParentTransform = player.Transform; m_playerInstance = player; m_sprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("soul"), m_transform); Vector2 explodePosition; if (player.IsToLeft) { explodePosition.X = player.Transform.PosX + Program.Random.Next(-72, -20); } else { explodePosition.X = player.Transform.PosX + Program.Random.Next(20, 73); } explodePosition.Y = Program.Random.Next((int)player.Transform.PosY + 50, (int)(player.Transform.PosY + 50 + ExplosionBreadth * m_playerInstance.SpeedMultiplier)); MoveToStaticAction moveToExplosionPoint = new MoveToStaticAction(Program.TheGame, m_transform, explodePosition, 1); moveToExplosionPoint.StartPosition = initialPosition; moveToExplosionPoint.Timer.Interval = BaseExplosionDuration / player.SpeedMultiplier; moveToExplosionPoint.Interpolator = new PSmoothstepInterpolation(); m_moveToPlayer = new MoveToStaticAction(Program.TheGame, m_transform, explodePosition, 1); m_moveToPlayer.StartPosition = explodePosition; m_moveToPlayer.Interpolator = new PSquareInterpolation(1); m_moveToPlayer.Timer.Interval = MoveToPlayerTime; m_animation = new Sequence(1); m_animation.AddAction(moveToExplosionPoint); m_animation.AddAction(new DelayAction(Program.TheGame, (float)(Program.Random.NextDouble() * 0.5f + 0.1f) / m_playerInstance.SpeedMultiplier)); m_animation.AddAction(m_moveToPlayer); m_animation.Start(); }
public MenuScreen() { isActive = false; isHidden = true; canLauchChallenge = false; menuSound = SoundEffectLibrary.Get("cursor").CreateInstance(); m_sprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("menu_start_bg"), m_transform); m_sprite.Transform.Position = outPos; arrow = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("arrow"), new Transform(m_transform, true)); moveTo = new MoveToStaticAction(Program.TheGame, m_transform, inPos, 1); moveTo.StartPosition = new Vector2(80, 200); moveTo.Interpolator = new PSmoothstepInterpolation(); moveTo.Timer.Interval = 0.5f; moveOut = new MoveToStaticAction(Program.TheGame, m_transform, outPos, 1); moveOut.StartPosition = inPos; moveOut.Interpolator = new PSmoothstepInterpolation(); moveOut.Timer.Interval = 0.5f; choice = MenuState.START; challengeChoice = ChallengeState.CHALL_1; }
public GameScene() { Concurrent cameraPan; Sequence panZoomSequence = new Sequence(); //m_backpackers[2].Transform.PosX += 100; Party.Initialise(); m_introSequence = new Sequence(); m_introSequence.AddAction(Party.GetMovingOutAnimation()); #region Camera Intro Pan Forward T = 5s m_cameraIntroForwardPan = new MoveToStaticAction(Globals.TheGame, World.cam_Main.Transform, Vector2.Zero, 1); m_cameraIntroForwardPan.Timer.Interval = 5.0f; m_cameraIntroForwardPan.Interpolator = new PSmoothstepInterpolation(); ScaleToAction zoom1 = new ScaleToAction(Globals.TheGame, World.cam_Main.Transform, new Vector2(IntroZoom, IntroZoom), 1); zoom1.Timer.Interval = 3.0f; zoom1.StartScale = new Vector2(WaveZoom, WaveZoom); zoom1.Interpolator = new PSmoothstepInterpolation(); panZoomSequence.AddAction(zoom1); panZoomSequence.AddAction(new DelayAction(Globals.TheGame, 1.0f)); ScaleToAction zoom2 = new ScaleToAction(Globals.TheGame, World.cam_Main.Transform, new Vector2(IntroOnExitZoom, IntroOnExitZoom), 1); zoom2.Timer.Interval = 1.0f; zoom2.StartScale = zoom1.Target; zoom2.Interpolator = new PSmoothstepInterpolation(); panZoomSequence.AddAction(zoom2); cameraPan = new Concurrent(new PastaGameLibrary.Action[] { m_cameraIntroForwardPan, panZoomSequence }); m_introSequence.AddAction(cameraPan); m_introSequence.AddAction(new DelayAction(Globals.TheGame, 0.5f)); #endregion #region Camera pan backwards T = 3s m_cameraIntroBackwardsPan = new MoveToStaticAction(Globals.TheGame, World.cam_Main.Transform, Vector2.Zero, 1); m_cameraIntroBackwardsPan.Timer.Interval = 3.0f; m_cameraIntroBackwardsPan.Interpolator = new PSmoothstepInterpolation(); zoom1 = new ScaleToAction(Globals.TheGame, World.cam_Main.Transform, new Vector2(1.0f, 1.0f), 1); zoom1.Timer.Interval = 1.0f; zoom1.StartScale = zoom2.Target; zoom1.Interpolator = new PSmoothstepInterpolation(); cameraPan = new Concurrent(new PastaGameLibrary.Action[] { m_cameraIntroBackwardsPan, zoom1 }); m_introSequence.AddAction(cameraPan); #endregion }
public Individual(Crowd crowd, Vector2 positionInCrowd) : base() { m_transform.Position = positionInCrowd; m_transform.ParentTransform = crowd.Transform; m_spriteTransform = new Transform(); m_jumpTransform = new PastaGameLibrary.Transform(m_spriteTransform, true); m_sprite = new PastaGameLibrary.Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("perso_foule"), m_jumpTransform); m_sprite.Origin = new Vector2(0.5f, 1.0f); m_saut = new Sequence(-1); /// ///Jump animation /// Vector2 jumpTarget = new Vector2(0, (float)(Program.Random.NextDouble() * JumpHeight * 0.5 + JumpHeight * 0.5)); float movementTime = (float)(Program.Random.NextDouble() * 0.5 * JumpMovementTime + JumpMovementTime * 0.5); MoveToStaticAction jumpMovement = new MoveToStaticAction(Program.TheGame, m_jumpTransform, jumpTarget, 1); jumpMovement.Timer.Interval = movementTime; jumpMovement.Interpolator = new PBounceInterpolation(0); m_saut.AddAction(jumpMovement); m_saut.AddAction(new DelayAction(Program.TheGame, TotalJumpTime - movementTime)); /// ///Walk animation /// m_walk = new MoveToStaticAction(Program.TheGame, m_jumpTransform, new Vector2(0, 1), -1); m_walk.Timer.Interval = (float)Program.Random.NextDouble() * WalkAnimationTime * 0.5f + WalkAnimationTime * 0.5f; m_walk.Interpolator = new BooleanInterpolation(); /// ///Throw player animation /// m_throw = new Sequence(1); float intensity = 1 - Math.Min(1, m_transform.Position.Length() * 0.02f); m_throwStretch = new ScaleToAction(Program.TheGame, m_jumpTransform, new Vector2(1.0f, 1 - intensity * 0.5f), 1); m_throwStretch.Interpolator = new PSmoothstepInterpolation(); ScaleToAction throwDestretch = new ScaleToAction(Program.TheGame, m_jumpTransform, new Vector2(1.0f, 1.0f), 1); throwDestretch.Timer.Interval = 0.1f; m_throw.AddAction(m_throwStretch); MoveToStaticAction throwMovement = new MoveToStaticAction(Program.TheGame, m_jumpTransform, Vector2.Zero, 1); throwMovement.StartPosition = new Vector2(0, -20 - 30 * intensity); throwMovement.Timer.Interval = 0.4f; throwMovement.Interpolator = new PBounceInterpolation(0, 1); m_throw.AddAction(new Concurrent(new PastaGameLibrary.Action[] { throwMovement, throwDestretch })); m_actionManager = new SingleActionManager(); }
public Title() : base() { m_sprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("titre_anime", 4, 1), m_transform); m_animation = new SpriteSheetAnimation(m_sprite, 0, 3, 1.0f, -1); m_animation.Start(); m_physics = new PhysicsComponent(Program.TheGame, m_transform); m_physics.GroundLevel = (int)TitleY; m_physics.Mass = 4; m_moveTo = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(TitleX, -100), 1); m_moveTo.Interpolator = new PSmoothstepInterpolation(); m_moveTo.Timer.Interval = 0.4f; m_transform.Position = new Vector2(TitleX, -100); }
static void InitialiseMovingOutAnimation() { #region Backpacker 0 Sequence waveAnimation_0 = new Sequence(); MoveToStaticAction walkMove_0 = new MoveToStaticAction(Globals.TheGame, Backpackers[0].Transform, new Vector2(MeetingPoint, 0), 1); walkMove_0.Timer.Interval = 0.5f; SpriteSheetAnimation walkAnim_0 = new SpriteSheetAnimation(Backpackers[0].Sprite, 0, 1, 0.1f, 5); waveAnimation_0.AddAction(new Concurrent(new PastaGameLibrary.Action[] { walkMove_0, walkAnim_0 })); waveAnimation_0.AddAction(new SpriteSheetAnimation(Backpackers[0].Sprite, 0, 0, 0.5f, 1)); waveAnimation_0.AddAction(new SpriteSheetAnimation(Backpackers[0].Sprite, 2, 3, 0.2f, 4)); waveAnimation_0.AddAction(new SpriteSheetAnimation(Backpackers[0].Sprite, 0, 0, 0.1f, 1)); #endregion #region Backpacker 1 Sequence waveAnimation_1 = new Sequence(); MoveToStaticAction walkMove_1 = new MoveToStaticAction(Globals.TheGame, Backpackers[1].Transform, new Vector2(MeetingPoint - 40, 0), 1); walkMove_1.Timer.Interval = 0.5f; SpriteSheetAnimation walkAnim_1 = new SpriteSheetAnimation(Backpackers[1].Sprite, 0, 1, 0.1f, 5); waveAnimation_1.AddAction(new DelayAction(Globals.TheGame, 0.2f)); waveAnimation_1.AddAction(new Concurrent(new PastaGameLibrary.Action[] { walkMove_1, walkAnim_1 })); waveAnimation_1.AddAction(new SpriteSheetAnimation(Backpackers[1].Sprite, 0, 0, 0.5f, 1)); waveAnimation_1.AddAction(new SpriteSheetAnimation(Backpackers[1].Sprite, 2, 3, 0.1f, 5)); waveAnimation_1.AddAction(new SpriteSheetAnimation(Backpackers[1].Sprite, 0, 0, 0.1f, 1)); #endregion #region Backpacker 2 Sequence waveAnimation_2 = new Sequence(); MoveToStaticAction walkMove_2 = new MoveToStaticAction(Globals.TheGame, Backpackers[2].Transform, new Vector2(MeetingPoint - 80, 0), 1); walkMove_2.Timer.Interval = 0.5f; SpriteSheetAnimation walkAnim_2 = new SpriteSheetAnimation(Backpackers[2].Sprite, 0, 1, 0.1f, 5); waveAnimation_2.AddAction(new DelayAction(Globals.TheGame, 0.4f)); waveAnimation_2.AddAction(new Concurrent(new PastaGameLibrary.Action[] { walkMove_2, walkAnim_2 })); waveAnimation_2.AddAction(new SpriteSheetAnimation(Backpackers[2].Sprite, 2, 3, 0.2f, 3)); waveAnimation_2.AddAction(new SpriteSheetAnimation(Backpackers[2].Sprite, 0, 0, 0.1f, 1)); #endregion s_movingOutAnimation = new Concurrent(new PastaGameLibrary.Action[] { waveAnimation_0, waveAnimation_1, waveAnimation_2 }); }
public ScoreDisplay() { m_transform = new Transform(); m_slideIn = new MoveToStaticAction(Program.TheGame, m_transform, inPos, 1); m_slideIn.StartPosition = outPos; m_slideIn.Timer.Interval = 0.25f; m_slideIn.Interpolator = new PSmoothstepInterpolation(); m_slideOut = new MoveToStaticAction(Program.TheGame, m_transform, outPos, 1); m_slideOut.StartPosition = inPos; m_slideOut.Timer.Interval = 0.25f; m_slideOut.Interpolator = new PSmoothstepInterpolation(); m_actions = new SingleActionManager(); m_transform.Position = outPos; }
public Monster() : base() { m_spriteSheetNomNom = TextureLibrary.GetSpriteSheet("anim_monstre_miam", 8, 1); m_spriteSheetIdle = TextureLibrary.GetSpriteSheet("anim_monstre_neutre", 5, 1); m_sprite = new Sprite(Program.TheGame, m_spriteSheetIdle, m_transform); m_sprite.PixelCorrection = true; m_idle = new SpriteSheetAnimation(m_sprite, 0, 4, 3.0f, -1); m_openMouth = new SpriteSheetAnimation(m_sprite, 4, 6, 0.5f, 1); m_closeMouth = new Sequence(1); m_closeMouth.AddAction(new SpriteSheetAnimation(m_sprite, 6, 7, 0.45f, 1)); m_closeMouth.AddAction(new MethodAction(Idle)); m_actionManager = new SingleActionManager(); m_transform.Position = new Vector2(MonsterPosX, MonsterPosY); m_breathing = new MoveToStaticAction(Program.TheGame, m_transform, m_transform.Position + new Vector2(0, 3), -1); m_breathing.Interpolator = new PSineInterpolation(); m_breathing.Timer.Interval = 4.0f; m_breathing.Start(); }
public ScoreBorder() { m_actionManager = new SingleActionManager(); score = 0; m_sprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("score_background"), m_transform); m_transform.Position = new Vector2(-8, 72); m_graphicScore = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("score_foreground"), new Transform(m_transform, true)); m_graphicScore.Origin = new Vector2(0.5f, 1); m_graphicScore.Transform.Position = new Vector2(0, 72); m_graphicScore.Transform.SclY = 0f; m_slideToScreen = new MoveToStaticAction(Program.TheGame, m_transform, positionOnScreen, 1); m_slideToScreen.Interpolator = new PSmoothstepInterpolation(); m_slideToScreen.Timer.Interval = durationSlide; m_slideOutOfScreen = new MoveToStaticAction(Program.TheGame, m_transform, positionOutOfScreen, 1); m_slideOutOfScreen.StartPosition = positionOnScreen; m_slideOutOfScreen.Interpolator = new PSmoothstepInterpolation(); m_slideOutOfScreen.Timer.Interval = durationSlide; }
protected override void Initialize() { base.Initialize(); Globals.Initialise(this); World.Initialise(this); AttackManager.Initialise(GraphicsDevice); DestructibleComponent.Initialise(); cameraMove = new MoveToStaticAction(this, World.cam_Main.Transform, new Vector2(0, -350), 1); cameraMove.Interpolator = new PSmoothstepInterpolation(); cameraMove.Timer.Interval = 1.0f; cameraZoom = new ScaleToAction(this, World.cam_Main.Transform, new Vector2(0.5f, 0.5f), 1); cameraZoom.Interpolator = new PSmoothstepInterpolation(); cameraZoom.Timer.Interval = 1.2f; Globals.GameScene = new GameScene(); Globals.GameScene.BuildNextLevel(); Globals.GameScene.StartCurrentLevel(); World.cam_Main.Transform.Position = new Vector2(500, -100); Globals.GameScene.StartIntro(); }
public static void Initalise() { cutscenePlayer = new CutscenePlayer(); cutscenePlayer.Transform.PosX = -100; monster = new Monster(); crowd = new Crowd(40, 18, new Vector2(2.5f, 0.5f)); title = new Title(); DelayAction cameraDelay = new DelayAction(Program.TheGame, CameraDelay); moveToTotem = new MoveToStaticAction(Program.TheGame, Game1.GameCamera.Transform, Vector2.Zero, 1); moveToTotem.StartPosition = new Vector2(CameraMenuX, CameraMenuY); moveToTotem.Interpolator = new PSmoothstepInterpolation(); moveToTotem.Timer.Interval = TimeToFirstTotem; MethodAction moveCrowd = new MethodAction(delegate() { crowd.MoveTo(currentTotemPosition + TotemCrowdOffset, TimeToFirstTotem); }); gotoFirstTotem = new Sequence(1); gotoFirstTotem.AddAction(cameraDelay); gotoFirstTotem.AddAction(moveCrowd); gotoFirstTotem.AddAction(moveToTotem); gotoFirstTotem.AddAction(new MethodAction(delegate() { Cutscenes.ThrowPlayer(Game1.CurrentTotem); })); playerLaunch = new Sequence(1); playerLaunch.AddAction(new DelayAction(Program.TheGame, Crowd.LaunchTensionTime)); moveToAscendingPlayer = new MoveToTransform(Program.TheGame, Game1.GameCamera.Transform, new Transform(), cutscenePlayer.Transform, 1); moveToAscendingPlayer.Interpolator = new PSquareInterpolation(0.1f); moveToAscendingPlayer.RotationActive = false; playerLaunch.AddAction(moveToAscendingPlayer); readySequence = new Sequence(1); Transform end = new Transform(Game1.player.Transform, true); end.PosY = Game1.CameraOffset; moveToFallingPlayer = new MoveToTransform(Program.TheGame, Game1.GameCamera.Transform, new Transform(), end, 1); moveToFallingPlayer.Interpolator = new PSmoothstepInterpolation(); moveToFallingPlayer.RotationActive = false; readySequence.AddAction(new MethodAction(delegate() { Game1.player.GetReady(); })); readySequence.AddAction(moveToFallingPlayer); readySequence.AddAction(new MethodAction(delegate() { Game1.player.StartCountDown(); })); cameraZoom = new ScaleToAction(Program.TheGame, Game1.GameCamera.Transform, Vector2.Zero, 1); cameraZoom.Interpolator = new PSmoothstepInterpolation(); cameraZoom.Timer.Interval = 0.3f; goToPlayerOnGround = new Sequence(1); goToPlayerOnGroundMovement = new MoveToTransform(Program.TheGame, Game1.GameCamera.Transform, new Transform(), cutscenePlayer.Transform, 1); goToPlayerOnGroundMovement.Timer.Interval = 1.0f; goToPlayerOnGroundMovement.Interpolator = new PSmoothstepInterpolation(); goToPlayerOnGround.AddAction(new DelayAction(Program.TheGame, 0.5f)); goToPlayerOnGround.AddAction(goToPlayerOnGroundMovement); intro = new Sequence(1); MoveToStaticAction moveToMenu = new MoveToStaticAction(Program.TheGame, Game1.GameCamera.Transform, new Vector2(CameraMenuX, CameraMenuY), 1); moveToMenu.Timer.Interval = MoveInTime + 1.0f; intro.AddAction(moveToMenu); intro.AddAction(new MethodAction(delegate() { crowd.PushNewGuy(); })); intro.AddAction(new DelayAction(Program.TheGame, 1.5f)); intro.AddAction(new MethodAction(delegate() { StartMainMenu(); })); goToCliff = new Sequence(1); goToCliff.AddAction(moveToTotem); goToCliff.AddAction(new MethodAction(delegate() { cutscenePlayer.GiveSouls(Game1.TotalScore); monster.OpenMouth(); })); auraTexture = TextureLibrary.GetSpriteSheet("soul_temp"); soulTexture = TextureLibrary.GetSpriteSheet("soul"); //moveToAscendingPlayer = new MoveToTransform(Program.TheGame, Game1.GameCamera.Transform, new Transform(), cutscenePlayer.Transform, 1); }
public CutscenePlayer() : base() { m_ascendSound = SoundEffectLibrary.Get("ascend").CreateInstance(); m_cloud = new Prop("cloud"); m_sword = new Prop("sword"); m_shlingSprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("shling"), new Transform(m_transform, true)); m_sprite = new PastaGameLibrary.Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("player_cutscene", 1, 4), new Transform(m_transform, true)); m_sprite.Origin = new Vector2(0.5f, 0.5f); m_sprite.PixelCorrection = false; m_moveToCrowd = new MoveToTransform(Program.TheGame, m_transform, null, null, 1); m_moveToCrowd.Timer.Interval = 0.1f; MoveToStaticAction carryMovement = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(0, CarryHeight - 5), 1); carryMovement.Interpolator = new PBounceInterpolation(1.0f); carryMovement.StartPosition = new Vector2(0, CarryHeight); carryMovement.Timer.Interval = 0.2f; MethodAction action = new MethodAction(delegate() { carryMovement.StartPosition = new Vector2(0, CarryHeight); }); Sequence bounceAnimation = new Sequence(-1); bounceAnimation.AddAction(carryMovement); bounceAnimation.AddAction(action); m_carryAnimation = new Sequence(1); m_carryAnimation.AddAction(m_moveToCrowd); m_carryAnimation.AddAction(bounceAnimation); //Sword movement Transform start = new Transform(m_transform, true); Transform end = new Transform(m_transform, true); m_swordMovement = new MoveToTransform(Program.TheGame, m_sword.Transform, start, end, 1); end.PosX = SwordOffsetToPlayerX; end.PosY = SwordOffsetToPlayerY; m_swordDelay = new DelayAction(Program.TheGame, AscendDuration * SwordStartTimeRatio); //Cloud movement m_cloudMovement = new MoveToStaticAction(Program.TheGame, m_cloud.Transform, new Vector2(CloudOffsetToPlayerX, CloudOffsetToPlayerY), 1); m_cloudMovement.StartPosition = new Vector2(CloudStartX, 0); m_cloudMovement.Interpolator = new PSquareInterpolation(0.25f); //Delay of the ascend, then sword/cloud movement Sequence swordAndCloudMovement = new Sequence(1); swordAndCloudMovement.AddAction(m_swordDelay); swordAndCloudMovement.AddAction(new Concurrent(new PastaGameLibrary.Action[] { m_swordMovement, m_cloudMovement })); m_ascendMovement = new MoveToTransform(Program.TheGame, m_transform, new Transform(), new Transform(), 1); m_ascendMovement.Interpolator = new PSquareInterpolation(0.5f); MethodAction showPlayer = new MethodAction(delegate() { m_sprite.Transform.PosY -= 1; Game1.player.ShowPlayer(); isVisible = false; m_cloud.IsVisible = false; m_sword.IsVisible = false; }); //Shling! ScaleToAction shlingScale = new ScaleToAction(Program.TheGame, m_shlingSprite.Transform, new Vector2(ShlingScale, ShlingScale), 1); shlingScale.Timer.Interval = ShlingTime; shlingScale.StartScale = Vector2.Zero; shlingScale.Interpolator = new PSquareInterpolation(2); RotateToStaticAction shlingRotate = new RotateToStaticAction(Program.TheGame, m_shlingSprite.Transform, ShlingSpin, 1); shlingRotate.Timer.Interval = ShlingTime; m_shling = new Concurrent(new PastaGameLibrary.Action[] { shlingScale, shlingRotate }); Sequence readyAnim = new Sequence(1); readyAnim.AddAction(new DelayAction(Program.TheGame, 0.5f)); readyAnim.AddAction(new MethodAction(delegate() { Cutscenes.GetReady(); SoundEffectLibrary.Get("sword_slash").Play(); })); Concurrent shlingReady = new Concurrent(new PastaGameLibrary.Action[] { m_shling, readyAnim, }); m_ascend = new Sequence(1); m_ascend.AddAction(new DelayAction(Program.TheGame, Crowd.LaunchTensionTime)); m_ascend.AddAction(new MethodAction(delegate() { m_ascendSound.Play(); })); Concurrent ascendAndSword = new Concurrent(new PastaGameLibrary.Action[] { m_ascendMovement, swordAndCloudMovement }); m_ascend.AddAction(ascendAndSword); m_ascend.AddAction(showPlayer); m_ascend.AddAction(shlingReady); m_physics = new PhysicsComponent(Program.TheGame, m_transform); m_physics.Mass = 3.0f; m_jumpFromTotem = new Sequence(1); m_decelerate = new MoveToStaticAction(Program.TheGame, m_transform, Vector2.Zero, 1); m_decelerate.Interpolator = new PSquareInterpolation(0.5f); m_jumpFromTotem.AddAction(m_decelerate); m_jumpFromTotem.AddAction(new DelayAction(Program.TheGame, 0.2f)); m_jumpFromTotem.AddAction(new MethodAction(delegate() { m_physics.OnBounce = null; m_physics.Throw(1.0f, -2.0f, 0); Game1.CurrentMusic.StopDynamicMusic(); SoundEffectLibrary.Get("sword_slash").Play(); })); m_jumpFromTotem.AddAction(new DelayAction(Program.TheGame, 0.75f)); m_jumpFromTotem.AddAction(new MethodAction(delegate() { Game1.SetupNextRound(); if (Game1.CurrentTotem == null) { Cutscenes.GoToCliff(); } else { Cutscenes.GoToTotem(Game1.CurrentTotem, 1.0f, 0); } })); m_actionManager = new SingleActionManager(); m_hitSpikes = new Sequence(1); m_moveToCrashingPlayer = new MoveToTransform(Program.TheGame, Game1.GameCamera.Transform, new Transform(), new Transform(), 1); m_moveToCrashingPlayer.Timer.Interval = 0.2f; m_hitSpikes.AddAction(new DelayAction(Program.TheGame, 1.0f)); m_hitSpikes.AddAction(m_moveToCrashingPlayer); m_hitSpikes.AddAction(new DelayAction(Program.TheGame, 0.5f)); m_hitSpikes.AddAction(new MethodAction(delegate() { if (Game1.CurrentTotem == null) { Cutscenes.GoToCliff(); } else { Cutscenes.GoToTotem(Game1.CurrentTotem, 1.0f, 0); } m_sprite.SetFrame(0); m_physics.OnBounce = null; m_physics.Throw(0, -3, 0); m_transform.PosY = m_physics.GroundLevel; })); m_auraParticles = new ParticleSystem(Program.TheGame, 100); m_soulParticles = new ParticleSystem(Program.TheGame, 500); m_levitate = new Sequence(1); m_moveToCliffTip = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(Cutscenes.InitialCharacterPosition + 10, -8), 1); m_moveToCliffTip.Interpolator = new PSmoothstepInterpolation(); m_moveToCliffTip.Timer.Interval = 1.0f; m_levitate.AddAction(m_moveToCliffTip); m_levitate.AddAction(new MethodAction(delegate() { m_generateSouls = true; })); m_particleGenerator = new ParticleGenerator <GlitterParticle>(Program.TheGame, m_auraParticles); m_particleGenerator.Automatic = true; m_particleGenerator.GenerationInterval = 0.01f; m_soulParticleGenerator = new ParticleGenerator <SoulParticle>(Program.TheGame, m_soulParticles); m_jumpInMouth = new Sequence(1); m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.5f)); m_jumpInMouth.AddAction(new MethodAction(delegate() { m_generateSouls = false; })); m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.5f)); m_jumpInMouth.AddAction(new MethodAction(delegate() { JumpInMonsterMouth(); })); m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.25f)); m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.monster.CloseMouth(); })); m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 2.0f)); m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.crowd.PushNewGuy(); })); m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 1.0f)); m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.StartMainMenu(); })); }
public Crowd(int amountOfPopulation, float radius, Vector2 sizeRatio) { m_radius = radius; m_sizeRatio = sizeRatio; m_playerCharacterTransform = new Transform(m_transform, true); m_playerCharacterTransform.Direction = 1.56f; m_playerCharacterTransform.PosY = -25; int maxIndex; float currentRadius, currentAngle; //Générer le devant maxIndex = (int)(amountOfPopulation * FrontToBackRatio); for (int i = 0; i < amountOfPopulation; ++i) { currentRadius = (float)(Program.Random.NextDouble() * m_radius); currentAngle = (float)(Program.Random.NextDouble() * 6.28); Vector2 position = new Vector2((float)Math.Cos(currentAngle) * currentRadius * m_sizeRatio.X, (float)Math.Sin(currentAngle) * currentRadius * m_sizeRatio.Y); Individual individu = new Individual(this, position); m_people.Add(individu); if (individu.Transform.PosY > 0) { m_frontPeople.Add(individu); } else { m_backPeople.Add(individu); } } m_frontPeople = m_frontPeople.OrderBy(o => o.Transform.PosY).ToList(); /// /// MoveTo animation /// m_moveToMovement = new MoveToStaticAction(Program.TheGame, m_transform, Vector2.Zero, 1); MethodAction stopWalk = new MethodAction(delegate() { for (int i = 0; i < m_people.Count; ++i) { m_people[i].StopWalk(); } }); m_moveTo = new Sequence(1); m_moveTo.AddAction(m_moveToMovement); m_moveTo.AddAction(stopWalk); /// /// Pickup player animation /// m_pickupPlayer = new Sequence(1); m_pickupPlayer.AddAction(m_moveToMovement); //m_pickupPlayer.AddAction(new DelayAction(Program.TheGame, 0.1f)); m_pickupPlayer.AddAction(new MethodAction(delegate() { Cutscenes.cutscenePlayer.JumpOnCrowd(); })); m_animationManager = new SingleActionManager(); /// /// Pickup player animation /// m_pushNewGuy = new MoveToStaticAction(Program.TheGame, m_transform, Vector2.Zero, 1); m_pushNewGuy.Interpolator = new PBounceInterpolation(0.5f); m_pushNewGuy.Timer.Interval = 0.2f; }