VO Bay Vista cut scene
This commit is contained in:
35
Assets/ThirdParty/NatureManufacture Assets/Spline System/Scripts/Editor/RamSaveMeshEditor.cs
vendored
Normal file
35
Assets/ThirdParty/NatureManufacture Assets/Spline System/Scripts/Editor/RamSaveMeshEditor.cs
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System.IO;
|
||||
|
||||
public class RamSaveMeshEditor : MonoBehaviour
|
||||
{
|
||||
[MenuItem("Tools/Nature Manufacture/Save Selected RAM Mesh")]
|
||||
public static void SaveSelectedMesh()
|
||||
{
|
||||
GameObject selected = Selection.activeGameObject;
|
||||
if (!selected)
|
||||
{
|
||||
Debug.LogWarning("Select a RAM spline GameObject with MeshFilter first.");
|
||||
return;
|
||||
}
|
||||
|
||||
MeshFilter mf = selected.GetComponent<MeshFilter>();
|
||||
if (!mf || !mf.sharedMesh)
|
||||
{
|
||||
Debug.LogWarning("Selected object doesn't have a valid mesh.");
|
||||
return;
|
||||
}
|
||||
|
||||
Mesh meshToSave = Object.Instantiate(mf.sharedMesh);
|
||||
string path = "Assets/SavedRiverMesh_" + selected.name + ".asset";
|
||||
|
||||
AssetDatabase.CreateAsset(meshToSave, path);
|
||||
AssetDatabase.SaveAssets();
|
||||
mf.sharedMesh = meshToSave;
|
||||
|
||||
Debug.Log("Saved mesh to: " + path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97262377ebc53af479e94059d52cc370
|
||||
47
Assets/ThirdParty/NatureManufacture Assets/Spline System/Scripts/RiverColorChanger.cs
vendored
Normal file
47
Assets/ThirdParty/NatureManufacture Assets/Spline System/Scripts/RiverColorChanger.cs
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class RiverColorChanger : MonoBehaviour
|
||||
{
|
||||
public Color colorInBox = Color.red;
|
||||
public Color colorOutside = Color.white;
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
RamSpline spline = other.GetComponent<RamSpline>();
|
||||
if (spline != null)
|
||||
{
|
||||
ChangeVertexColors(spline, colorInBox);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
RamSpline spline = other.GetComponent<RamSpline>();
|
||||
if (spline != null)
|
||||
{
|
||||
ChangeVertexColors(spline, colorOutside);
|
||||
}
|
||||
}
|
||||
|
||||
void ChangeVertexColors(RamSpline spline, Color newColor)
|
||||
{
|
||||
MeshFilter mf = spline.GetComponent<MeshFilter>();
|
||||
if (mf == null || mf.mesh == null)
|
||||
return;
|
||||
|
||||
Mesh mesh = mf.mesh;
|
||||
Color[] colors = mesh.colors;
|
||||
|
||||
if (colors == null || colors.Length == 0)
|
||||
{
|
||||
colors = new Color[mesh.vertexCount];
|
||||
}
|
||||
|
||||
for (int i = 0; i < colors.Length; i++)
|
||||
{
|
||||
colors[i] = newColor;
|
||||
}
|
||||
|
||||
mesh.colors = colors;
|
||||
}
|
||||
}
|
||||
2
Assets/ThirdParty/NatureManufacture Assets/Spline System/Scripts/RiverColorChanger.cs.meta
vendored
Normal file
2
Assets/ThirdParty/NatureManufacture Assets/Spline System/Scripts/RiverColorChanger.cs.meta
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83f7674e134927245852c8a42ba5ed08
|
||||
54
Assets/ThirdParty/NatureManufacture Assets/Spline System/Scripts/RiverColorVolume.cs
vendored
Normal file
54
Assets/ThirdParty/NatureManufacture Assets/Spline System/Scripts/RiverColorVolume.cs
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(BoxCollider))]
|
||||
public class RiverColorVolume : MonoBehaviour
|
||||
{
|
||||
public MeshRenderer riverRenderer;
|
||||
|
||||
public Color shallowColor = Color.red;
|
||||
public Color deepColor = Color.blue;
|
||||
|
||||
public Color originalShallowColor = Color.white;
|
||||
public Color originalDeepColor = Color.white;
|
||||
|
||||
private Material runtimeMaterial;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
BoxCollider box = GetComponent<BoxCollider>();
|
||||
box.isTrigger = true;
|
||||
|
||||
if (riverRenderer != null)
|
||||
{
|
||||
runtimeMaterial = riverRenderer.material;
|
||||
|
||||
Debug.Log(">> Zainicjalizowano material rzeki");
|
||||
Debug.Log(">> Początkowy _ShallowColor: " + runtimeMaterial.GetColor("_ShallowColor"));
|
||||
Debug.Log(">> Początkowy _DeepColor: " + runtimeMaterial.GetColor("_DeepColor"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("❌ Nie przypisano riverRenderer!");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.gameObject == riverRenderer.gameObject && runtimeMaterial != null)
|
||||
{
|
||||
Debug.Log("✅ OnTriggerEnter: zmieniam kolory na czerwony/niebieski");
|
||||
runtimeMaterial.SetColor("_ShallowColor", shallowColor);
|
||||
runtimeMaterial.SetColor("_DeepColor", deepColor);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (other.gameObject == riverRenderer.gameObject && runtimeMaterial != null)
|
||||
{
|
||||
Debug.Log("⏹️ OnTriggerExit: przywracam oryginalne kolory");
|
||||
runtimeMaterial.SetColor("_ShallowColor", originalShallowColor);
|
||||
runtimeMaterial.SetColor("_DeepColor", originalDeepColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/ThirdParty/NatureManufacture Assets/Spline System/Scripts/RiverColorVolume.cs.meta
vendored
Normal file
2
Assets/ThirdParty/NatureManufacture Assets/Spline System/Scripts/RiverColorVolume.cs.meta
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28996bc60f7173c4facfde388c38b1ca
|
||||
Reference in New Issue
Block a user