{"TotalCount":11,"Files":[{"Ident":"guusconl.simple_interactions_demo","Path":"ExampleThreeCubeTwoInteraction.cs","FileName":"ExampleThreeCubeTwoInteraction.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367401,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class ExampleThreeCubeTwoInteraction : SimpleInteractions.SimpleInteraction\r\n{\r\n\t[Rpc.Broadcast]\r\n\tprotected override void OnInteract()\r\n\t{\r\n\t\tthis.GameObject.WorldPosition = this.GameObject.WorldPosition \u002B new Vector3(0, 0, 10);\r\n\t\tthis.GameObject.GetComponent\u003CRigidbody\u003E().Sleeping = false;\r\n\t}\r\n}\r\n"},{"Ident":"guusconl.simple_interactions_demo","Path":"Example5/ExampleFiveInteractionOne.cs","FileName":"ExampleFiveInteractionOne.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367401,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class ExampleFiveInteractionOne : SimpleInteractions.SimpleInteraction\r\n{\r\n\t[Property]\r\n\tpublic GameObject Parent;\r\n\tprotected override void OnStart()\r\n\t{\r\n\t\tbase.OnStart();\r\n\r\n\t\t// Put your initialization code here if you have any\r\n\t}\r\n\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\tbase.OnUpdate();\r\n\r\n\t\t// Put your update code here if you have any\r\n\t}\r\n\r\n\r\n\t[Rpc.Broadcast]\r\n\tprotected override void OnInteract()\r\n\t{\r\n\t\tParent.WorldPosition = Parent.WorldPosition \u002B new Vector3(0, 0, 10);\r\n\t\tParent.GetComponent\u003CRigidbody\u003E().Sleeping = false;\r\n\t}\r\n}\r\n"},{"Ident":"guusconl.simple_interactions_demo","Path":"SimpleInteraction.cs","FileName":"SimpleInteraction.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367401,"IsPrivate":false,"Code":"using Sandbox;\r\nusing Sandbox.Utility;\r\nusing Sandbox.Diagnostics;\r\nusing System.Linq;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace SimpleInteractions\r\n{\r\n\r\n\t/// \u003Csummary\u003E\r\n\t/// Simple interaction component\r\n\t/// \u003C/summary\u003E\r\n\t[Icon(\u0022touch_app\u0022)]\r\n\t[Title(\u0022Simple Interaction\u0022)]\r\n\tpublic class SimpleInteraction : Component\r\n\t{\r\n\t\t[Property]\r\n\t\tpublic bool InteractionEnabled { get; set; } = true;\r\n\r\n\t\t[Property, Title(\u0022Interaction Name\u0022)]\r\n\t\tpublic string InteractionString { get; set; } = \u0022Interact\u0022;\r\n\r\n\t\t[Property]\r\n\t\tpublic float InteractionDistance { get; set; } = 120f;\r\n\r\n\t\t[Property, ToggleGroup(\u0022InteractionHold\u0022)]\r\n\t\tpublic bool InteractionHold { get; set; } = false;\r\n\r\n\t\t[Property, Group(\u0022InteractionHold\u0022)]\r\n\t\tpublic float InteractionHoldDuration { get; set; } = 0.5f;\r\n\r\n\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// If not set, will try to find a collider on the same GameObject.\r\n\t\t/// \u003C/summary\u003E\r\n\t\t[Property, Title(\u0022Override collider\u0022)]\r\n\t\tpublic Collider Collider { get; set; }\r\n\r\n\t\tprivate GameObject CurrentPanel = null;\r\n\r\n\t\tprivate TimeSince HoldTime = 0;\r\n\t\tprivate bool Holding = false;\r\n\t\tprivate bool HoldingInteractionHappened = false;\r\n\r\n\t\tstatic protected GameObject InteractionPanelPrefab;\r\n\r\n\t\tprotected override void OnStart()\r\n\t\t{\r\n\t\t\tInteractionPanelPrefab = GameObject.GetPrefab(\u0022InteractionsPanel.prefab\u0022);\r\n\r\n\t\t\tAssert.True(InteractionPanelPrefab.IsValid(), $\u0022No InteractionPanel prefab found for {this.GameObject.Name}!\u0022);\r\n\r\n\t\t\tif (!Collider.IsValid())\r\n\t\t\t{\r\n\r\n\t\t\t\tCollider = this.GameObject.GetComponent\u003CCollider\u003E();\r\n\r\n\t\t\t\tAssert.True(Collider.IsValid(), $\u0022No collider found for {this.GameObject.Name}!\u0022);\r\n\t\t\t}\r\n\t\t\tthis.GameObject.Tags.Add(\u0022Interact\u0022);\r\n\t\t}\r\n\r\n\t\tprotected override void OnUpdate()\r\n\t\t{\r\n\t\t\tif (!InteractionEnabled)\r\n\t\t\t{\r\n\t\t\t\t// Reset everything just in case\r\n\t\t\t\tHolding = false;\r\n\t\t\t\tHoldingInteractionHappened = false;\r\n\r\n\t\t\t\t// Delete the Interaction panel otherwise it would just float there...\r\n\t\t\t\tif (CurrentPanel.IsValid())\r\n\t\t\t\t{\r\n\t\t\t\t\tInteractionPanel panel = CurrentPanel.GetComponent\u003CInteractionPanel\u003E();\r\n\t\t\t\t\tif (panel.IsValid())\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t_ = DeletePanel();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tRay ray = Scene.Camera.GameObject.Transform.World.ForwardRay;\r\n\r\n\t\t\tvar traces = Scene.Trace.Ray(ray, InteractionDistance)\r\n\t\t\t.WithoutTags(\u0022IgnoreInteract\u0022)\r\n\t\t\t.HitTriggers()\r\n\t\t\t.RunAll();\r\n\r\n\t\t\t// Gizmo.Draw.Line(tr.StartPosition, tr.EndPosition);\r\n\r\n\t\t\tif (traces.Count() \u003C= 0)\r\n\t\t\t{\r\n\t\t\t\t_ = DeletePanel();\r\n\r\n\t\t\t\t// Force repressing use in case you looked away while holding down.\r\n\t\t\t\tHoldingInteractionHappened = true;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tforeach (var tr in traces)\r\n\t\t\t{\r\n\r\n\t\t\t\tCollider HitCollider = tr.Shape.Collider as Collider;\r\n\r\n\t\t\t\t// If it\u0027s a trigger and it doesn\u0027t have the interact tag, skip it.\r\n\t\t\t\t// We can see through it.\r\n\t\t\t\tif (HitCollider.IsTrigger \u0026\u0026 !HitCollider.GameObject.Tags.Has(\u0022Interact\u0022))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\telse if (!HitCollider.IsTrigger \u0026\u0026 !HitCollider.GameObject.Tags.Has(\u0022Interact\u0022))\r\n\t\t\t\t{\r\n\t\t\t\t\t// Something is blocking the interaction.\r\n\t\t\t\t\t_ = DeletePanel();\r\n\r\n\t\t\t\t\t// Force repressing use in case you looked away while holding down.\r\n\t\t\t\t\tHoldingInteractionHappened = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tVector3 offset = Vector3.Zero;\r\n\r\n\t\t\t\tif (HitCollider is BoxCollider)\r\n\t\t\t\t{\r\n\t\t\t\t\toffset = (HitCollider as BoxCollider).Center;\r\n\t\t\t\t}\r\n\t\t\t\telse if (HitCollider is SphereCollider)\r\n\t\t\t\t{\r\n\t\t\t\t\toffset = new Vector3((HitCollider as SphereCollider).Center);\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t\tif (HitCollider == Collider)\r\n\t\t\t\t{\r\n\t\t\t\t\tVector3 pos = new Vector3(offset.x, offset.y, -offset.z);\r\n\t\t\t\t\tOnHover(HitCollider.GameObject.WorldPosition - pos);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t_ = DeletePanel();\r\n\r\n\t\t\t\t\t// Force repressing use in case you looked away while holding down.\r\n\t\t\t\t\tHoldingInteractionHappened = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tprivate void OnHover(Vector3 pos)\r\n\t\t{\r\n\t\t\tif (!CurrentPanel.IsValid())\r\n\t\t\t{\r\n\t\t\t\tCurrentPanel = InteractionPanelPrefab.Clone();\r\n\t\t\t}\r\n\r\n\t\t\tCurrentPanel.WorldPosition = pos;\r\n\r\n\t\t\t// Flip the panel to face the camera\r\n\t\t\tRotation camRotation = Scene.Camera.WorldRotation;\r\n\r\n\t\t\tAngles ang = camRotation.Angles();\r\n\t\t\tang.roll \u002B= 180;\r\n\t\t\tang.pitch \u002B= 180;\r\n\t\t\tRotation rot = ang.ToRotation();\r\n\t\t\tCurrentPanel.WorldRotation = rot;\r\n\r\n\t\t\tInteractionPanel panel = CurrentPanel.GetComponent\u003CInteractionPanel\u003E();\r\n\t\t\tpanel.InteractionString = InteractionString;\r\n\t\t\tpanel.IsHoldInteraction = InteractionHold;\r\n\t\t\tpanel.ProgressionHold = 0;\r\n\r\n\r\n\r\n\t\t\tif (!InteractionHold)\r\n\t\t\t{\r\n\t\t\t\tif (Input.Pressed(\u0022use\u0022))\r\n\t\t\t\t{\r\n\t\t\t\t\t_ = panel.TriggerInteractAnimation();\r\n\t\t\t\t\tOnInteract();\r\n\t\t\t\t}\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\r\n\t\t\tif (!Input.Down(\u0022use\u0022))\r\n\t\t\t{\r\n\t\t\t\tHolding = false;\r\n\t\t\t\tHoldingInteractionHappened = false;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t// Interaction already happened. Player needs to release and press again.\r\n\t\t\tif (HoldingInteractionHappened)\r\n\t\t\t{\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif (Holding)\r\n\t\t\t{\r\n\t\t\t\tpanel.ProgressionHold = Easing.QuadraticInOut(HoldTime / InteractionHoldDuration);\r\n\t\t\t\tif (HoldTime \u003E= InteractionHoldDuration)\r\n\t\t\t\t{\r\n\t\t\t\t\tHoldingInteractionHappened = true;\r\n\t\t\t\t\tOnInteract();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Started holding.\r\n\t\t\t\tHolding = true;\r\n\t\t\t\tHoldTime = 0;\r\n\t\t\t\t_ = panel.TriggerInteractAnimation();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tasync private Task DeletePanel()\r\n\t\t{\r\n\t\t\tif (!CurrentPanel.IsValid()) return;\r\n\r\n\t\t\tCurrentPanel.GetComponent\u003CPanelComponent\u003E().Panel.Delete();\r\n\t\t\tawait Task.DelaySeconds(0.1f);\r\n\t\t\tCurrentPanel.Destroy();\r\n\t\t}\r\n\r\n\t\t[Rpc.Broadcast]\r\n\t\tprotected virtual void OnInteract()\r\n\t\t{\r\n\t\t\tLog.Error($\u0022Interaction not implemented for {this.GameObject.Name}!\u0022);\r\n\t\t}\r\n\r\n\t}\r\n\r\n}"},{"Ident":"guusconl.simple_interactions_demo","Path":"ExampleThreeCubeOneInteraction.cs","FileName":"ExampleThreeCubeOneInteraction.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367401,"IsPrivate":false,"Code":"using Sandbox;\r\nusing SimpleInteractions;\r\nusing Sandbox.Diagnostics;\r\n\r\npublic sealed class ExampleThreeCubeOneInteraction : SimpleInteraction\r\n{\r\n\r\n\t[Property]\r\n\tGameObject OtherCube = null;\r\n\r\n\tprivate SimpleInteraction OtherInteraction;\r\n\r\n\tprotected override void OnStart()\r\n\t{\r\n\t\tbase.OnStart();\r\n\r\n\t\tAssert.True(OtherCube.IsValid(), $\u0022No OtherCube selected for {this.GameObject.Name}!\u0022);\r\n\r\n\t\tOtherInteraction = OtherCube.GetComponent\u003CSimpleInteraction\u003E();\r\n\t}\r\n\r\n\t[Rpc.Broadcast]\r\n\tprotected override void OnInteract()\r\n\t{\r\n\t\tif (OtherInteraction.InteractionEnabled)\r\n\t\t{\r\n\t\t\tOtherInteraction.InteractionEnabled = false;\r\n\t\t\tOtherCube.GetComponent\u003CModelRenderer\u003E().Tint = Color.Red;\r\n\t\t\tInteractionString = \u0022Enable Interaction on other cube\u0022;\r\n\t\t} else\r\n\t\t{\r\n\t\t\tOtherInteraction.InteractionEnabled = true;\r\n\t\t\tOtherCube.GetComponent\u003CModelRenderer\u003E().Tint = Color.Green;\r\n\t\t\tInteractionString = \u0022Disable Interaction on other cube\u0022;\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"guusconl.simple_interactions_demo","Path":"ExampleTwoInteraction.cs","FileName":"ExampleTwoInteraction.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367401,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class ExampleTwoInteraction : SimpleInteractions.SimpleInteraction\r\n{\r\n\r\n\tenum State {\r\n\t\tRED,\r\n\t\tGREEN,\r\n\t\tBLUE\r\n\t}\r\n\r\n\tState state = State.RED;\r\n\r\n\t[Rpc.Broadcast]\r\n\tprotected override void OnInteract()\r\n\t{\r\n\r\n\t\tthis.GameObject.WorldPosition = this.GameObject.WorldPosition \u002B new Vector3(0, 0, 0);\r\n\r\n\t\t\r\n\t\tvar caller = Rpc.Caller.DisplayName;\r\n\t\tLog.Info($\u0022{caller} interacted with {this.GameObject.Name}!\u0022);\r\n\t\t\r\n\r\n\t\tModelRenderer renderer = this.GameObject.GetComponent\u003CModelRenderer\u003E();\r\n\t\tswitch (state)\r\n\t\t{\r\n\t\t\tcase State.RED:\r\n\t\t\t\trenderer.Tint = Color.Green;\r\n\t\t\t\tInteractionString = \u0022Change to Blue\u0022;\r\n\t\t\t\tstate = State.GREEN;\r\n\t\t\t\tbreak;\r\n\t\t\tcase State.GREEN:\r\n\t\t\t\trenderer.Tint = Color.Blue;\r\n\t\t\t\tInteractionString = \u0022Change to Red\u0022;\r\n\t\t\t\tstate = State.BLUE;\r\n\t\t\t\tbreak;\r\n\t\t\tcase State.BLUE:\r\n\t\t\t\trenderer.Tint = Color.Red;\r\n\t\t\t\tInteractionString = \u0022Change to Green\u0022;\r\n\t\t\t\tstate = State.RED;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"guusconl.simple_interactions_demo","Path":"Assembly.cs","FileName":"Assembly.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367401,"IsPrivate":false,"Code":"global using Sandbox;\r\nglobal using System.Collections.Generic;\r\nglobal using System.Linq;\r\n"},{"Ident":"guusconl.simple_interactions_demo","Path":"ui/interactionpanel.razor.scss","FileName":"interactionpanel.razor.scss","PackageType":"game","CodeKind":"Game","AssetVersionId":367401,"IsPrivate":false,"Code":"InteractionPanel\r\n{\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\tbackground-color: #444;\r\n\tjustify-content: center;\r\n\talign-items: center;\r\n\tfont-weight: bold;\r\n\tborder-radius: 20px;\r\n\tfont-size: 25px;\r\n\tfont-family: Poppins;\r\n\tcolor: #fff;\r\n\ttext-stroke: 8px black;\r\n\ttransform-origin: left center;\r\n\r\n\r\n\ttransition: all 0.1s ease-out;\r\n\ttransform: scale( 1 );\r\n\r\n\t// When the element is created make it expand from nothing.\r\n\t\u0026:intro {\r\n\t\ttransform: scale( 0 );\r\n\t}\r\n\r\n\t\u0026:outro {\r\n\t\ttransform: scale( 0 );\r\n\t}\r\n\r\n\r\n\t.InteractionTitle\r\n\t{\r\n\t\tcolor: #fff;\r\n\t\tmargin-right: 15px;\r\n\t\twhite-space: normal;\r\n\t\tmax-width: 300px;\r\n\t\talign-items: center;\r\n\t}\r\n\r\n\t.ProgressBar {\r\n\t\tposition: absolute; /* Place the progress bar within the root */\r\n\t\ttop: 0;\r\n\t\tleft: 0;\r\n\t\theight: 100%; /* Fill the entire height of the root */\r\n\t\tz-index: 0; /* Ensure it is below the content */\r\n\t\tborder-radius: 20px;\r\n\t\tbackground-color: #a2a2a2;\r\n\t}\r\n\r\n\t.Left\r\n\t{\r\n\t\tflex-direction: column;\r\n\t\talign-items: center;\r\n\t\tpadding-left: 20px;\r\n\t\tmin-width: 110px;\r\n\r\n\t}\r\n\r\n\t.Right\r\n\t{\r\n\t\twidth: 100%;\r\n\t\talign-items: center;\r\n\t\tmargin-left: 30px;\r\n\r\n\t}\r\n\r\n\t.InteractionHold\r\n\t{\r\n\t\tmargin-top: -13px;\r\n\t\tmargin-bottom: 5px;\r\n\r\n\t}\r\n\r\n\t\u0026.interact {\r\n\t\ttransition: all 0.1s ease-out;\r\n\t\ttransform: scale(0.98);\r\n\t}\r\n}"},{"Ident":"guusconl.simple_interactions_demo","Path":"UI/InteractionPanel.razor","FileName":"InteractionPanel.razor","PackageType":"game","CodeKind":"Game","AssetVersionId":367401,"IsPrivate":false,"Code":"@using Sandbox;\r\n@using Sandbox.UI;\r\n@using System.Threading.Tasks;\r\n@inherits PanelComponent\r\n@namespace Sandbox\r\n\r\n\u003Croot class=\u0022@(IsInteracting ? \u0022interact\u0022 : \u0022\u0022)\u0022 \u003E\r\n\t\t\r\n\t\u003C!-- times 90 and plus 10 so that there is a minimal width. Otherwise the rounding doesn\u0027t play nice --\u003E\r\n\t\u003Cdiv class=\u0022ProgressBar\u0022 style=\u0022\r\n\twidth:@(ProgressionHold * 90 \u002B 10)%;  \r\n\t@(ProgressionHold \u003E 0 ? \u0022opacity: 1;\u0022 : \u0022opacity: 0;\u0022)\r\n\t\u0022\u003E\u003C/div\u003E\r\n\r\n\t\t\u003Cdiv class=\u0022Left\u0022\u003E \r\n\t\t\t\u003CImage class=\u0022InteractionGlyph\u0022 Texture=@InputTexture/\u003E\r\n\t\t\t@if (IsHoldInteraction)\r\n\t\t\t{\r\n\t\t\t\t\u003Cdiv class=\u0022InteractionHold\u0022\u003E Hold \u003C/div\u003E\r\n\t\t\t}\r\n\t\t\u003C/div\u003E\r\n\r\n\t\t\u003Cdiv class=\u0022Right\u0022\u003E \r\n\t\t\t\u003Cdiv class=\u0022InteractionTitle\u0022\u003E @InteractionString \u003C/div\u003E\r\n\t\t\u003C/div\u003E\r\n\r\n\u003C/root\u003E\r\n\r\n@code\r\n{\r\n\r\n\tprivate Texture InputTexture;\r\n\tpublic string InteractionString {get; set;}\r\n\tprivate bool IsInteracting = false;\r\n\tpublic bool IsHoldInteraction = false;\r\n\tpublic float ProgressionHold = 0;\r\n\r\n\r\n\t/// \u003Csummary\u003E\r\n\t/// the hash determines if the system should be rebuilt. If it changes, it will be rebuilt\r\n\t/// \u003C/summary\u003E\r\n\tprotected override int BuildHash() =\u003E System.HashCode.Combine( InputTexture, InteractionString, IsHoldInteraction, ProgressionHold);\r\n\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\tInputTexture = Input.GetGlyph(\u0022use\u0022, InputGlyphSize.Medium, true);\r\n\t}\r\n\r\n\t/// \u003Csummary\u003E\r\n    /// Triggers the interaction animation.\r\n    /// \u003C/summary\u003E\r\n    public async Task TriggerInteractAnimation()\r\n    {\r\n        if (IsInteracting)\r\n            return; // Prevent overlapping animations\r\n\r\n        IsInteracting = true;\r\n        StateHasChanged();\r\n\r\n        // Wait for the animation duration (e.g., 300ms)\r\n        await Task.Delay(100);\r\n\r\n        IsInteracting = false;\r\n        StateHasChanged();\r\n    }\r\n}"},{"Ident":"guusconl.simple_interactions_demo","Path":".obj/__compiler_extra.cs","FileName":"__compiler_extra.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367401,"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, \u0022Simple Interactions Demo\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022AddonIdent\u0022, \u0022simple_interactions_demo\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022OrgIdent\u0022, \u0022guusconl\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022Ident\u0022, \u0022guusconl.simple_interactions_demo\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-04T12:14:18.1758902Z\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyVersion(\u00220.0.113.0\u0022)]\r\n[assembly: global::System.Reflection.AssemblyFileVersion(\u00220.0.113.0\u0022)]"},{"Ident":"guusconl.simple_interactions_demo","Path":"Example5/ExampleFiveInteractionTwo.cs","FileName":"ExampleFiveInteractionTwo.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367401,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class ExampleFiveInteractionTwo : SimpleInteractions.SimpleInteraction\r\n{\r\n\t[Property]\r\n\tpublic GameObject Parent;\r\n\tenum State {\r\n\t\tRED,\r\n\t\tGREEN,\r\n\t\tBLUE\r\n\t}\r\n\r\n\tState state = State.RED;\r\n\tprotected override void OnStart()\r\n\t{\r\n\t\tbase.OnStart();\r\n\r\n\t\t// Put your initialization code here if you have any\r\n\t}\r\n\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\tbase.OnUpdate();\r\n\r\n\t\t// Put your update code here if you have any\r\n\t}\r\n\r\n\r\n\t[Rpc.Broadcast]\r\n\tprotected override void OnInteract()\r\n\t{\r\n\t\tParent.WorldPosition = Parent.WorldPosition \u002B new Vector3(0, 0, 0);\r\n\r\n\t\t\r\n\t\tvar caller = Rpc.Caller.DisplayName;\r\n\t\tLog.Info($\u0022{caller} interacted with {Parent.Name}!\u0022);\r\n\t\t\r\n\r\n\t\tModelRenderer renderer = Parent.GetComponent\u003CModelRenderer\u003E();\r\n\t\tswitch (state)\r\n\t\t{\r\n\t\t\tcase State.RED:\r\n\t\t\t\trenderer.Tint = Color.Green;\r\n\t\t\t\tInteractionString = \u0022Change to Blue\u0022;\r\n\t\t\t\tstate = State.GREEN;\r\n\t\t\t\tbreak;\r\n\t\t\tcase State.GREEN:\r\n\t\t\t\trenderer.Tint = Color.Blue;\r\n\t\t\t\tInteractionString = \u0022Change to Red\u0022;\r\n\t\t\t\tstate = State.BLUE;\r\n\t\t\t\tbreak;\r\n\t\t\tcase State.BLUE:\r\n\t\t\t\trenderer.Tint = Color.Red;\r\n\t\t\t\tInteractionString = \u0022Change to Green\u0022;\r\n\t\t\t\tstate = State.RED;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"guusconl.simple_interactions_demo","Path":"ExampleOneInteraction.cs","FileName":"ExampleOneInteraction.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":367401,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class ExampleOneInteraction : SimpleInteractions.SimpleInteraction\r\n{\r\n\t[Rpc.Broadcast]\r\n\tprotected override void OnInteract()\r\n\t{\r\n\t\tthis.GameObject.WorldPosition = this.GameObject.WorldPosition \u002B new Vector3(0, 0, 10);\r\n\t\tthis.GameObject.GetComponent\u003CRigidbody\u003E().Sleeping = false;\r\n\t}\r\n}\r\n"}]}