75 lines
2.5 KiB
C#
75 lines
2.5 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Ichni.RhythmGame
|
|
{
|
|
public partial 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;
|
|
}
|
|
}
|
|
|
|
public partial class Trail
|
|
{
|
|
public override void SaveBM()
|
|
{
|
|
matchedBM = new Beatmap.Trail_BM(elementName, elementGuid, tags, parentElement.matchedBM, visibleTimeLength,
|
|
renderMaterial);
|
|
}
|
|
}
|
|
|
|
namespace Beatmap
|
|
{
|
|
public class Trail_BM : BaseElement_BM
|
|
{
|
|
public float visibleTimeLength;
|
|
public Material renderMaterial;
|
|
|
|
public Trail_BM()
|
|
{
|
|
|
|
}
|
|
|
|
public Trail_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement,
|
|
float visibleTimeLength, Material renderMaterial)
|
|
: base(elementName, elementGuid, tags, attachedElement)
|
|
{
|
|
this.visibleTimeLength = visibleTimeLength;
|
|
this.renderMaterial = renderMaterial;
|
|
}
|
|
|
|
public override void ExecuteBM()
|
|
{
|
|
matchedElement = Trail.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid),
|
|
visibleTimeLength, renderMaterial);
|
|
}
|
|
|
|
public override BaseElement DuplicateBM(BaseElement parent)
|
|
{
|
|
return Trail.GenerateElement(elementName, elementGuid, tags, parent, visibleTimeLength, renderMaterial);
|
|
}
|
|
}
|
|
}
|
|
} |