CrateEscape

This commit is contained in:
Ali Sharoz 2025-07-23 22:07:51 +05:00
parent f82dfa30d0
commit 632cd870eb
18 changed files with 5762 additions and 1110 deletions

View File

@ -0,0 +1,61 @@
Shader "Custom/EmissiveLaser"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Color("Tint Color", Color) = (1, 0, 0, 1)
_Emission("Emission Strength", Float) = 5.0
_ScrollSpeed("Scroll Speed", Float) = 1.0
}
SubShader
{
Tags { "Queue"="Transparent" "RenderType"="Transparent" }
LOD 100
Blend One One // Additive blending
ZWrite Off
Cull Off
Lighting Off
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 _Color;
float _Emission;
float _ScrollSpeed;
float4 _MainTex_ST;
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
v2f vert(appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
float scroll = _Time.y * _ScrollSpeed;
o.uv = TRANSFORM_TEX(v.uv, _MainTex) + float2(scroll, 0);
return o;
}
fixed4 frag(v2f i) : SV_Target
{
fixed4 tex = tex2D(_MainTex, i.uv);
return tex * _Color * _Emission;
}
ENDCG
}
}
}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 69d193eb1566e62409de769d5c16fef2
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

86
Assets/LaserBeam.cs Normal file
View File

@ -0,0 +1,86 @@
using UnityEngine;
[ExecuteAlways]
[RequireComponent(typeof(LineRenderer))]
public class LaserBeam : MonoBehaviour
{
[Header("Laser Settings")]
public float maxDistance = 20f;
public LayerMask collisionMask = ~0;
[Header("Laser Appearance")]
public Color laserColor = Color.red;
public float laserWidth = 0.05f;
public float emissionStrength = 5f;
public float scrollSpeed = 1f;
private LineRenderer line;
void Reset()
{
SetupLaserRenderer();
}
void Awake()
{
SetupLaserRenderer();
}
void Update()
{
if (!line) return;
Vector3 start = transform.position;
Vector3 direction = transform.forward;
RaycastHit hit;
Vector3 end;
if (Physics.Raycast(start, direction, out hit, maxDistance, collisionMask))
{
end = hit.point;
}
else
{
end = start + direction * maxDistance;
}
line.SetPosition(0, start);
line.SetPosition(1, end);
}
[ContextMenu("Setup Laser Renderer")]
public void SetupLaserRenderer()
{
line = GetComponent<LineRenderer>();
if (line == null)
line = gameObject.AddComponent<LineRenderer>();
line.positionCount = 2;
line.useWorldSpace = true;
line.loop = false;
line.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
line.receiveShadows = false;
line.widthMultiplier = laserWidth;
// Try to load the custom shader
Shader laserShader = Shader.Find("Custom/EmissiveLaser");
if (laserShader != null)
{
Material laserMat = new Material(laserShader);
laserMat.SetColor("_Color", laserColor);
laserMat.SetFloat("_Emission", emissionStrength);
laserMat.SetFloat("_ScrollSpeed", scrollSpeed);
line.material = laserMat;
}
else
{
Debug.LogWarning("Custom/EmissiveLaser shader not found. Using fallback material.");
line.material = new Material(Shader.Find("Sprites/Default"));
line.material.color = laserColor;
}
line.startColor = laserColor;
line.endColor = laserColor;
}
}

11
Assets/LaserBeam.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fb66dc0e33e58d7439c1db6e435dcc9e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

36
Assets/LaserMaterial.mat Normal file
View File

@ -0,0 +1,36 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: LaserMaterial
m_Shader: {fileID: 4800000, guid: 69d193eb1566e62409de769d5c16fef2, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _Emission: 5
- _ScrollSpeed: 1
m_Colors:
- _Color: {r: 1, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 432a40cdee150514090d93f8597b33b1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,14 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!134 &13400000
PhysicMaterial:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: New Physic Material
dynamicFriction: 0
staticFriction: 0
bounciness: 0
frictionCombine: 2
bounceCombine: 2

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3ed3f30019378ef43b87264bdad42572
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 13400000
userData:
assetBundleName:
assetBundleVariant:

135
Assets/Prefabs/Cube.prefab Normal file
View File

@ -0,0 +1,135 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1795257177676675713
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4609531564359490383}
- component: {fileID: 6556287578786742908}
- component: {fileID: 1126727535585640801}
- component: {fileID: 7719113731434811959}
- component: {fileID: 2286734968485308169}
m_Layer: 0
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4609531564359490383
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1795257177676675713}
serializedVersion: 2
m_LocalRotation: {x: 0.0000000011761361, y: 5.830849e-16, z: -0.00000000215054, w: 1}
m_LocalPosition: {x: 25.518, y: 0.49999997, z: -3.806}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &6556287578786742908
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1795257177676675713}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1126727535585640801
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1795257177676675713}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: db9d40547e5513e429e10319b9185cbe, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!65 &7719113731434811959
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1795257177676675713}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!54 &2286734968485308169
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1795257177676675713}
serializedVersion: 4
m_Mass: 1
m_Drag: 10
m_AngularDrag: 10
m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1}
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_ImplicitCom: 1
m_ImplicitTensor: 1
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 112
m_CollisionDetection: 0

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4f5ab229ffc5a4c43a0c09a9c3ed107d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4db0e418c0b7a174ba18059f8a3d0fdf
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: af5c5d2a2d201e24f8c4913ae531addf
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,84 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: GridBox
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 10, y: 10}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 129bf168ed4ce654cb29ce9cdc0f16b6, type: 3}
m_Scale: {x: 10, y: 10}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 0.5
- _Glossiness: 0.3
- _GlossyReflections: 1
- _Metallic: 0.2
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 1
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.24705884, g: 0.4784314, b: 0.6745098, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b57931f8be32b4f489edfafd2cd503e2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -44,6 +44,7 @@ namespace MenteBacata.ScivoloCharacterController
private Quaternion _rotation;
private CapsuleCollider capsuleCollider;
private BoxCollider boxCollider;
private LayerMask collisionMask;
@ -272,9 +273,11 @@ namespace MenteBacata.ScivoloCharacterController
{
capsuleCollider = gameObject.AddComponent<CapsuleCollider>();
SetColliderProperties();
boxCollider = gameObject.GetComponent<BoxCollider>();
Rigidbody = gameObject.AddComponent<Rigidbody>();
Rigidbody.isKinematic = true;
capsuleCollider.enabled = false;
boxCollider.enabled = true;
}
private void ValidateHeight()