基础内容-7
Trail 完整Note
This commit is contained in:
32
Assets/Scripts/GameElements/Track/Trail.cs
Normal file
32
Assets/Scripts/GameElements/Track/Trail.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class Trail : BaseElement
|
||||
{
|
||||
public TrailRenderer trailRenderer;
|
||||
public Material renderMaterial;
|
||||
|
||||
public float visibleTimeLength;
|
||||
|
||||
public static Trail GenerateElement(string name, Guid id, List<string> tags,
|
||||
BaseElement parentElement, float visibleTimeLength, Material material = null)
|
||||
{
|
||||
Trail trail = Instantiate(EditorManager.instance.basePrefabs.trail).GetComponent<Trail>();
|
||||
trail.trailRenderer = trail.GetComponent<TrailRenderer>();
|
||||
|
||||
trail.Initialize(name, id, tags);
|
||||
trail.renderMaterial = material == null ? EditorManager.instance.basePrefabs.defaultTrailMaterial : material;
|
||||
trail.trailRenderer.material = trail.renderMaterial;
|
||||
trail.visibleTimeLength = visibleTimeLength;
|
||||
trail.SetParent(parentElement);
|
||||
|
||||
trail.transformSubmodule = new TransformSubmodule(trail);
|
||||
|
||||
return trail;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user