s&box Package Code Search
Search C# source code, UI razor templates, shaders, and configs across s&box packages.
link Raw Facepunch API Link: https://public.facepunch.com/sbox/code/search/1/?ident=viper.viperscitzencontroller&take=20
Showing code results for query:
*
(17 total matches found)
Game
library
using Sandbox;
public sealed class CameraMovement : Component
{
[Property] public CharacterController1 Player { get; set; }
[Property] public GameObject Body { get; set; }
[Property] public GameObject Head { get; set; }
[Property] public float Distance { get; set; } = 0f;
[Property] public float Sensitivity { get; set; } = 0.1f;
public bool IsFirstPerson => Distance == 0f;
private CameraComponent Camera;
private ModelRenderer BodyRenderer;
private Vector3 CurrentOffset = Vector3.Zero;
protected override void OnAwake()
{
base.OnAwake();
Camera = Components.Get<CameraComponent>();
BodyRenderer = Body.Components.Get<ModelRenderer>();
}
protected override void OnUpdate()
{
var eyeAngles = Head.Transform.Rotation.Angles();
eyeAngles.pitch += Input.MouseDelta.y * Sensitivity;
eyeAngles.yaw -= Input.MouseDelta.x * Sensitivity;
eyeAngles.roll = 0f;
eyeAngles.pitch = eyeAngles.pitch.Clamp( -89.9f, 89.9f );
Head.Transform.Rotation = eyeAngles.ToRotation();
var targetOffset = Vector3.Zero;
if ( Player.IsCrouching ) targetOffset += Vector3.Down * 35f;
CurrentOffset = Vector3.Lerp( CurrentOffset, targetOffset, Time.Delta * 10f );
if ( Camera is not null )
{
var camPos = Head.Transform.Position + CurrentOffset;
if ( !IsFirstPerson )
{
var camForward = eyeAngles.ToRotation().Forward;
var camTrace = Scene.Trace.Ray( camPos, camPos - (camForward * Distance) )
.WithoutTags( "player", "trigger" )
.Run();
if ( camTrace.Hit )
{
camPos = camTrace.HitPosition + camTrace.Normal;
}
else
{
camPos = camTrace.EndPosition;
}
BodyRenderer.RenderType = ModelRenderer.ShadowRenderType.On;
}
else
{
BodyRenderer.RenderType = ModelRenderer.ShadowRenderType.ShadowsOnly;
}
Log.Info( CurrentOffset );
Camera.Transform.Position = camPos;
Camera.Transform.Rotation = eyeAngles.ToRotation();
}
}
}
Game
library
using Sandbox;
/// <summary>
/// This is a component - in your library!
/// </summary>
[Title( "Viper's Citzen Controller - My Component" )]
public class MyLibraryComponent : Component
{
}
UnitTest
library
global using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class TestInit
{
[AssemblyInitialize]
public static void ClassInitialize( TestContext context )
{
Sandbox.Application.InitUnitTest();
}
}
Game
library
global using Sandbox; global using System.Collections.Generic; global using System.Linq;
Game
library
using Sandbox;
using Sandbox.Citizen;
public sealed class CharacterController1 : Component
{
[Property] public float GroundControl { get; set; } = 4.0f;
[Property] public float AirControl { get; set; } = 0.1f;
[Property] public float MaxForce { get; set; } = 50f;
[Property] public float Speed { get; set; } = 160f;
[Property] public float RunSpeed { get; set; } = 290f;
[Property] public float CrouchSpeed { get; set; } = 90f;
[Property] public float JumpForce { get; set; } = 400f;
[Property] public GameObject Head { get; set; }
[Property] public GameObject Body { get; set; }
public Vector3 WishVelocity { get; set; }
public bool IsCrouching = false;
public bool IsSprinting = false;
public bool canUnCrouch = false;
private CharacterController characterController;
private CitizenAnimationHelper animationHelper;
protected override void OnAwake()
{
base.OnAwake();
characterController = Components.Get<CharacterController>();
animationHelper = Components.Get<CitizenAnimationHelper>();
}
protected override void OnUpdate()
{
base.OnUpdate();
UpdateCrouch();
IsSprinting = Input.Down( "Run" );
RotateBody();
if ( Input.Pressed( "Jump" ) ) Jump();
UpdateAnimations();
}
protected override void OnFixedUpdate()
{
base.OnFixedUpdate();
BuildWishVelocity();
Move();
}
void BuildWishVelocity()
{
WishVelocity = 0;
var rot = Head.Transform.Rotation;
if ( Input.Down( "Forward" ) ) WishVelocity += rot.Forward;
if ( Input.Down( "Backward" ) ) WishVelocity += rot.Backward;
if ( Input.Down( "Left" ) ) WishVelocity += rot.Left;
if ( Input.Down( "Right" ) ) WishVelocity += rot.Right;
WishVelocity = WishVelocity.WithZ( 0 );
if ( !WishVelocity.IsNearZeroLength ) WishVelocity = WishVelocity.Normal;
if ( IsCrouching ) WishVelocity *= CrouchSpeed; // Crouching takes presedence over sprinting
else if ( IsSprinting ) WishVelocity *= RunSpeed; // Sprinting takes presedence over walking
else WishVelocity *= Speed;
}
void Move()
{
// Get gravity from our scene
var gravity = Scene.PhysicsWorld.Gravity;
if ( characterController.IsOnGround )
{
// Apply Friction/Acceleration
characterController.Velocity = characterController.Velocity.WithZ( 0 );
characterController.Accelerate( WishVelocity );
characterController.ApplyFriction( GroundControl );
}
else
{
// Apply Air Control / Gravity
characterController.Velocity += gravity * Time.Delta * 0.5f;
characterController.Accelerate( WishVelocity.ClampLength( MaxForce ) );
characterController.ApplyFriction( AirControl );
}
// Move the character controller
characterController.Move();
// Apply the second half of gravity after movement
if ( !characterController.IsOnGround )
{
characterController.Velocity += gravity * Time.Delta * 0.5f;
}
else
{
characterController.Velocity = characterController.Velocity.WithZ( 0 );
}
}
void RotateBody()
{
if ( Body is null ) return;
var targetAngle = new Angles( 0, Head.Transform.Rotation.Yaw(), 0 ).ToRotation();
float rotateDiffrence = Body.Transform.Rotation.Distance( targetAngle );
if ( rotateDiffrence > 10f || characterController.Velocity.Length > 10f )
{
Body.Transform.Rotation = Rotation.Lerp( Body.Transform.Rotation, targetAngle, Time.Delta * 2f );
}
}
void Jump()
{
if ( !characterController.IsOnGround ) return;
characterController.Punch( Vector3.Up * JumpForce );
animationHelper?.TriggerJump();
}
void UpdateAnimations()
{
if(animationHelper is null) return;
animationHelper.WithWishVelocity( WishVelocity );
animationHelper.WithVelocity( characterController.Velocity );
animationHelper.AimAngle = Head.Transform.Rotation;
animationHelper.IsGrounded = characterController.IsOnGround;
animationHelper.WithLook( Head.Transform.Rotation.Forward, 1f, 0.75f, 0.5f );
animationHelper.MoveStyle = CitizenAnimationHelper.MoveStyles.Run;
animationHelper.DuckLevel = IsCrouching ? 1f : 0f;
}
void UpdateCrouch()
{
if ( characterController is null ) return;
if ( Input.Pressed( "Duck" ) && !IsCrouching)
{
IsCrouching = true;
characterController.Height /= 2f;
}
var duckTrace = characterController.TraceDirection( Vector3.Up * characterController.Height );
if ( duckTrace.Hit )
{
canUnCrouch = false;
}
else {
canUnCrouch = true;
}
if ( Input.Released( "Duck" ) && IsCrouching && canUnCrouch ) //| IsCrouching && !Input.Pressed( "Duck" ) && canUnCrouch
{
IsCrouching = false;
characterController.Height *= 2f;
}
if ( IsCrouching && !Input.Down( "Duck" ) && canUnCrouch )
{
IsCrouching = false;
characterController.Height *= 2f;
}
}
}
Game
library
public sealed class MyComponent : Component
{
[Property] public string StringProperty { get; set; }
protected override void OnUpdate()
{
}
}
Game
library
using Sandbox;
public sealed class StaticClothing : Component
{
[Property] private SkinnedModelRenderer ModelRenderer { get; set; }
[Property] private List<Sandbox.Clothing> ClothingOutfit { get; set; } = new();
protected override void OnStart()
{
var container = new ClothingContainer();
foreach ( Sandbox.Clothing item in ClothingOutfit )
{
container.Toggle( item );
}
container.Apply( ModelRenderer );
}
}
Game
library
using Sandbox;
public sealed class CameraMovement : Component
{
[Property] public CharacterController1 Player { get; set; }
[Property] public GameObject Body { get; set; }
[Property] public GameObject Head { get; set; }
[Property] public float Distance { get; set; } = 0f;
[Property] public float Sensitivity { get; set; } = 0.1f;
public bool IsFirstPerson => Distance == 0f;
private CameraComponent Camera;
private ModelRenderer BodyRenderer;
private Vector3 CurrentOffset = Vector3.Zero;
protected override void OnAwake()
{
base.OnAwake();
Camera = Components.Get<CameraComponent>();
BodyRenderer = Body.Components.Get<ModelRenderer>();
}
protected override void OnUpdate()
{
var eyeAngles = Head.Transform.Rotation.Angles();
eyeAngles.pitch += Input.MouseDelta.y * Sensitivity;
eyeAngles.yaw -= Input.MouseDelta.x * Sensitivity;
eyeAngles.roll = 0f;
eyeAngles.pitch = eyeAngles.pitch.Clamp( -89.9f, 89.9f );
Head.Transform.Rotation = eyeAngles.ToRotation();
var targetOffset = Vector3.Zero;
if ( Player.IsCrouching ) targetOffset += Vector3.Down * 35f;
CurrentOffset = Vector3.Lerp( CurrentOffset, targetOffset, Time.Delta * 10f );
if ( Camera is not null )
{
var camPos = Head.Transform.Position + CurrentOffset;
if ( !IsFirstPerson )
{
var camForward = eyeAngles.ToRotation().Forward;
var camTrace = Scene.Trace.Ray( camPos, camPos - (camForward * Distance) )
.WithoutTags( "player", "trigger" )
.Run();
if ( camTrace.Hit )
{
camPos = camTrace.HitPosition + camTrace.Normal;
}
else
{
camPos = camTrace.EndPosition;
}
BodyRenderer.RenderType = ModelRenderer.ShadowRenderType.On;
}
else
{
BodyRenderer.RenderType = ModelRenderer.ShadowRenderType.ShadowsOnly;
}
Log.Info( CurrentOffset );
Camera.Transform.Position = camPos;
Camera.Transform.Rotation = eyeAngles.ToRotation();
}
}
}
Editor
library
using Editor;
public static class MyEditorMenu
{
[Menu( "Editor", "Viper's Citzen Controller/My Menu Option" )]
public static void OpenMyMenu()
{
EditorUtility.DisplayDialog( "It worked!", "This is being called from your library's editor code!" );
}
}
Game
library
global using static Sandbox.Internal.GlobalGameNamespace;
[assembly: global::System.Reflection.AssemblyMetadata( "AddonTitle", "Viper's Citzen Controller" )]
[assembly: global::System.Reflection.AssemblyMetadata( "AddonIdent", "viperscitzencontroller" )]
[assembly: global::System.Reflection.AssemblyMetadata( "OrgIdent", "viper" )]
[assembly: global::System.Reflection.AssemblyMetadata( "Ident", "viper.viperscitzencontroller" )]
[assembly: global::System.Reflection.AssemblyMetadata( "CompileTime", "9/7/2024 7:03:20 AM" )]
[assembly: global::System.Reflection.AssemblyMetadata( "EngineVersion", "17" )]
[assembly: global::System.Reflection.AssemblyMetadata( "EngineMinorVersion", "1" )]
[assembly: System.Runtime.Versioning.TargetFramework( ".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0" )]
[assembly: global::System.Reflection.AssemblyVersion("0.0.119.0")]
[assembly: global::System.Reflection.AssemblyFileVersion("0.0.119.0")]
Game
library
using Sandbox;
using Sandbox.Citizen;
public sealed class CharacterController1 : Component
{
[Property] public float GroundControl { get; set; } = 4.0f;
[Property] public float AirControl { get; set; } = 0.1f;
[Property] public float MaxForce { get; set; } = 50f;
[Property] public float Speed { get; set; } = 160f;
[Property] public float RunSpeed { get; set; } = 290f;
[Property] public float CrouchSpeed { get; set; } = 90f;
[Property] public float JumpForce { get; set; } = 400f;
[Property] public GameObject Head { get; set; }
[Property] public GameObject Body { get; set; }
public Vector3 WishVelocity { get; set; }
public bool IsCrouching = false;
public bool IsSprinting = false;
public bool canUnCrouch = false;
private CharacterController characterController;
private CitizenAnimationHelper animationHelper;
protected override void OnAwake()
{
base.OnAwake();
characterController = Components.Get<CharacterController>();
animationHelper = Components.Get<CitizenAnimationHelper>();
}
protected override void OnUpdate()
{
base.OnUpdate();
UpdateCrouch();
IsSprinting = Input.Down( "Run" );
RotateBody();
if ( Input.Pressed( "Jump" ) ) Jump();
UpdateAnimations();
}
protected override void OnFixedUpdate()
{
base.OnFixedUpdate();
BuildWishVelocity();
Move();
}
void BuildWishVelocity()
{
WishVelocity = 0;
var rot = Head.Transform.Rotation;
if ( Input.Down( "Forward" ) ) WishVelocity += rot.Forward;
if ( Input.Down( "Backward" ) ) WishVelocity += rot.Backward;
if ( Input.Down( "Left" ) ) WishVelocity += rot.Left;
if ( Input.Down( "Right" ) ) WishVelocity += rot.Right;
WishVelocity = WishVelocity.WithZ( 0 );
if ( !WishVelocity.IsNearZeroLength ) WishVelocity = WishVelocity.Normal;
if ( IsCrouching ) WishVelocity *= CrouchSpeed; // Crouching takes presedence over sprinting
else if ( IsSprinting ) WishVelocity *= RunSpeed; // Sprinting takes presedence over walking
else WishVelocity *= Speed;
}
void Move()
{
// Get gravity from our scene
var gravity = Scene.PhysicsWorld.Gravity;
if ( characterController.IsOnGround )
{
// Apply Friction/Acceleration
characterController.Velocity = characterController.Velocity.WithZ( 0 );
characterController.Accelerate( WishVelocity );
characterController.ApplyFriction( GroundControl );
}
else
{
// Apply Air Control / Gravity
characterController.Velocity += gravity * Time.Delta * 0.5f;
characterController.Accelerate( WishVelocity.ClampLength( MaxForce ) );
characterController.ApplyFriction( AirControl );
}
// Move the character controller
characterController.Move();
// Apply the second half of gravity after movement
if ( !characterController.IsOnGround )
{
characterController.Velocity += gravity * Time.Delta * 0.5f;
}
else
{
characterController.Velocity = characterController.Velocity.WithZ( 0 );
}
}
void RotateBody()
{
if ( Body is null ) return;
var targetAngle = new Angles( 0, Head.Transform.Rotation.Yaw(), 0 ).ToRotation();
float rotateDiffrence = Body.Transform.Rotation.Distance( targetAngle );
if ( rotateDiffrence > 10f || characterController.Velocity.Length > 10f )
{
Body.Transform.Rotation = Rotation.Lerp( Body.Transform.Rotation, targetAngle, Time.Delta * 2f );
}
}
void Jump()
{
if ( !characterController.IsOnGround ) return;
characterController.Punch( Vector3.Up * JumpForce );
animationHelper?.TriggerJump();
}
void UpdateAnimations()
{
if(animationHelper is null) return;
animationHelper.WithWishVelocity( WishVelocity );
animationHelper.WithVelocity( characterController.Velocity );
animationHelper.AimAngle = Head.Transform.Rotation;
animationHelper.IsGrounded = characterController.IsOnGround;
animationHelper.WithLook( Head.Transform.Rotation.Forward, 1f, 0.75f, 0.5f );
animationHelper.MoveStyle = CitizenAnimationHelper.MoveStyles.Run;
animationHelper.DuckLevel = IsCrouching ? 1f : 0f;
}
void UpdateCrouch()
{
if ( characterController is null ) return;
if ( Input.Pressed( "Duck" ) && !IsCrouching)
{
IsCrouching = true;
characterController.Height /= 2f;
}
var duckTrace = characterController.TraceDirection( Vector3.Up * characterController.Height );
if ( duckTrace.Hit )
{
canUnCrouch = false;
}
else {
canUnCrouch = true;
}
if ( Input.Released( "Duck" ) && IsCrouching && canUnCrouch ) //| IsCrouching && !Input.Pressed( "Duck" ) && canUnCrouch
{
IsCrouching = false;
characterController.Height *= 2f;
}
if ( IsCrouching && !Input.Down( "Duck" ) && canUnCrouch )
{
IsCrouching = false;
characterController.Height *= 2f;
}
}
}
Game
library
using Sandbox;
public sealed class StaticClothing : Component
{
[Property] private SkinnedModelRenderer ModelRenderer { get; set; }
[Property] private List<Sandbox.Clothing> ClothingOutfit { get; set; } = new();
protected override void OnStart()
{
var container = new ClothingContainer();
foreach ( Sandbox.Clothing item in ClothingOutfit )
{
container.Toggle( item );
}
container.Apply( ModelRenderer );
}
}
Game
library
public sealed class MyComponent : Component
{
[Property] public string StringProperty { get; set; }
protected override void OnUpdate()
{
}
}
Game
library
global using Sandbox; global using System.Collections.Generic; global using System.Linq;
Game
library
using Sandbox;
/// <summary>
/// This is a component - in your library!
/// </summary>
[Title( "Viper's Citzen Controller - My Component" )]
public class MyLibraryComponent : Component
{
}
Game
library
global using Microsoft.AspNetCore.Components; global using Microsoft.AspNetCore.Components.Rendering;
UnitTest
library
using Sandbox;
[TestClass]
public partial class LibraryTests
{
[TestMethod]
public void SceneTest()
{
var scene = new Scene();
using ( scene.Push() )
{
var go = new GameObject();
Assert.AreEqual( 1, scene.Directory.GameObjectCount );
}
}
}
Debug: View Raw JSON Response
{
"TotalCount": 17,
"Files": [
{
"Ident": "viper.viperscitzencontroller",
"Path": "Components/CameraMovement.cs",
"FileName": "CameraMovement.cs",
"PackageType": "library",
"CodeKind": "Game",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "using Sandbox;\r\n\r\npublic sealed class CameraMovement : Component\r\n{\r\n\t[Property] public CharacterController1 Player { get; set; }\r\n\t[Property] public GameObject Body { get; set; }\r\n\t[Property] public GameObject Head { get; set; }\r\n\t[Property] public float Distance { get; set; } = 0f;\r\n\t[Property] public float Sensitivity { get; set; } = 0.1f;\r\n\tpublic bool IsFirstPerson => Distance == 0f;\r\n\tprivate CameraComponent Camera;\r\n\tprivate ModelRenderer BodyRenderer;\r\n\tprivate Vector3 CurrentOffset = Vector3.Zero;\r\n\tprotected override void OnAwake()\r\n\t{\r\n\t\tbase.OnAwake();\r\n\t\tCamera = Components.Get<CameraComponent>();\r\n\t\tBodyRenderer = Body.Components.Get<ModelRenderer>();\r\n\t}\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\tvar eyeAngles = Head.Transform.Rotation.Angles();\r\n\t\teyeAngles.pitch += Input.MouseDelta.y * Sensitivity;\r\n\t\teyeAngles.yaw -= Input.MouseDelta.x * Sensitivity;\r\n\t\teyeAngles.roll = 0f;\r\n\t\teyeAngles.pitch = eyeAngles.pitch.Clamp( -89.9f, 89.9f );\r\n\t\tHead.Transform.Rotation = eyeAngles.ToRotation();\r\n\t\tvar targetOffset = Vector3.Zero;\r\n\t\tif ( Player.IsCrouching ) targetOffset += Vector3.Down * 35f;\r\n\t\tCurrentOffset = Vector3.Lerp( CurrentOffset, targetOffset, Time.Delta * 10f );\r\n\t\tif ( Camera is not null )\r\n\t\t{\r\n\t\t\tvar camPos = Head.Transform.Position + CurrentOffset;\r\n\t\t\tif ( !IsFirstPerson )\r\n\t\t\t{\r\n\t\t\t\tvar camForward = eyeAngles.ToRotation().Forward;\r\n\t\t\t\tvar camTrace = Scene.Trace.Ray( camPos, camPos - (camForward * Distance) )\r\n\t\t\t\t\t.WithoutTags( \"player\", \"trigger\" )\r\n\t\t\t\t\t.Run();\r\n\t\t\t\tif ( camTrace.Hit )\r\n\t\t\t\t{\r\n\t\t\t\t\tcamPos = camTrace.HitPosition + camTrace.Normal;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tcamPos = camTrace.EndPosition;\r\n\t\t\t\t}\r\n\t\t\t\tBodyRenderer.RenderType = ModelRenderer.ShadowRenderType.On;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tBodyRenderer.RenderType = ModelRenderer.ShadowRenderType.ShadowsOnly;\r\n\t\t\t}\r\n\r\n\r\n\t\t\tLog.Info( CurrentOffset );\r\n\t\t\tCamera.Transform.Position = camPos;\r\n\t\t\tCamera.Transform.Rotation = eyeAngles.ToRotation();\r\n\t\t}\r\n\t}\r\n}\r\n"
},
{
"Ident": "viper.viperscitzencontroller",
"Path": "Code/MyLibraryComponent.cs",
"FileName": "MyLibraryComponent.cs",
"PackageType": "library",
"CodeKind": "Game",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "using Sandbox;\r\n\r\n/// <summary>\r\n/// This is a component - in your library!\r\n/// </summary>\r\n[Title( \"Viper's Citzen Controller - My Component\" )]\r\npublic class MyLibraryComponent : Component\r\n{\r\n\r\n}\r\n"
},
{
"Ident": "viper.viperscitzencontroller",
"Path": "UnitTests/UnitTest.cs",
"FileName": "UnitTest.cs",
"PackageType": "library",
"CodeKind": "UnitTest",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "global using Microsoft.VisualStudio.TestTools.UnitTesting;\r\n\r\n[TestClass]\r\npublic class TestInit\r\n{\r\n\t[AssemblyInitialize]\r\n\tpublic static void ClassInitialize( TestContext context )\r\n\t{\r\n\t\tSandbox.Application.InitUnitTest();\r\n\t}\r\n}\r\n"
},
{
"Ident": "viper.viperscitzencontroller",
"Path": "Code/Assembly.cs",
"FileName": "Assembly.cs",
"PackageType": "library",
"CodeKind": "Game",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "global using Sandbox;\r\nglobal using System.Collections.Generic;\r\nglobal using System.Linq;\r\n"
},
{
"Ident": "viper.viperscitzencontroller",
"Path": "Code/Components/CharctorController.cs",
"FileName": "CharctorController.cs",
"PackageType": "library",
"CodeKind": "Game",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "using Sandbox;\r\nusing Sandbox.Citizen;\r\n\r\n\r\npublic sealed class CharacterController1 : Component\r\n{\r\n\t[Property] public float GroundControl { get; set; } = 4.0f;\r\n\t[Property] public float AirControl { get; set; } = 0.1f;\r\n\t[Property] public float MaxForce { get; set; } = 50f;\r\n\t[Property] public float Speed { get; set; } = 160f;\r\n\t[Property] public float RunSpeed { get; set; } = 290f;\r\n\t[Property] public float CrouchSpeed { get; set; } = 90f;\r\n\t[Property] public float JumpForce { get; set; } = 400f;\r\n\t[Property] public GameObject Head { get; set; }\r\n\t[Property] public GameObject Body { get; set; }\r\n\tpublic Vector3 WishVelocity { get; set; }\r\n\tpublic bool IsCrouching = false;\r\n\tpublic bool IsSprinting = false;\r\n\tpublic bool canUnCrouch = false;\r\n\tprivate CharacterController characterController;\r\n\tprivate CitizenAnimationHelper animationHelper;\r\n\tprotected override void OnAwake()\r\n\t{\r\n\t\tbase.OnAwake();\r\n\t\tcharacterController = Components.Get<CharacterController>();\r\n\t\tanimationHelper = Components.Get<CitizenAnimationHelper>();\r\n\t}\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\tbase.OnUpdate();\r\n\t\tUpdateCrouch();\r\n\t\tIsSprinting = Input.Down( \"Run\" );\r\n\t\tRotateBody();\r\n\t\tif ( Input.Pressed( \"Jump\" ) ) Jump();\r\n\t\tUpdateAnimations();\r\n\t}\r\n\tprotected override void OnFixedUpdate()\r\n\t{\r\n\t\tbase.OnFixedUpdate();\r\n\t\tBuildWishVelocity();\r\n\t\tMove();\r\n\t}\r\n\tvoid BuildWishVelocity()\r\n\t{\r\n\t\tWishVelocity = 0;\r\n\r\n\t\tvar rot = Head.Transform.Rotation;\r\n\t\tif ( Input.Down( \"Forward\" ) ) WishVelocity += rot.Forward;\r\n\t\tif ( Input.Down( \"Backward\" ) ) WishVelocity += rot.Backward;\r\n\t\tif ( Input.Down( \"Left\" ) ) WishVelocity += rot.Left;\r\n\t\tif ( Input.Down( \"Right\" ) ) WishVelocity += rot.Right;\r\n\r\n\t\tWishVelocity = WishVelocity.WithZ( 0 );\r\n\r\n\t\tif ( !WishVelocity.IsNearZeroLength ) WishVelocity = WishVelocity.Normal;\r\n\r\n\t\tif ( IsCrouching ) WishVelocity *= CrouchSpeed; // Crouching takes presedence over sprinting\r\n\t\telse if ( IsSprinting ) WishVelocity *= RunSpeed; // Sprinting takes presedence over walking\r\n\t\telse WishVelocity *= Speed;\r\n\t}\r\n\tvoid Move()\r\n\t{\r\n\t\t// Get gravity from our scene\r\n\t\tvar gravity = Scene.PhysicsWorld.Gravity;\r\n\r\n\t\tif ( characterController.IsOnGround )\r\n\t\t{\r\n\t\t\t// Apply Friction/Acceleration\r\n\t\t\tcharacterController.Velocity = characterController.Velocity.WithZ( 0 );\r\n\t\t\tcharacterController.Accelerate( WishVelocity );\r\n\t\t\tcharacterController.ApplyFriction( GroundControl );\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// Apply Air Control / Gravity\r\n\t\t\tcharacterController.Velocity += gravity * Time.Delta * 0.5f;\r\n\t\t\tcharacterController.Accelerate( WishVelocity.ClampLength( MaxForce ) );\r\n\t\t\tcharacterController.ApplyFriction( AirControl );\r\n\t\t}\r\n\r\n\t\t// Move the character controller\r\n\t\tcharacterController.Move();\r\n\r\n\t\t// Apply the second half of gravity after movement\r\n\t\tif ( !characterController.IsOnGround )\r\n\t\t{\r\n\t\t\tcharacterController.Velocity += gravity * Time.Delta * 0.5f;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tcharacterController.Velocity = characterController.Velocity.WithZ( 0 );\r\n\t\t}\r\n\t}\r\n\tvoid RotateBody()\r\n\t{\r\n\t\tif ( Body is null ) return;\r\n\t\tvar targetAngle = new Angles( 0, Head.Transform.Rotation.Yaw(), 0 ).ToRotation();\r\n\t\tfloat rotateDiffrence = Body.Transform.Rotation.Distance( targetAngle );\r\n\t\tif ( rotateDiffrence > 10f || characterController.Velocity.Length > 10f )\r\n\t\t{\r\n\t\t\tBody.Transform.Rotation = Rotation.Lerp( Body.Transform.Rotation, targetAngle, Time.Delta * 2f );\r\n\t\t}\r\n\t}\r\n\tvoid Jump()\r\n\t{\r\n\t\tif ( !characterController.IsOnGround ) return;\r\n\t\tcharacterController.Punch( Vector3.Up * JumpForce );\r\n\t\tanimationHelper?.TriggerJump();\r\n\t}\r\n\tvoid UpdateAnimations()\r\n\t{ \r\n\t\tif(animationHelper is null) return;\r\n\t\tanimationHelper.WithWishVelocity( WishVelocity );\r\n\t\tanimationHelper.WithVelocity( characterController.Velocity );\r\n\t\tanimationHelper.AimAngle = Head.Transform.Rotation;\r\n\t\tanimationHelper.IsGrounded = characterController.IsOnGround;\r\n\t\tanimationHelper.WithLook( Head.Transform.Rotation.Forward, 1f, 0.75f, 0.5f );\r\n\t\tanimationHelper.MoveStyle = CitizenAnimationHelper.MoveStyles.Run;\r\n\t\tanimationHelper.DuckLevel = IsCrouching ? 1f : 0f;\r\n\r\n\t}\r\n\tvoid UpdateCrouch()\r\n\t{ \r\n\t\tif ( characterController is null ) return;\r\n\r\n\t\tif ( Input.Pressed( \"Duck\" ) && !IsCrouching)\r\n\t\t{ \r\n\t\t\tIsCrouching = true;\r\n\t\t\tcharacterController.Height /= 2f;\r\n\t\t}\r\n\t\tvar duckTrace = characterController.TraceDirection( Vector3.Up * characterController.Height );\r\n\t\tif ( duckTrace.Hit )\r\n\t\t{\r\n\t\t\tcanUnCrouch = false;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tcanUnCrouch = true;\r\n\t\t}\r\n\t\tif ( Input.Released( \"Duck\" ) && IsCrouching && canUnCrouch ) //| IsCrouching && !Input.Pressed( \"Duck\" ) && canUnCrouch \r\n\t\t{ \r\n\t\t\tIsCrouching = false;\r\n\t\t\tcharacterController.Height *= 2f;\r\n\t\t}\r\n\t\tif ( IsCrouching && !Input.Down( \"Duck\" ) && canUnCrouch )\r\n\t\t{\r\n\t\t\tIsCrouching = false;\r\n\t\t\tcharacterController.Height *= 2f;\r\n\t\t}\r\n\t}\r\n}\r\n"
},
{
"Ident": "viper.viperscitzencontroller",
"Path": "Code/MyComponent.cs",
"FileName": "MyComponent.cs",
"PackageType": "library",
"CodeKind": "Game",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "\r\npublic sealed class MyComponent : Component\r\n{\r\n\t[Property] public string StringProperty { get; set; }\r\n\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t}\r\n}\r\n"
},
{
"Ident": "viper.viperscitzencontroller",
"Path": "Code/Components/StaticClothing.cs",
"FileName": "StaticClothing.cs",
"PackageType": "library",
"CodeKind": "Game",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "using Sandbox;\r\n\r\npublic sealed class StaticClothing : Component\r\n{\r\n\t[Property] private SkinnedModelRenderer ModelRenderer { get; set; }\r\n\t[Property] private List<Sandbox.Clothing> ClothingOutfit { get; set; } = new();\r\n\r\n\tprotected override void OnStart()\r\n\t{\r\n\t\tvar container = new ClothingContainer();\r\n\r\n\t\tforeach ( Sandbox.Clothing item in ClothingOutfit )\r\n\t\t{\r\n\t\t\tcontainer.Toggle( item );\r\n\t\t}\r\n\r\n\t\tcontainer.Apply( ModelRenderer );\r\n\t}\r\n}\r\n"
},
{
"Ident": "viper.viperscitzencontroller",
"Path": "Code/Components/CameraMovement.cs",
"FileName": "CameraMovement.cs",
"PackageType": "library",
"CodeKind": "Game",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "using Sandbox;\r\n\r\npublic sealed class CameraMovement : Component\r\n{\r\n\t[Property] public CharacterController1 Player { get; set; }\r\n\t[Property] public GameObject Body { get; set; }\r\n\t[Property] public GameObject Head { get; set; }\r\n\t[Property] public float Distance { get; set; } = 0f;\r\n\t[Property] public float Sensitivity { get; set; } = 0.1f;\r\n\tpublic bool IsFirstPerson => Distance == 0f;\r\n\tprivate CameraComponent Camera;\r\n\tprivate ModelRenderer BodyRenderer;\r\n\tprivate Vector3 CurrentOffset = Vector3.Zero;\r\n\tprotected override void OnAwake()\r\n\t{\r\n\t\tbase.OnAwake();\r\n\t\tCamera = Components.Get<CameraComponent>();\r\n\t\tBodyRenderer = Body.Components.Get<ModelRenderer>();\r\n\t}\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\tvar eyeAngles = Head.Transform.Rotation.Angles();\r\n\t\teyeAngles.pitch += Input.MouseDelta.y * Sensitivity;\r\n\t\teyeAngles.yaw -= Input.MouseDelta.x * Sensitivity;\r\n\t\teyeAngles.roll = 0f;\r\n\t\teyeAngles.pitch = eyeAngles.pitch.Clamp( -89.9f, 89.9f );\r\n\t\tHead.Transform.Rotation = eyeAngles.ToRotation();\r\n\t\tvar targetOffset = Vector3.Zero;\r\n\t\tif ( Player.IsCrouching ) targetOffset += Vector3.Down * 35f;\r\n\t\tCurrentOffset = Vector3.Lerp( CurrentOffset, targetOffset, Time.Delta * 10f );\r\n\t\tif ( Camera is not null )\r\n\t\t{\r\n\t\t\tvar camPos = Head.Transform.Position + CurrentOffset;\r\n\t\t\tif ( !IsFirstPerson )\r\n\t\t\t{\r\n\t\t\t\tvar camForward = eyeAngles.ToRotation().Forward;\r\n\t\t\t\tvar camTrace = Scene.Trace.Ray( camPos, camPos - (camForward * Distance) )\r\n\t\t\t\t\t.WithoutTags( \"player\", \"trigger\" )\r\n\t\t\t\t\t.Run();\r\n\t\t\t\tif ( camTrace.Hit )\r\n\t\t\t\t{\r\n\t\t\t\t\tcamPos = camTrace.HitPosition + camTrace.Normal;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tcamPos = camTrace.EndPosition;\r\n\t\t\t\t}\r\n\t\t\t\tBodyRenderer.RenderType = ModelRenderer.ShadowRenderType.On;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tBodyRenderer.RenderType = ModelRenderer.ShadowRenderType.ShadowsOnly;\r\n\t\t\t}\r\n\r\n\r\n\t\t\tLog.Info( CurrentOffset );\r\n\t\t\tCamera.Transform.Position = camPos;\r\n\t\t\tCamera.Transform.Rotation = eyeAngles.ToRotation();\r\n\t\t}\r\n\t}\r\n}\r\n"
},
{
"Ident": "viper.viperscitzencontroller",
"Path": "Editor/MyEditorMenu.cs",
"FileName": "MyEditorMenu.cs",
"PackageType": "library",
"CodeKind": "Editor",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "using Editor;\r\n\r\npublic static class MyEditorMenu\r\n{\r\n\t[Menu( \"Editor\", \"Viper's Citzen Controller/My Menu Option\" )]\r\n\tpublic static void OpenMyMenu()\r\n\t{\r\n\t\tEditorUtility.DisplayDialog( \"It worked!\", \"This is being called from your library's editor code!\" );\r\n\t}\r\n}\r\n"
},
{
"Ident": "viper.viperscitzencontroller",
"Path": ".obj/__compiler_extra.cs",
"FileName": "__compiler_extra.cs",
"PackageType": "library",
"CodeKind": "Game",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "global using static Sandbox.Internal.GlobalGameNamespace;\r\n[assembly: global::System.Reflection.AssemblyMetadata( \"AddonTitle\", \"Viper's Citzen Controller\" )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \"AddonIdent\", \"viperscitzencontroller\" )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \"OrgIdent\", \"viper\" )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \"Ident\", \"viper.viperscitzencontroller\" )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \"CompileTime\", \"9/7/2024 7:03:20 AM\" )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \"EngineVersion\", \"17\" )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \"EngineMinorVersion\", \"1\" )]\r\n\r\n[assembly: System.Runtime.Versioning.TargetFramework( \".NETCoreApp,Version=v7.0\", FrameworkDisplayName = \".NET 7.0\" )]\r\n[assembly: global::System.Reflection.AssemblyVersion(\"0.0.119.0\")]\r\n[assembly: global::System.Reflection.AssemblyFileVersion(\"0.0.119.0\")]"
},
{
"Ident": "viper.viperscitzencontroller",
"Path": "Components/CharctorController.cs",
"FileName": "CharctorController.cs",
"PackageType": "library",
"CodeKind": "Game",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "using Sandbox;\r\nusing Sandbox.Citizen;\r\n\r\n\r\npublic sealed class CharacterController1 : Component\r\n{\r\n\t[Property] public float GroundControl { get; set; } = 4.0f;\r\n\t[Property] public float AirControl { get; set; } = 0.1f;\r\n\t[Property] public float MaxForce { get; set; } = 50f;\r\n\t[Property] public float Speed { get; set; } = 160f;\r\n\t[Property] public float RunSpeed { get; set; } = 290f;\r\n\t[Property] public float CrouchSpeed { get; set; } = 90f;\r\n\t[Property] public float JumpForce { get; set; } = 400f;\r\n\t[Property] public GameObject Head { get; set; }\r\n\t[Property] public GameObject Body { get; set; }\r\n\tpublic Vector3 WishVelocity { get; set; }\r\n\tpublic bool IsCrouching = false;\r\n\tpublic bool IsSprinting = false;\r\n\tpublic bool canUnCrouch = false;\r\n\tprivate CharacterController characterController;\r\n\tprivate CitizenAnimationHelper animationHelper;\r\n\tprotected override void OnAwake()\r\n\t{\r\n\t\tbase.OnAwake();\r\n\t\tcharacterController = Components.Get<CharacterController>();\r\n\t\tanimationHelper = Components.Get<CitizenAnimationHelper>();\r\n\t}\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\tbase.OnUpdate();\r\n\t\tUpdateCrouch();\r\n\t\tIsSprinting = Input.Down( \"Run\" );\r\n\t\tRotateBody();\r\n\t\tif ( Input.Pressed( \"Jump\" ) ) Jump();\r\n\t\tUpdateAnimations();\r\n\t}\r\n\tprotected override void OnFixedUpdate()\r\n\t{\r\n\t\tbase.OnFixedUpdate();\r\n\t\tBuildWishVelocity();\r\n\t\tMove();\r\n\t}\r\n\tvoid BuildWishVelocity()\r\n\t{\r\n\t\tWishVelocity = 0;\r\n\r\n\t\tvar rot = Head.Transform.Rotation;\r\n\t\tif ( Input.Down( \"Forward\" ) ) WishVelocity += rot.Forward;\r\n\t\tif ( Input.Down( \"Backward\" ) ) WishVelocity += rot.Backward;\r\n\t\tif ( Input.Down( \"Left\" ) ) WishVelocity += rot.Left;\r\n\t\tif ( Input.Down( \"Right\" ) ) WishVelocity += rot.Right;\r\n\r\n\t\tWishVelocity = WishVelocity.WithZ( 0 );\r\n\r\n\t\tif ( !WishVelocity.IsNearZeroLength ) WishVelocity = WishVelocity.Normal;\r\n\r\n\t\tif ( IsCrouching ) WishVelocity *= CrouchSpeed; // Crouching takes presedence over sprinting\r\n\t\telse if ( IsSprinting ) WishVelocity *= RunSpeed; // Sprinting takes presedence over walking\r\n\t\telse WishVelocity *= Speed;\r\n\t}\r\n\tvoid Move()\r\n\t{\r\n\t\t// Get gravity from our scene\r\n\t\tvar gravity = Scene.PhysicsWorld.Gravity;\r\n\r\n\t\tif ( characterController.IsOnGround )\r\n\t\t{\r\n\t\t\t// Apply Friction/Acceleration\r\n\t\t\tcharacterController.Velocity = characterController.Velocity.WithZ( 0 );\r\n\t\t\tcharacterController.Accelerate( WishVelocity );\r\n\t\t\tcharacterController.ApplyFriction( GroundControl );\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// Apply Air Control / Gravity\r\n\t\t\tcharacterController.Velocity += gravity * Time.Delta * 0.5f;\r\n\t\t\tcharacterController.Accelerate( WishVelocity.ClampLength( MaxForce ) );\r\n\t\t\tcharacterController.ApplyFriction( AirControl );\r\n\t\t}\r\n\r\n\t\t// Move the character controller\r\n\t\tcharacterController.Move();\r\n\r\n\t\t// Apply the second half of gravity after movement\r\n\t\tif ( !characterController.IsOnGround )\r\n\t\t{\r\n\t\t\tcharacterController.Velocity += gravity * Time.Delta * 0.5f;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tcharacterController.Velocity = characterController.Velocity.WithZ( 0 );\r\n\t\t}\r\n\t}\r\n\tvoid RotateBody()\r\n\t{\r\n\t\tif ( Body is null ) return;\r\n\t\tvar targetAngle = new Angles( 0, Head.Transform.Rotation.Yaw(), 0 ).ToRotation();\r\n\t\tfloat rotateDiffrence = Body.Transform.Rotation.Distance( targetAngle );\r\n\t\tif ( rotateDiffrence > 10f || characterController.Velocity.Length > 10f )\r\n\t\t{\r\n\t\t\tBody.Transform.Rotation = Rotation.Lerp( Body.Transform.Rotation, targetAngle, Time.Delta * 2f );\r\n\t\t}\r\n\t}\r\n\tvoid Jump()\r\n\t{\r\n\t\tif ( !characterController.IsOnGround ) return;\r\n\t\tcharacterController.Punch( Vector3.Up * JumpForce );\r\n\t\tanimationHelper?.TriggerJump();\r\n\t}\r\n\tvoid UpdateAnimations()\r\n\t{ \r\n\t\tif(animationHelper is null) return;\r\n\t\tanimationHelper.WithWishVelocity( WishVelocity );\r\n\t\tanimationHelper.WithVelocity( characterController.Velocity );\r\n\t\tanimationHelper.AimAngle = Head.Transform.Rotation;\r\n\t\tanimationHelper.IsGrounded = characterController.IsOnGround;\r\n\t\tanimationHelper.WithLook( Head.Transform.Rotation.Forward, 1f, 0.75f, 0.5f );\r\n\t\tanimationHelper.MoveStyle = CitizenAnimationHelper.MoveStyles.Run;\r\n\t\tanimationHelper.DuckLevel = IsCrouching ? 1f : 0f;\r\n\r\n\t}\r\n\tvoid UpdateCrouch()\r\n\t{ \r\n\t\tif ( characterController is null ) return;\r\n\r\n\t\tif ( Input.Pressed( \"Duck\" ) && !IsCrouching)\r\n\t\t{ \r\n\t\t\tIsCrouching = true;\r\n\t\t\tcharacterController.Height /= 2f;\r\n\t\t}\r\n\t\tvar duckTrace = characterController.TraceDirection( Vector3.Up * characterController.Height );\r\n\t\tif ( duckTrace.Hit )\r\n\t\t{\r\n\t\t\tcanUnCrouch = false;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tcanUnCrouch = true;\r\n\t\t}\r\n\t\tif ( Input.Released( \"Duck\" ) && IsCrouching && canUnCrouch ) //| IsCrouching && !Input.Pressed( \"Duck\" ) && canUnCrouch \r\n\t\t{ \r\n\t\t\tIsCrouching = false;\r\n\t\t\tcharacterController.Height *= 2f;\r\n\t\t}\r\n\t\tif ( IsCrouching && !Input.Down( \"Duck\" ) && canUnCrouch )\r\n\t\t{\r\n\t\t\tIsCrouching = false;\r\n\t\t\tcharacterController.Height *= 2f;\r\n\t\t}\r\n\t}\r\n}\r\n"
},
{
"Ident": "viper.viperscitzencontroller",
"Path": "Components/StaticClothing.cs",
"FileName": "StaticClothing.cs",
"PackageType": "library",
"CodeKind": "Game",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "using Sandbox;\r\n\r\npublic sealed class StaticClothing : Component\r\n{\r\n\t[Property] private SkinnedModelRenderer ModelRenderer { get; set; }\r\n\t[Property] private List<Sandbox.Clothing> ClothingOutfit { get; set; } = new();\r\n\r\n\tprotected override void OnStart()\r\n\t{\r\n\t\tvar container = new ClothingContainer();\r\n\r\n\t\tforeach ( Sandbox.Clothing item in ClothingOutfit )\r\n\t\t{\r\n\t\t\tcontainer.Toggle( item );\r\n\t\t}\r\n\r\n\t\tcontainer.Apply( ModelRenderer );\r\n\t}\r\n}\r\n"
},
{
"Ident": "viper.viperscitzencontroller",
"Path": "MyComponent.cs",
"FileName": "MyComponent.cs",
"PackageType": "library",
"CodeKind": "Game",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "\r\npublic sealed class MyComponent : Component\r\n{\r\n\t[Property] public string StringProperty { get; set; }\r\n\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t}\r\n}\r\n"
},
{
"Ident": "viper.viperscitzencontroller",
"Path": "Assembly.cs",
"FileName": "Assembly.cs",
"PackageType": "library",
"CodeKind": "Game",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "global using Sandbox;\r\nglobal using System.Collections.Generic;\r\nglobal using System.Linq;\r\n"
},
{
"Ident": "viper.viperscitzencontroller",
"Path": "MyLibraryComponent.cs",
"FileName": "MyLibraryComponent.cs",
"PackageType": "library",
"CodeKind": "Game",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "using Sandbox;\r\n\r\n/// <summary>\r\n/// This is a component - in your library!\r\n/// </summary>\r\n[Title( \"Viper's Citzen Controller - My Component\" )]\r\npublic class MyLibraryComponent : Component\r\n{\r\n\r\n}\r\n"
},
{
"Ident": "viper.viperscitzencontroller",
"Path": "__gen_RazorNamespace.cs",
"FileName": "__gen_RazorNamespace.cs",
"PackageType": "library",
"CodeKind": "Game",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "global using Microsoft.AspNetCore.Components; \nglobal using Microsoft.AspNetCore.Components.Rendering;\n"
},
{
"Ident": "viper.viperscitzencontroller",
"Path": "UnitTests/LibraryTest.cs",
"FileName": "LibraryTest.cs",
"PackageType": "library",
"CodeKind": "UnitTest",
"AssetVersionId": 72227,
"IsPrivate": false,
"Code": "using Sandbox;\r\n\r\n[TestClass]\r\npublic partial class LibraryTests\r\n{\r\n\t[TestMethod]\r\n\tpublic void SceneTest()\r\n\t{\r\n\t\tvar scene = new Scene();\r\n\t\tusing ( scene.Push() )\r\n\t\t{\r\n\t\t\tvar go = new GameObject();\r\n\r\n\t\t\tAssert.AreEqual( 1, scene.Directory.GameObjectCount );\r\n\t\t}\r\n\t}\r\n\r\n}\r\n"
}
]
}