adjustments on visual levels
This commit is contained in:
parent
575cef61a9
commit
3c44aaf2bd
14
Assets/# Prototype/Scripts/FloorDetection.cs
Normal file
14
Assets/# Prototype/Scripts/FloorDetection.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using Intrepid.Utilities;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace __Prototype.Scripts
|
||||||
|
{
|
||||||
|
public class FloorDetection : MonoBehaviour
|
||||||
|
{
|
||||||
|
[GroupConfigurations, SerializeField] private float offset;
|
||||||
|
[GroupInjections, SerializeField] private Transform heightReference;
|
||||||
|
|
||||||
|
[GroupDebug, ShowInInspector, ReadOnly] public float CurrentFloorHeight => heightReference.position.y - offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Assets/# Prototype/Scripts/FloorDetection.cs.meta
Normal file
3
Assets/# Prototype/Scripts/FloorDetection.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d62db5ebb0c7495085bd37c9484370f4
|
||||||
|
timeCreated: 1781757919
|
||||||
95
Assets/# Prototype/Scripts/FloorManager.cs
Normal file
95
Assets/# Prototype/Scripts/FloorManager.cs
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Intrepid.Utilities;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace __Prototype.Scripts
|
||||||
|
{
|
||||||
|
public class FloorManager : SingletonMonoBehaviour<FloorManager>
|
||||||
|
{
|
||||||
|
private const float DisabledUpperThreshold = 1_000_000f;
|
||||||
|
private const float DisabledUpperMax = 1_000_001f;
|
||||||
|
|
||||||
|
private const float DisabledLowerThreshold = -1_000_000f;
|
||||||
|
private const float DisabledLowerMin = -1_000_001f;
|
||||||
|
|
||||||
|
[GroupInjections, SerializeField] private FloorDetection floorDetection;
|
||||||
|
|
||||||
|
[GroupConfigurations("Upper Fade"), SerializeField] private float upperMax = 5.75f;
|
||||||
|
[GroupConfigurations("Upper Fade"), SerializeField] private float upperThreshold = 3f;
|
||||||
|
|
||||||
|
[GroupConfigurations("Lower Tint"), SerializeField] private float lowerThreshold = -3f;
|
||||||
|
[GroupConfigurations("Lower Tint"), SerializeField] private float lowerMin = -6f;
|
||||||
|
|
||||||
|
[GroupConfigurations("Lower Tint"), SerializeField] private Color lowerTintColor = new(0.35f, 0.35f, 0.35f, 1f);
|
||||||
|
|
||||||
|
private List<FloorVisualGroup> FloorVisualGroups { get; } = new();
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
SingletonInstantiation(false, manager =>
|
||||||
|
{
|
||||||
|
manager.DetectFloorVisualGroups();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
ApplyVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
ApplyVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyVisibility()
|
||||||
|
{
|
||||||
|
var request = CreateVisibilityRequest();
|
||||||
|
foreach (var floorVisualGroup in FloorVisualGroups)
|
||||||
|
{
|
||||||
|
if (floorVisualGroup.IsNull()) continue;
|
||||||
|
floorVisualGroup.SetVisibility(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[GroupDebug, Button(ButtonSizes.Medium)]
|
||||||
|
private void DetectFloorVisualGroups()
|
||||||
|
{
|
||||||
|
FloorVisualGroups.Clear();
|
||||||
|
FloorVisualGroups.AddRange(GetComponentsInChildren<FloorVisualGroup>(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
private VisibilityRequest CreateVisibilityRequest()
|
||||||
|
{
|
||||||
|
if (floorDetection.IsNull())
|
||||||
|
{
|
||||||
|
return new VisibilityRequest
|
||||||
|
{
|
||||||
|
VisibilityOriginY = 0,
|
||||||
|
|
||||||
|
// These values make the shader never enter upper fade.
|
||||||
|
UpperThreshold = DisabledUpperThreshold,
|
||||||
|
UpperMax = DisabledUpperMax,
|
||||||
|
|
||||||
|
// These values make the shader never enter lower tint.
|
||||||
|
LowerThreshold = DisabledLowerThreshold,
|
||||||
|
LowerMin = DisabledLowerMin,
|
||||||
|
|
||||||
|
LowerTintColor = Color.white,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return new VisibilityRequest
|
||||||
|
{
|
||||||
|
VisibilityOriginY = floorDetection.CurrentFloorHeight,
|
||||||
|
UpperThreshold = upperThreshold,
|
||||||
|
UpperMax = upperMax,
|
||||||
|
LowerThreshold = lowerThreshold,
|
||||||
|
LowerMin = lowerMin,
|
||||||
|
LowerTintColor = lowerTintColor,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Assets/# Prototype/Scripts/FloorManager.cs.meta
Normal file
3
Assets/# Prototype/Scripts/FloorManager.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 701d5f1af3ff45c8a1c270d3210c306a
|
||||||
|
timeCreated: 1781706921
|
||||||
69
Assets/# Prototype/Scripts/FloorVisualGroup.cs
Normal file
69
Assets/# Prototype/Scripts/FloorVisualGroup.cs
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Intrepid.Utilities;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace __Prototype.Scripts
|
||||||
|
{
|
||||||
|
public struct VisibilityRequest
|
||||||
|
{
|
||||||
|
public float VisibilityOriginY { get; set; }
|
||||||
|
public float UpperThreshold { get; set; }
|
||||||
|
public float UpperMax { get; set; }
|
||||||
|
public float LowerThreshold { get; set; }
|
||||||
|
public float LowerMin { get; set; }
|
||||||
|
public Color LowerTintColor { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class FloorVisualGroup : MonoBehaviour
|
||||||
|
{
|
||||||
|
private static readonly int VisibilityOriginYId = Shader.PropertyToID("_VisibilityOriginY");
|
||||||
|
private static readonly int UpperThresholdId = Shader.PropertyToID("_UpperThreshold");
|
||||||
|
private static readonly int UpperMaxId = Shader.PropertyToID("_UpperMax");
|
||||||
|
private static readonly int LowerThresholdId = Shader.PropertyToID("_LowerThreshold");
|
||||||
|
private static readonly int LowerMinId = Shader.PropertyToID("_LowerMin");
|
||||||
|
private static readonly int LowerTintColorId = Shader.PropertyToID("_LowerTintColor");
|
||||||
|
|
||||||
|
[GroupInjections, SerializeField] private List<Renderer> meshRenderers = new();
|
||||||
|
|
||||||
|
private MaterialPropertyBlock Block { get; set; }
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
Block = new MaterialPropertyBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
[GroupDebug, Button(ButtonSizes.Medium)]
|
||||||
|
private void Detect()
|
||||||
|
{
|
||||||
|
meshRenderers.Clear();
|
||||||
|
|
||||||
|
var rendererArray = GetComponentsInChildren<Renderer>(true);
|
||||||
|
|
||||||
|
if (rendererArray.Length > 0)
|
||||||
|
{
|
||||||
|
meshRenderers.AddRange(rendererArray);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetVisibility(VisibilityRequest request)
|
||||||
|
{
|
||||||
|
foreach (var meshRenderer in meshRenderers)
|
||||||
|
{
|
||||||
|
if (meshRenderer.IsNull()) continue;
|
||||||
|
|
||||||
|
meshRenderer.GetPropertyBlock(Block);
|
||||||
|
|
||||||
|
Block.SetFloat(VisibilityOriginYId, request.VisibilityOriginY);
|
||||||
|
Block.SetFloat(UpperThresholdId, request.UpperThreshold);
|
||||||
|
Block.SetFloat(UpperMaxId, request.UpperMax);
|
||||||
|
Block.SetFloat(LowerThresholdId, request.LowerThreshold);
|
||||||
|
Block.SetFloat(LowerMinId, request.LowerMin);
|
||||||
|
Block.SetColor(LowerTintColorId, request.LowerTintColor);
|
||||||
|
|
||||||
|
meshRenderer.SetPropertyBlock(Block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Assets/# Prototype/Scripts/FloorVisualGroup.cs.meta
Normal file
3
Assets/# Prototype/Scripts/FloorVisualGroup.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4b658634c0194812b40550f65f5d20f2
|
||||||
|
timeCreated: 1781702512
|
||||||
46
Assets/# Prototype/Shaders/FloorDither.hlsl
Normal file
46
Assets/# Prototype/Shaders/FloorDither.hlsl
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#ifndef FLOOR_DITHER_INCLUDED
|
||||||
|
#define FLOOR_DITHER_INCLUDED
|
||||||
|
|
||||||
|
void FloorDither_float(
|
||||||
|
float2 screen_uv,
|
||||||
|
out float threshold)
|
||||||
|
{
|
||||||
|
float2 pixel = floor(screen_uv * _ScreenParams.xy);
|
||||||
|
|
||||||
|
float x = fmod(pixel.x, 4.0);
|
||||||
|
float y = fmod(pixel.y, 4.0);
|
||||||
|
|
||||||
|
float index = x + y * 4.0;
|
||||||
|
|
||||||
|
float bayer = 0.0;
|
||||||
|
|
||||||
|
if (index < 0.5) bayer = 0.0;
|
||||||
|
else if (index < 1.5) bayer = 8.0;
|
||||||
|
else if (index < 2.5) bayer = 2.0;
|
||||||
|
else if (index < 3.5) bayer = 10.0;
|
||||||
|
else if (index < 4.5) bayer = 12.0;
|
||||||
|
else if (index < 5.5) bayer = 4.0;
|
||||||
|
else if (index < 6.5) bayer = 14.0;
|
||||||
|
else if (index < 7.5) bayer = 6.0;
|
||||||
|
else if (index < 8.5) bayer = 3.0;
|
||||||
|
else if (index < 9.5) bayer = 11.0;
|
||||||
|
else if (index < 10.5) bayer = 1.0;
|
||||||
|
else if (index < 11.5) bayer = 9.0;
|
||||||
|
else if (index < 12.5) bayer = 15.0;
|
||||||
|
else if (index < 13.5) bayer = 7.0;
|
||||||
|
else if (index < 14.5) bayer = 13.0;
|
||||||
|
else bayer = 5.0;
|
||||||
|
|
||||||
|
threshold = (bayer + 0.5) / 16.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FloorDither_half(
|
||||||
|
half2 screen_uv,
|
||||||
|
out half threshold)
|
||||||
|
{
|
||||||
|
float t;
|
||||||
|
FloorDither_float(screen_uv, t);
|
||||||
|
threshold = (half)t;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
3
Assets/# Prototype/Shaders/FloorDither.hlsl.meta
Normal file
3
Assets/# Prototype/Shaders/FloorDither.hlsl.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cf766c9d67774b2a9dd6e396f537e46f
|
||||||
|
timeCreated: 1781763544
|
||||||
87
Assets/# Prototype/Shaders/FloorVisibility.hlsl
Normal file
87
Assets/# Prototype/Shaders/FloorVisibility.hlsl
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
#ifndef FLOOR_VISIBILITY_INCLUDED
|
||||||
|
#define FLOOR_VISIBILITY_INCLUDED
|
||||||
|
|
||||||
|
void FloorVisibility_float(
|
||||||
|
float3 WorldPosition,
|
||||||
|
float VisibilityOriginY,
|
||||||
|
float UpperThreshold,
|
||||||
|
float UpperMax,
|
||||||
|
float LowerThreshold,
|
||||||
|
float LowerMin,
|
||||||
|
float3 LowerTintColor,
|
||||||
|
out float AlphaMultiplier,
|
||||||
|
out float3 TintMultiplier)
|
||||||
|
{
|
||||||
|
float relativeY = WorldPosition.y - VisibilityOriginY;
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// Alpha superior
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// relativeY <= UpperThreshold => alpha 1
|
||||||
|
// relativeY >= UpperMax => alpha 0
|
||||||
|
|
||||||
|
float upperRange = max(UpperMax - UpperThreshold, 0.0001);
|
||||||
|
float upperT = saturate((relativeY - UpperThreshold) / upperRange);
|
||||||
|
// Smoothstep manual.
|
||||||
|
upperT = upperT * upperT * (3.0 - 2.0 * upperT);
|
||||||
|
|
||||||
|
float alphaMultiplier = 1.0 - upperT;
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// Tint inferior
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// LowerThreshold e LowerMin devem ser negativos.
|
||||||
|
//
|
||||||
|
// relativeY >= LowerThreshold => sem tint
|
||||||
|
// relativeY <= LowerMin => tint máximo
|
||||||
|
|
||||||
|
float lowerRange = max(LowerThreshold - LowerMin, 0.0001);
|
||||||
|
float lowerT = saturate((LowerThreshold - relativeY) / lowerRange);
|
||||||
|
|
||||||
|
// Smoothstep manual.
|
||||||
|
lowerT = lowerT * lowerT * (3.0 - 2.0 * lowerT);
|
||||||
|
|
||||||
|
float3 tintMultiplier = lerp(
|
||||||
|
float3(1.0, 1.0, 1.0),
|
||||||
|
LowerTintColor,
|
||||||
|
lowerT
|
||||||
|
);
|
||||||
|
|
||||||
|
AlphaMultiplier = alphaMultiplier;
|
||||||
|
TintMultiplier = tintMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FloorVisibility_half(
|
||||||
|
half3 WorldPosition,
|
||||||
|
half VisibilityOriginY,
|
||||||
|
half UpperThreshold,
|
||||||
|
half UpperMax,
|
||||||
|
half LowerThreshold,
|
||||||
|
half LowerMin,
|
||||||
|
half3 LowerTintColor,
|
||||||
|
out half AlphaMultiplier,
|
||||||
|
out half3 TintMultiplier)
|
||||||
|
{
|
||||||
|
half relativeY = WorldPosition.y - VisibilityOriginY;
|
||||||
|
|
||||||
|
half upperRange = max(UpperMax - UpperThreshold, 0.0001h);
|
||||||
|
half upperT = saturate((relativeY - UpperThreshold) / upperRange);
|
||||||
|
upperT = upperT * upperT * (3.0h - 2.0h * upperT);
|
||||||
|
|
||||||
|
half alphaMultiplier = 1.0h - upperT;
|
||||||
|
|
||||||
|
half lowerRange = max(LowerThreshold - LowerMin, 0.0001h);
|
||||||
|
half lowerT = saturate((LowerThreshold - relativeY) / lowerRange);
|
||||||
|
lowerT = lowerT * lowerT * (3.0h - 2.0h * lowerT);
|
||||||
|
|
||||||
|
half3 tintMultiplier = lerp(
|
||||||
|
half3(1.0h, 1.0h, 1.0h),
|
||||||
|
LowerTintColor,
|
||||||
|
lowerT
|
||||||
|
);
|
||||||
|
|
||||||
|
AlphaMultiplier = alphaMultiplier;
|
||||||
|
TintMultiplier = tintMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
3
Assets/# Prototype/Shaders/FloorVisibility.hlsl.meta
Normal file
3
Assets/# Prototype/Shaders/FloorVisibility.hlsl.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d32d887390aa4988adfa28956c0b736e
|
||||||
|
timeCreated: 1781760364
|
||||||
@ -16,7 +16,7 @@ Material:
|
|||||||
m_LightmapFlags: 2
|
m_LightmapFlags: 2
|
||||||
m_EnableInstancingVariants: 0
|
m_EnableInstancingVariants: 0
|
||||||
m_DoubleSidedGI: 0
|
m_DoubleSidedGI: 0
|
||||||
m_CustomRenderQueue: -1
|
m_CustomRenderQueue: 3000
|
||||||
stringTagMap: {}
|
stringTagMap: {}
|
||||||
disabledShaderPasses:
|
disabledShaderPasses:
|
||||||
- MOTIONVECTORS
|
- MOTIONVECTORS
|
||||||
@ -42,12 +42,21 @@ Material:
|
|||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
m_Ints: []
|
m_Ints: []
|
||||||
m_Floats:
|
m_Floats:
|
||||||
|
- _Alpha: 1
|
||||||
- _Contrast: 1.5
|
- _Contrast: 1.5
|
||||||
|
- _FloorAlpha: 1
|
||||||
|
- _LowerMin: -1000000
|
||||||
|
- _LowerThreshold: -1000000
|
||||||
- _QueueControl: 0
|
- _QueueControl: 0
|
||||||
- _QueueOffset: 0
|
- _QueueOffset: 0
|
||||||
- _SideDarkness: 0.6
|
- _SideDarkness: 0.6
|
||||||
|
- _UpperMax: 1000000
|
||||||
|
- _UpperThreshold: 1000000
|
||||||
|
- _VisibilityOriginY: 0
|
||||||
m_Colors:
|
m_Colors:
|
||||||
- _BaseColor: {r: 0.33333337, g: 0.8784793, b: 1, a: 1}
|
- _BaseColor: {r: 0.3333333, g: 0.8784793, b: 1, a: 1}
|
||||||
|
- _LowerTintColor: {r: 0.16981125, g: 0.16981125, b: 0.16981125, a: 1}
|
||||||
|
- _Tint: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_BuildTextureStacks: []
|
m_BuildTextureStacks: []
|
||||||
m_AllowLocking: 1
|
m_AllowLocking: 1
|
||||||
--- !u!114 &1069900037742449899
|
--- !u!114 &1069900037742449899
|
||||||
|
|||||||
@ -42,12 +42,21 @@ Material:
|
|||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
m_Ints: []
|
m_Ints: []
|
||||||
m_Floats:
|
m_Floats:
|
||||||
|
- _Alpha: 1
|
||||||
- _Contrast: 1.5
|
- _Contrast: 1.5
|
||||||
|
- _FloorAlpha: 1
|
||||||
|
- _LowerMin: -1000000
|
||||||
|
- _LowerThreshold: -1000000
|
||||||
- _QueueControl: 0
|
- _QueueControl: 0
|
||||||
- _QueueOffset: 0
|
- _QueueOffset: 0
|
||||||
- _SideDarkness: 0.6
|
- _SideDarkness: 0.6
|
||||||
|
- _UpperMax: 1000000
|
||||||
|
- _UpperThreshold: 1000000
|
||||||
|
- _VisibilityOriginY: 0
|
||||||
m_Colors:
|
m_Colors:
|
||||||
- _BaseColor: {r: 0.3990299, g: 0.5432971, b: 0.5754717, a: 1}
|
- _BaseColor: {r: 0.3990299, g: 0.5432971, b: 0.5754717, a: 1}
|
||||||
|
- _LowerTintColor: {r: 0.16981125, g: 0.16981125, b: 0.16981125, a: 1}
|
||||||
|
- _Tint: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_BuildTextureStacks: []
|
m_BuildTextureStacks: []
|
||||||
m_AllowLocking: 1
|
m_AllowLocking: 1
|
||||||
--- !u!114 &1069900037742449899
|
--- !u!114 &1069900037742449899
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
4531
Assets/# Prototype/Shaders/SG_TopUnLitSideDark.shadergraph
Normal file
4531
Assets/# Prototype/Shaders/SG_TopUnLitSideDark.shadergraph
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -131,7 +131,8 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Core.Grounding.GroundSurface
|
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Core.Grounding.GroundSurface
|
||||||
boxCollider: {fileID: 6392326082573612157}
|
boxCollider: {fileID: 6392326082573612157}
|
||||||
safe: 1
|
safe: 1
|
||||||
groundProfileMotion: {fileID: 0}
|
motionProfile: {fileID: 0}
|
||||||
|
movementProfiles: []
|
||||||
--- !u!1 &6439449681432079181
|
--- !u!1 &6439449681432079181
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -257,6 +258,7 @@ GameObject:
|
|||||||
- component: {fileID: 8478978465931315779}
|
- component: {fileID: 8478978465931315779}
|
||||||
- component: {fileID: 3628412641931900360}
|
- component: {fileID: 3628412641931900360}
|
||||||
- component: {fileID: 221717111884494654}
|
- component: {fileID: 221717111884494654}
|
||||||
|
- component: {fileID: 6239999603407320206}
|
||||||
m_Layer: 31
|
m_Layer: 31
|
||||||
m_Name: PrototypeMesh
|
m_Name: PrototypeMesh
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -336,3 +338,17 @@ MeshFilter:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 7302436227064528695}
|
m_GameObject: {fileID: 7302436227064528695}
|
||||||
m_Mesh: {fileID: 0}
|
m_Mesh: {fileID: 0}
|
||||||
|
--- !u!114 &6239999603407320206
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7302436227064528695}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 4b658634c0194812b40550f65f5d20f2, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Assembly-CSharp::__Prototype.Scripts.FloorVisualGroup
|
||||||
|
meshRenderers:
|
||||||
|
- {fileID: 3628412641931900360}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ GameObject:
|
|||||||
- component: {fileID: 4089360858264239107}
|
- component: {fileID: 4089360858264239107}
|
||||||
- component: {fileID: 5094209182163755379}
|
- component: {fileID: 5094209182163755379}
|
||||||
- component: {fileID: 6166895172714925370}
|
- component: {fileID: 6166895172714925370}
|
||||||
|
- component: {fileID: 3915984040909972015}
|
||||||
m_Layer: 30
|
m_Layer: 30
|
||||||
m_Name: PrototypeMesh
|
m_Name: PrototypeMesh
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -90,6 +91,20 @@ MeshFilter:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1146391786149679500}
|
m_GameObject: {fileID: 1146391786149679500}
|
||||||
m_Mesh: {fileID: 0}
|
m_Mesh: {fileID: 0}
|
||||||
|
--- !u!114 &3915984040909972015
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1146391786149679500}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 4b658634c0194812b40550f65f5d20f2, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Assembly-CSharp::__Prototype.Scripts.FloorVisualGroup
|
||||||
|
meshRenderers:
|
||||||
|
- {fileID: 5094209182163755379}
|
||||||
--- !u!1 &1846517854702871200
|
--- !u!1 &1846517854702871200
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@ -364,6 +364,7 @@ GameObject:
|
|||||||
- component: {fileID: 8834117376258967636}
|
- component: {fileID: 8834117376258967636}
|
||||||
- component: {fileID: 706111140969832978}
|
- component: {fileID: 706111140969832978}
|
||||||
- component: {fileID: 3934978131188514466}
|
- component: {fileID: 3934978131188514466}
|
||||||
|
- component: {fileID: 2449993904018413455}
|
||||||
m_Layer: 30
|
m_Layer: 30
|
||||||
m_Name: PrototypeMesh
|
m_Name: PrototypeMesh
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -443,3 +444,17 @@ MeshFilter:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 8841023322301212683}
|
m_GameObject: {fileID: 8841023322301212683}
|
||||||
m_Mesh: {fileID: 0}
|
m_Mesh: {fileID: 0}
|
||||||
|
--- !u!114 &2449993904018413455
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8841023322301212683}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 4b658634c0194812b40550f65f5d20f2, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Assembly-CSharp::__Prototype.Scripts.FloorVisualGroup
|
||||||
|
meshRenderers:
|
||||||
|
- {fileID: 706111140969832978}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using __Prototype.Scripts;
|
||||||
using Intrepid.Diagnostics;
|
using Intrepid.Diagnostics;
|
||||||
using Intrepid.Gameplay.Prototyping;
|
using Intrepid.Gameplay.Prototyping;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
@ -19,6 +20,7 @@ namespace Editor.GardensStageEditor.Baker
|
|||||||
{
|
{
|
||||||
public static void BuildStage(StageBuilderRequest request)
|
public static void BuildStage(StageBuilderRequest request)
|
||||||
{
|
{
|
||||||
|
var floorManager = request.Root.AddComponent<FloorManager>();
|
||||||
foreach (var stageFloorDefinition in request.Stage.floors)
|
foreach (var stageFloorDefinition in request.Stage.floors)
|
||||||
{
|
{
|
||||||
var cellsG = new HashSet<Vector2Int>();
|
var cellsG = new HashSet<Vector2Int>();
|
||||||
|
|||||||
@ -16,6 +16,7 @@ namespace Intrepid.Core.Camera
|
|||||||
public sealed class CameraBoundary : MonoBehaviour
|
public sealed class CameraBoundary : MonoBehaviour
|
||||||
{
|
{
|
||||||
[GroupInjections, SerializeField] private BoxCollider boxCollider;
|
[GroupInjections, SerializeField] private BoxCollider boxCollider;
|
||||||
|
[GroupConfigurations, SerializeField] private CameraZoomLevel cameraZoomLevel = CameraZoomLevel.None;
|
||||||
[GroupConfigurations, SerializeField, Min(0f)] private float cameraPadding = 0.5f;
|
[GroupConfigurations, SerializeField, Min(0f)] private float cameraPadding = 0.5f;
|
||||||
[GroupConfigurations, SerializeField, Min(0.1f)] private float triggerHeight = 5f;
|
[GroupConfigurations, SerializeField, Min(0.1f)] private float triggerHeight = 5f;
|
||||||
|
|
||||||
@ -47,7 +48,8 @@ namespace Intrepid.Core.Camera
|
|||||||
{
|
{
|
||||||
Proxy.Instance.EventBus.Raise(new CameraBoundaryEnterEvent
|
Proxy.Instance.EventBus.Raise(new CameraBoundaryEnterEvent
|
||||||
{
|
{
|
||||||
Boundary = this
|
Boundary = this,
|
||||||
|
CameraZoomLevel = cameraZoomLevel,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Intrepid.Core.Camera.Events;
|
using Intrepid.Core.Camera.Events;
|
||||||
|
using Intrepid.GameManagers;
|
||||||
using Intrepid.SimpleEvents;
|
using Intrepid.SimpleEvents;
|
||||||
using Intrepid.Utilities;
|
using Intrepid.Utilities;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -44,11 +45,14 @@ namespace Intrepid.Core.Camera
|
|||||||
|
|
||||||
protected override void Subscriptions()
|
protected override void Subscriptions()
|
||||||
{
|
{
|
||||||
Subscribe<CameraBoundaryEnterEvent>(e => Enter(e.Boundary));
|
Subscribe<CameraBoundaryEnterEvent>(e => Enter(e.Boundary, e.CameraZoomLevel));
|
||||||
Subscribe<CameraBoundaryExitEvent>(e => Exit(e.Boundary));
|
Subscribe<CameraBoundaryExitEvent>(e => Exit(e.Boundary));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Enter(CameraBoundary boundary)
|
private void Enter(
|
||||||
|
CameraBoundary boundary,
|
||||||
|
// for testing...
|
||||||
|
CameraZoomLevel zoomLevel)
|
||||||
{
|
{
|
||||||
if (boundary.IsNull())
|
if (boundary.IsNull())
|
||||||
{
|
{
|
||||||
@ -61,6 +65,11 @@ namespace Intrepid.Core.Camera
|
|||||||
}
|
}
|
||||||
|
|
||||||
activeBoundaries.Add(boundary);
|
activeBoundaries.Add(boundary);
|
||||||
|
// for testing...
|
||||||
|
Proxy.Instance.EventBus.Raise(new CameraZoomEvent
|
||||||
|
{
|
||||||
|
ZoomLevel = zoomLevel,
|
||||||
|
});
|
||||||
|
|
||||||
hasFadingOutBounds = false;
|
hasFadingOutBounds = false;
|
||||||
targetWeight = 1f;
|
targetWeight = 1f;
|
||||||
|
|||||||
@ -5,5 +5,8 @@ namespace Intrepid.Core.Camera.Events
|
|||||||
public class CameraBoundaryEnterEvent : IEventBase
|
public class CameraBoundaryEnterEvent : IEventBase
|
||||||
{
|
{
|
||||||
public CameraBoundary Boundary { get; set; }
|
public CameraBoundary Boundary { get; set; }
|
||||||
|
|
||||||
|
// for testing...
|
||||||
|
public CameraZoomLevel CameraZoomLevel { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -92,6 +92,14 @@ namespace Intrepid.Gameplay.Prototyping
|
|||||||
sizeX,
|
sizeX,
|
||||||
sizeZ);
|
sizeZ);
|
||||||
|
|
||||||
|
// Bottom (face up)
|
||||||
|
AddGridFace(vertices, triangles, uvs,
|
||||||
|
new Vector3(-halfX, -halfY, halfZ),
|
||||||
|
Vector3.right,
|
||||||
|
Vector3.back,
|
||||||
|
sizeX,
|
||||||
|
sizeZ);
|
||||||
|
|
||||||
// Back
|
// Back
|
||||||
AddGridFace(vertices, triangles, uvs,
|
AddGridFace(vertices, triangles, uvs,
|
||||||
new Vector3(halfX, -halfY, -halfZ),
|
new Vector3(halfX, -halfY, -halfZ),
|
||||||
@ -124,5 +132,97 @@ namespace Intrepid.Gameplay.Prototyping
|
|||||||
sizeZ,
|
sizeZ,
|
||||||
sizeY);
|
sizeY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void AddQuadFace(
|
||||||
|
List<Vector3> vertices,
|
||||||
|
List<int> triangles,
|
||||||
|
List<Vector2> uvs,
|
||||||
|
Vector3 origin,
|
||||||
|
Vector3 axisU,
|
||||||
|
Vector3 axisV,
|
||||||
|
Vector2 uv00,
|
||||||
|
Vector2 uv10,
|
||||||
|
Vector2 uv11,
|
||||||
|
Vector2 uv01)
|
||||||
|
{
|
||||||
|
var index = vertices.Count;
|
||||||
|
|
||||||
|
var p00 = origin;
|
||||||
|
var p10 = origin + axisU;
|
||||||
|
var p11 = origin + axisU + axisV;
|
||||||
|
var p01 = origin + axisV;
|
||||||
|
|
||||||
|
vertices.Add(p00);
|
||||||
|
vertices.Add(p10);
|
||||||
|
vertices.Add(p11);
|
||||||
|
vertices.Add(p01);
|
||||||
|
|
||||||
|
triangles.Add(index + 0);
|
||||||
|
triangles.Add(index + 1);
|
||||||
|
triangles.Add(index + 2);
|
||||||
|
triangles.Add(index + 0);
|
||||||
|
triangles.Add(index + 2);
|
||||||
|
triangles.Add(index + 3);
|
||||||
|
|
||||||
|
uvs.Add(uv00);
|
||||||
|
uvs.Add(uv10);
|
||||||
|
uvs.Add(uv11);
|
||||||
|
uvs.Add(uv01);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AddHorizontalCapFace(
|
||||||
|
List<Vector3> vertices,
|
||||||
|
List<int> triangles,
|
||||||
|
List<Vector2> uvs,
|
||||||
|
float y,
|
||||||
|
float halfX,
|
||||||
|
float halfZ,
|
||||||
|
float uvScaleX,
|
||||||
|
float uvScaleZ)
|
||||||
|
{
|
||||||
|
AddQuadFace(
|
||||||
|
vertices,
|
||||||
|
triangles,
|
||||||
|
uvs,
|
||||||
|
new Vector3(-halfX, y, halfZ),
|
||||||
|
Vector3.right * (halfX * 2f),
|
||||||
|
Vector3.back * (halfZ * 2f),
|
||||||
|
new Vector2(0f, 0f),
|
||||||
|
new Vector2(uvScaleX, 0f),
|
||||||
|
new Vector2(uvScaleX, uvScaleZ),
|
||||||
|
new Vector2(0f, uvScaleZ)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AddInternalHorizontalCapFaces(
|
||||||
|
List<Vector3> vertices,
|
||||||
|
List<int> triangles,
|
||||||
|
List<Vector2> uvs,
|
||||||
|
int sizeX,
|
||||||
|
int sizeY,
|
||||||
|
int sizeZ,
|
||||||
|
float halfX,
|
||||||
|
float halfY,
|
||||||
|
float halfZ,
|
||||||
|
int capStep = 1)
|
||||||
|
{
|
||||||
|
capStep = Mathf.Max(1, capStep);
|
||||||
|
|
||||||
|
for (var height = capStep; height < sizeY; height += capStep)
|
||||||
|
{
|
||||||
|
var y = -halfY + height;
|
||||||
|
|
||||||
|
AddHorizontalCapFace(
|
||||||
|
vertices,
|
||||||
|
triangles,
|
||||||
|
uvs,
|
||||||
|
y,
|
||||||
|
halfX,
|
||||||
|
halfZ,
|
||||||
|
sizeX,
|
||||||
|
sizeZ
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,15 +41,61 @@ namespace Intrepid.Gameplay.Prototyping
|
|||||||
offset_y.y = Mathf.Clamp(contact_offset_y.y, 0f, 2f);
|
offset_y.y = Mathf.Clamp(contact_offset_y.y, 0f, 2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// protected override void Generate()
|
||||||
|
// {
|
||||||
|
// var vertices = new List<Vector3>();
|
||||||
|
// var triangles = new List<int>();
|
||||||
|
// var uvs = new List<Vector2>();
|
||||||
|
//
|
||||||
|
// MeshUtils.AddCubeFaces(vertices, triangles, uvs,
|
||||||
|
// sizeX, sizeY, sizeZ,
|
||||||
|
// sizeX * 0.5f, sizeY * 0.5f, sizeZ * 0.5f);
|
||||||
|
//
|
||||||
|
// PrototypeModel.BuildMesh(new MeshData(
|
||||||
|
// vertices.ToArray(),
|
||||||
|
// triangles.ToArray(),
|
||||||
|
// uvs.ToArray()));
|
||||||
|
//
|
||||||
|
// var offsetX = offset_x.x + offset_x.y;
|
||||||
|
// var offsetY = offset_y.x + offset_y.y;
|
||||||
|
// PrototypeModel.BoxCollider.size = new Vector3(sizeX + offsetX, sizeY, sizeZ + offsetY);
|
||||||
|
// PrototypeModel.BoxCollider.center = new Vector3((offset_x.x - offset_x.y) / 2f, 0f, (offset_y.x - offset_y.y) / 2f);
|
||||||
|
// PrototypeModel.transform.localPosition = new Vector3(0f, sizeY / 2f, 0f);
|
||||||
|
// }
|
||||||
|
|
||||||
protected override void Generate()
|
protected override void Generate()
|
||||||
{
|
{
|
||||||
var vertices = new List<Vector3>();
|
var vertices = new List<Vector3>();
|
||||||
var triangles = new List<int>();
|
var triangles = new List<int>();
|
||||||
var uvs = new List<Vector2>();
|
var uvs = new List<Vector2>();
|
||||||
|
|
||||||
MeshUtils.AddCubeFaces(vertices, triangles, uvs,
|
var halfX = sizeX * 0.5f;
|
||||||
sizeX, sizeY, sizeZ,
|
var halfY = sizeY * 0.5f;
|
||||||
sizeX * 0.5f, sizeY * 0.5f, sizeZ * 0.5f);
|
var halfZ = sizeZ * 0.5f;
|
||||||
|
|
||||||
|
MeshUtils.AddCubeFaces(
|
||||||
|
vertices,
|
||||||
|
triangles,
|
||||||
|
uvs,
|
||||||
|
sizeX,
|
||||||
|
sizeY,
|
||||||
|
sizeZ,
|
||||||
|
halfX,
|
||||||
|
halfY,
|
||||||
|
halfZ
|
||||||
|
);
|
||||||
|
|
||||||
|
// MeshUtils.AddInternalHorizontalCapFaces(
|
||||||
|
// vertices,
|
||||||
|
// triangles,
|
||||||
|
// uvs,
|
||||||
|
// sizeX,
|
||||||
|
// sizeY,
|
||||||
|
// sizeZ,
|
||||||
|
// halfX,
|
||||||
|
// halfY,
|
||||||
|
// halfZ
|
||||||
|
// );
|
||||||
|
|
||||||
PrototypeModel.BuildMesh(new MeshData(
|
PrototypeModel.BuildMesh(new MeshData(
|
||||||
vertices.ToArray(),
|
vertices.ToArray(),
|
||||||
@ -58,9 +104,24 @@ namespace Intrepid.Gameplay.Prototyping
|
|||||||
|
|
||||||
var offsetX = offset_x.x + offset_x.y;
|
var offsetX = offset_x.x + offset_x.y;
|
||||||
var offsetY = offset_y.x + offset_y.y;
|
var offsetY = offset_y.x + offset_y.y;
|
||||||
PrototypeModel.BoxCollider.size = new Vector3(sizeX + offsetX, sizeY, sizeZ + offsetY);
|
|
||||||
PrototypeModel.BoxCollider.center = new Vector3((offset_x.x - offset_x.y) / 2f, 0f, (offset_y.x - offset_y.y) / 2f);
|
PrototypeModel.BoxCollider.size = new Vector3(
|
||||||
PrototypeModel.transform.localPosition = new Vector3(0f, sizeY / 2f, 0f);
|
sizeX + offsetX,
|
||||||
|
sizeY,
|
||||||
|
sizeZ + offsetY
|
||||||
|
);
|
||||||
|
|
||||||
|
PrototypeModel.BoxCollider.center = new Vector3(
|
||||||
|
(offset_x.x - offset_x.y) / 2f,
|
||||||
|
0f,
|
||||||
|
(offset_y.x - offset_y.y) / 2f
|
||||||
|
);
|
||||||
|
|
||||||
|
PrototypeModel.transform.localPosition = new Vector3(
|
||||||
|
0f,
|
||||||
|
sizeY / 2f,
|
||||||
|
0f
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -17,7 +17,7 @@ PhysicsManager:
|
|||||||
m_EnableAdaptiveForce: 0
|
m_EnableAdaptiveForce: 0
|
||||||
m_ClothInterCollisionDistance: 0.1
|
m_ClothInterCollisionDistance: 0.1
|
||||||
m_ClothInterCollisionStiffness: 0.2
|
m_ClothInterCollisionStiffness: 0.2
|
||||||
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffdfffff3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdfffff3fdfffff3f
|
||||||
m_SimulationMode: 0
|
m_SimulationMode: 0
|
||||||
m_AutoSyncTransforms: 0
|
m_AutoSyncTransforms: 0
|
||||||
m_ReuseCollisionCallbacks: 1
|
m_ReuseCollisionCallbacks: 1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user