{"TotalCount":11,"Files":[{"Ident":"mondays.red_light__green_light","Path":"StartLine.cs","FileName":"StartLine.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367449,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class Startline : Component\r\n{\r\n    public void PlayerEntered( GameObject other )\r\n    {\r\n        var redLightPlayer = other.Components.Get\u003CRedLightPlayer\u003E();\r\n\r\n        if ( redLightPlayer == null )\r\n            return;\r\n\r\n        redLightPlayer.State = RedLightPlayer.PlayerState.Playing;\r\n\r\n        Log.Info( \u0022player Start\u0022 );\r\n    }\r\n}"},{"Ident":"mondays.red_light__green_light","Path":"redlightgreenlightui.razor.scss","FileName":"redlightgreenlightui.razor.scss","PackageType":"game","CodeKind":"Game","AssetVersionId":367449,"IsPrivate":false,"Code":"RedLightGreenLightUI {\r\n\tposition: absolute;\r\n\ttop: 100px;\r\n\tleft: 0;\r\n\tright: 0;\r\n\tbottom: 0;\r\n\tbackground-color: #ffffff00;\r\n\tjustify-content: center;\r\n\talign-items: top;\r\n\tfont-weight: bold;\r\n\tborder-radius: 20px;\r\n\r\n\t.title {\r\n\t\tfont-size: 48px;\r\n\t\tfont-family: Poppins;\r\n\t\tcolor: #fff;\r\n\t}\r\n}"},{"Ident":"mondays.red_light__green_light","Path":"EntityController.cs","FileName":"EntityController.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367449,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class EntityController : Component\r\n{\r\n\t[Property]\r\n    public RedLightGreenLight GameController { get; set; }\r\n\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\tif ( GameController.State == RedLightGreenLight.GameState.Red)\r\n\t\t{\r\n\t\t\tGameObject.Transform.Rotation = Rotation.FromYaw(180f);\r\n\t\t\tLog.Info(\u0022entity red\u0022);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tGameObject.Transform.Rotation = Rotation.FromYaw(0f);\r\n\t\t\tLog.Info(\u0022entity green\u0022);\r\n\t\t}\r\n\t}\r\n\r\n\t[Button]\r\n\tpublic void Rotate()\r\n\t{\r\n\t\tGameObject.Transform.Rotation = Rotation.FromYaw(0f);\r\n\r\n\t}\r\n}"},{"Ident":"mondays.red_light__green_light","Path":"RedLightGreenLightUI.razor","FileName":"RedLightGreenLightUI.razor","PackageType":"game","CodeKind":"Game","AssetVersionId":367449,"IsPrivate":false,"Code":"@using Sandbox;\r\n@using Sandbox.UI;\r\n@inherits PanelComponent\r\n@namespace Sandbox\r\n\r\n\u003Croot\u003E\r\n\t\u003Cdiv class=\u0022title\u0022\u003E@StateText\u003C/div\u003E\r\n\u003C/root\u003E\r\n\r\n@code\r\n{\r\n\r\n\t[Property] public RedLightGreenLight Game { get; set; }\r\n\r\n\t[Property] public RedLightPlayer Player { get; set; }\r\n\r\n\tstring StateText\r\n{\r\n    get\r\n    {\r\n\t\t// Player-specific states come first\r\n        if ( Player?.State == RedLightPlayer.PlayerState.GameOver )\r\n            return \u0022GAME OVER\u0022;\r\n        else return \u0022\u0022;\r\n    }\r\n}\r\n\r\n\tprotected override int BuildHash()\r\n    =\u003E System.HashCode.Combine( Game?.State, Player?.State );\r\n}"},{"Ident":"mondays.red_light__green_light","Path":"RedLightGreenLight.cs","FileName":"RedLightGreenLight.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367449,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class RedLightGreenLight : Component\r\n{\r\n\tpublic enum GameState\r\n\t{\r\n\t\tGreen,\r\n\t\tRed,\r\n\t}\r\n\r\n\tpublic GameState State { get; set; }\r\n\r\n\tfloat timer = 0f;\r\n\tstatic float minWait = 2f;\r\n\tstatic float maxWait = 6f;\r\n\r\n\tfloat stateDuration = Game.Random.Float(minWait, maxWait);\r\n\r\n\tprotected override void OnStart()\r\n\t{\r\n\r\n\t}\r\n\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\ttimer \u002B= Time.Delta;\r\n\r\n\t\t// State Change\r\n\t\tif (timer \u003E= stateDuration)\r\n\t\t{\r\n\t\t\tif (State == GameState.Green)\r\n\t\t\t\tState = GameState.Red;\r\n\t\t\telse if (State == GameState.Red) \r\n\t\t\t\tState = GameState.Green;\r\n\r\n\t\t\ttimer = 0f;\r\n\t\t\tstateDuration = Game.Random.Float(minWait, maxWait);\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"mondays.red_light__green_light","Path":"Assembly.cs","FileName":"Assembly.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367449,"IsPrivate":false,"Code":"global using Sandbox;\r\nglobal using System.Collections.Generic;\r\nglobal using System.Linq;\r\n"},{"Ident":"mondays.red_light__green_light","Path":".obj/__compiler_extra.cs","FileName":"__compiler_extra.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367449,"IsPrivate":false,"Code":"global using static Sandbox.Internal.GlobalGameNamespace;\r\nglobal using Microsoft.AspNetCore.Components;\r\nglobal using Microsoft.AspNetCore.Components.Rendering;\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022AddonTitle\u0022, \u0022Red Light, Green Light\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022AddonIdent\u0022, \u0022red_light__green_light\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022OrgIdent\u0022, \u0022mondays\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022Ident\u0022, \u0022mondays.red_light__green_light\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022EngineVersion\u0022, \u002229\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022EngineMinorVersion\u0022, \u00221\u0022 )]\r\n\r\n[assembly: System.Runtime.Versioning.TargetFramework( \u0022.NETCoreApp,Version=v9.0\u0022, FrameworkDisplayName = \u0022.NET 9.0\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022CompileTime\u0022, \u00222026-09-04T15:46:35.5648640Z\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyVersion(\u00220.0.334.0\u0022)]\r\n[assembly: global::System.Reflection.AssemblyFileVersion(\u00220.0.334.0\u0022)]"},{"Ident":"mondays.red_light__green_light","Path":"FinishLine.cs","FileName":"FinishLine.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367449,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class FinishLine : Component\r\n{\r\n    public void PlayerEntered( GameObject other )\r\n    {\r\n        var redLightPlayer = other.Components.Get\u003CRedLightPlayer\u003E();\r\n\r\n        if ( redLightPlayer == null )\r\n            return;\r\n\r\n        redLightPlayer.State = RedLightPlayer.PlayerState.Win;\r\n\r\n        Log.Info( \u0022player crossed finish line\u0022 );\r\n    }\r\n}"},{"Ident":"mondays.red_light__green_light","Path":"CustomTopDownController.cs","FileName":"CustomTopDownController.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367449,"IsPrivate":false,"Code":"public sealed class CustomTopDownController : Component\r\n{\r\n\t[RequireComponent] PlayerController Controller { get; set; }\r\n\r\n\tprotected override void OnFixedUpdate()\r\n\t{\r\n\t\t// Lets make the player move when we press WASD\r\n\t\tvar speed = Input.Down( \u0022Run\u0022 ) ? Controller.RunSpeed : Controller.WalkSpeed;\r\n\t\tController.WishVelocity = Input.AnalogMove * speed;\r\n\r\n\t\t// And rotate the player to face the direction of the movement\r\n\t\tif ( Controller.WishVelocity.LengthSquared \u003E 0 )\r\n\t\t{\r\n\t\t\tvar targetAngle = Controller.WishVelocity.EulerAngles;\r\n\t\t\tController.EyeAngles = Rotation.Slerp( Controller.EyeAngles, targetAngle, Time.Delta * 10f );\r\n\t\t}\r\n\t}\r\n\r\n\tprotected override void OnPreRender()\r\n\t{\r\n\t\t// This will update the camera\u0027s position so that it\u0027s up in the air and back a bit, looking down at an angle.\r\n\t\tScene.Camera.WorldPosition = Controller.WorldPosition \u002B Vector3.Up * 1024f \u002B Vector3.Backward * 256f;\r\n\t\tScene.Camera.WorldRotation = new Angles( 75, 0, 0 );\r\n\t}\r\n}\r\n\r\n\r\n\r\n"},{"Ident":"mondays.red_light__green_light","Path":"RedLightPlayer.cs","FileName":"RedLightPlayer.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367449,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class RedLightPlayer : Component\r\n{\r\n\tpublic enum PlayerState\r\n\t{\r\n\t\tPlaying,\r\n\t\tGameOver,\r\n\t\tWin\r\n\t}\r\n\r\n\t[Property]\r\n\tpublic RedLightGreenLight GameController { get; set; }\r\n\r\n\t[Property]\r\n\tpublic SkinnedModelRenderer ModelRenderer { get; set; }\r\n\r\n\t[Property]\r\n\tpublic SpawnPoint SpawnPoint { get; set; }\r\n\r\n\t[Property]\r\n\tpublic PlayerController PlayerController { get; set; }\r\n\r\n\tpublic PlayerState State { get; set; }\r\n\r\n\tVector3 previousPosition;\r\n\r\n\tprotected override void OnStart()\r\n\t{\r\n\t\tpreviousPosition = WorldPosition;\r\n\t\tState = PlayerState.Playing;\r\n\t}\r\n\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\tif ( State == PlayerState.GameOver )\r\n\t\t{\r\n\t\t\tpreviousPosition = WorldPosition;\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif ( State != PlayerState.Playing )\r\n\t\t\treturn;\r\n\r\n\t\tif ( GameController.State == RedLightGreenLight.GameState.Red \u0026\u0026 State != PlayerState.Win )\r\n\t\t{\r\n\t\t\tif ( WorldPosition != previousPosition )\r\n\t\t\t{\r\n\t\t\t\tLog.Info( \u0022PLAYER MOVED!\u0022 );\r\n\r\n\t\t\t\tState = PlayerState.GameOver;\r\n\r\n\t\t\t\t// Start the death sequence\r\n\t\t\t\tRagdoll();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpreviousPosition = WorldPosition;\r\n\t}\r\n\r\n\t[Button]\r\n\tasync public void Ragdoll()\r\n\t{\r\n\t\tif ( !ModelRenderer.IsValid() )\r\n\t\t\treturn;\r\n\r\n\t\tif ( !PlayerController.IsValid() )\r\n\t\t\treturn;\r\n\r\n\t\t// Disable player controls\r\n\t\tPlayerController.UseInputControls = false;\r\n\t\tPlayerController.UseLookControls = false;\r\n\r\n\t\t// Create ragdoll\r\n\t\tvar ragdoll = AddComponent\u003CModelPhysics\u003E();\r\n\t\tragdoll.Renderer = ModelRenderer;\r\n\t\tragdoll.Model = ModelRenderer.Model;\r\n\r\n\t\t// Death timer\r\n\t\tawait Task.Delay( 3000 );\r\n\r\n\t\t// Remove ragdoll physics\r\n\t\tragdoll.Destroy();\r\n\r\n\t\t// Respawn player\r\n\t\tWorldPosition = SpawnPoint.WorldPosition;\r\n\r\n\t\t// Reset controls\r\n\t\tPlayerController.UseInputControls = true;\r\n\t\tPlayerController.UseLookControls = true;\r\n\r\n\t\t// Reset position tracking\r\n\t\tpreviousPosition = WorldPosition;\r\n\t\tState = PlayerState.Playing;\r\n\t}\r\n\t\r\n}"},{"Ident":"mondays.red_light__green_light","Path":"LightingController.cs","FileName":"LightingController.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367449,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class LightingController : Component\r\n{\r\n\t[Property]\r\n    public RedLightGreenLight GameController { get; set; }\r\n\r\n\t[Property]\r\n    public PointLight Light { get; set; }\r\n\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\tif ( GameController.State == RedLightGreenLight.GameState.Red)\r\n\t\t{\r\n\t\t\tLight.LightColor = Color.Red;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tLight.LightColor = Color.Green;\r\n\t\t}\r\n\t}\r\n}\r\n"}]}