public void Update(Camera2D camera) { if (AttachedProjectile.X <= camera.Bounds.Left + m_iconOffset) { X = m_iconOffset; } else if (AttachedProjectile.X > camera.Bounds.Right - m_iconOffset) { X = 1320 - m_iconOffset; } else { X = AttachedProjectile.X - camera.TopLeftCorner.X; } if (AttachedProjectile.Y <= camera.Bounds.Top + m_iconOffset) { Y = m_iconOffset; } else if (AttachedProjectile.Y > camera.Bounds.Bottom - m_iconOffset) { Y = 720 - m_iconOffset; } else { Y = AttachedProjectile.Y - camera.TopLeftCorner.Y; } Rotation = CDGMath.AngleBetweenPts(camera.TopLeftCorner + Position, AttachedProjectile.Position); m_iconBG.Position = Position; m_iconBG.Rotation = Rotation; m_iconProjectile.Position = Position; m_iconProjectile.Rotation = AttachedProjectile.Rotation; m_iconProjectile.GoToFrame(AttachedProjectile.CurrentFrame); }
public override void OnEnter() { if (Game.PlayerStats.SpecialItem == 9 && Game.PlayerStats.ChallengeEyeballBeaten) { Game.PlayerStats.SpecialItem = 0; } if (Game.PlayerStats.SpecialItem == 10 && Game.PlayerStats.ChallengeSkullBeaten) { Game.PlayerStats.SpecialItem = 0; } if (Game.PlayerStats.SpecialItem == 11 && Game.PlayerStats.ChallengeFireballBeaten) { Game.PlayerStats.SpecialItem = 0; } if (Game.PlayerStats.SpecialItem == 12 && Game.PlayerStats.ChallengeBlobBeaten) { Game.PlayerStats.SpecialItem = 0; } if (Game.PlayerStats.SpecialItem == 13 && Game.PlayerStats.ChallengeLastBossBeaten) { Game.PlayerStats.SpecialItem = 0; } Player.AttachedLevel.UpdatePlayerHUDSpecialItem(); m_isSnowing = (DateTime.Now.Month == 12 || DateTime.Now.Month == 1); if (m_isSnowing) { foreach (var current in m_rainFG) { current.ChangeToSnowflake(); } } if (!(Game.ScreenManager.Game as Game).SaveManager.FileExists(SaveType.Map) && Game.PlayerStats.HasArchitectFee) { Game.PlayerStats.HasArchitectFee = false; } Game.PlayerStats.TutorialComplete = true; Game.PlayerStats.IsDead = false; m_lightningTimer = 5f; Player.CurrentHealth = Player.MaxHealth; Player.CurrentMana = Player.MaxMana; Player.ForceInvincible = false; (Player.AttachedLevel.ScreenManager.Game as Game).SaveManager.SaveFiles(SaveType.PlayerData); if (TollCollectorAvailable && !Player.AttachedLevel.PhysicsManager.ObjectList.Contains(m_tollCollector)) { Player.AttachedLevel.PhysicsManager.AddObject(m_tollCollector); } if (m_blacksmithAnvilSound == null) { m_blacksmithAnvilSound = new FrameSoundObj(m_blacksmith.GetChildAt(5) as IAnimateableObj, Player, 7, "Anvil1", "Anvil2", "Anvil3"); } if (Game.PlayerStats.Traits.X == 35f || Game.PlayerStats.Traits.Y == 35f) { Game.ShadowEffect.Parameters["ShadowIntensity"].SetValue(0.7f); } else { Game.ShadowEffect.Parameters["ShadowIntensity"].SetValue(0); } m_playerWalkedOut = false; Player.UpdateCollisionBoxes(); Player.Position = new Vector2(0f, 660f - (Player.Bounds.Bottom - Player.Y)); Player.State = 1; Player.IsWeighted = false; Player.IsCollidable = false; var logicSet = new LogicSet(Player); logicSet.AddAction(new RunFunctionLogicAction(Player, "LockControls")); logicSet.AddAction(new MoveDirectionLogicAction(new Vector2(1f, 0f))); logicSet.AddAction(new ChangeSpriteLogicAction("PlayerWalking_Character")); logicSet.AddAction(new PlayAnimationLogicAction()); logicSet.AddAction(new DelayLogicAction(0.5f)); logicSet.AddAction(new ChangePropertyLogicAction(Player, "CurrentSpeed", 0)); logicSet.AddAction(new ChangePropertyLogicAction(Player, "IsWeighted", true)); logicSet.AddAction(new ChangePropertyLogicAction(Player, "IsCollidable", true)); Player.RunExternalLogicSet(logicSet); Tween.By(this, 1f, Linear.EaseNone); Tween.AddEndHandlerToLastTween(Player, "UnlockControls"); SoundManager.StopMusic(1f); m_isRaining = (CDGMath.RandomPlusMinus() > 0); m_isRaining = true; if (m_isRaining) { if (m_rainSFX != null) { m_rainSFX.Dispose(); } if (!m_isSnowing) { m_rainSFX = SoundManager.PlaySound("Rain1"); } else { m_rainSFX = SoundManager.PlaySound("snowloop_filtered"); } } m_tent.TextureColor = new Color(200, 200, 200); m_blacksmithBoard.TextureColor = new Color(200, 200, 200); m_screw.TextureColor = new Color(200, 200, 200); if (Game.PlayerStats.LockCastle) { m_screw.GoToFrame(m_screw.TotalFrames); m_architectBlock.Position = new Vector2(1492f, 579f); } else { m_screw.GoToFrame(1); m_architectBlock.Position = new Vector2(1492f, 439f); } Player.UpdateEquipmentColours(); base.OnEnter(); }