43 lines
1.5 KiB
C#
43 lines
1.5 KiB
C#
using System;
|
|
using Dreamteck.Splines;
|
|
using Ichni.RhythmGame.Beatmap;
|
|
using UnityEngine;
|
|
|
|
namespace Ichni.RhythmGame
|
|
{
|
|
public class TrackRendererSubmoduleSurface : TrackRendererSubmodule
|
|
{
|
|
#region [引擎组件] Components
|
|
public SurfaceGenerator surface;
|
|
#endregion
|
|
|
|
#region [初始化] Initialization
|
|
public TrackRendererSubmoduleSurface(Track track, bool enableEmission, float emissionIntensity,
|
|
bool zWrite, Vector2 uvScale, Vector2 uvOffset, Material material = null) :
|
|
base(track, enableEmission, emissionIntensity, zWrite, uvScale, uvOffset)
|
|
{
|
|
this.surface = track.trackRenderer.AddComponent<SurfaceGenerator>();
|
|
this.meshRenderer = surface.GetComponent<MeshRenderer>();
|
|
this.meshGenerator = surface;
|
|
|
|
this.surface.enabled = true;
|
|
|
|
this.renderMaterial = material == null ? GameManager.Instance.basePrefabs.defaultTrackMaterial : material;
|
|
this.surface.spline = track.trackPathSubmodule.path;
|
|
this.surface.doubleSided = true;
|
|
this.surface.clipFrom = 0;
|
|
this.surface.clipTo = 1;
|
|
this.surface.updateMethod = SplineUser.UpdateMethod.Update;
|
|
this.meshRenderer.material = renderMaterial;
|
|
this.surface.color = Color.white;
|
|
this.surface.uvRotation = 90;
|
|
this.surface.uvMode = MeshGenerator.UVMode.UniformClip;
|
|
|
|
SetMesh();
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|