Files
ichni_Creator_Studio/Assets/Scripts/GameElements/Track/Trail.cs

83 lines
2.9 KiB
C#
Raw Normal View History

2025-02-02 08:34:54 -05:00
using System;
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
2025-02-02 08:34:54 -05:00
using UnityEngine;
namespace Ichni.RhythmGame
{
public partial class Trail : GameElement, IHaveTransformSubmodule
2025-02-02 08:34:54 -05:00
{
public TrailRenderer trailRenderer;
public Material renderMaterial;
public float visibleTimeLength;
2025-02-02 21:59:43 -05:00
public TransformSubmodule transformSubmodule { get; set; }
public static Trail GenerateElement(string name, Guid id, List<string> tags, bool isFirstGenerated,
GameElement parentElement, float visibleTimeLength, Material material = null)
2025-02-02 08:34:54 -05:00
{
Trail trail = Instantiate(EditorManager.instance.basePrefabs.trail).GetComponent<Trail>();
trail.trailRenderer = trail.GetComponent<TrailRenderer>();
2025-02-09 23:47:42 -05:00
trail.Initialize(name, id, tags, isFirstGenerated, parentElement);
2025-02-02 21:59:43 -05:00
trail.renderMaterial =
material == null ? EditorManager.instance.basePrefabs.defaultTrailMaterial : material;
2025-02-02 08:34:54 -05:00
trail.trailRenderer.material = trail.renderMaterial;
trail.visibleTimeLength = visibleTimeLength;
2025-02-02 21:59:43 -05:00
2025-02-02 08:34:54 -05:00
return trail;
}
protected override void SetDefaultSubmodules()
{
transformSubmodule = new TransformSubmodule(this);
submoduleList.Add(transformSubmodule);
}
2025-02-02 08:34:54 -05:00
}
2025-02-02 21:59:43 -05:00
public partial class Trail
{
public override void SaveBM()
{
matchedBM = new Trail_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
visibleTimeLength, renderMaterial);
2025-02-02 21:59:43 -05:00
}
}
namespace Beatmap
{
public class Trail_BM : GameElement_BM
2025-02-02 21:59:43 -05:00
{
public float visibleTimeLength;
public string renderMaterialName;
2025-02-02 21:59:43 -05:00
public Trail_BM()
{
}
public Trail_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
float visibleTimeLength, Material renderMaterial) : base(elementName, elementGuid, tags,
attachedElement)
2025-02-02 21:59:43 -05:00
{
this.visibleTimeLength = visibleTimeLength;
this.renderMaterialName = renderMaterial.name;
2025-02-02 21:59:43 -05:00
}
public override void ExecuteBM()
{
matchedElement = Trail.GenerateElement(elementName, elementGuid, tags,
false, GetElement(attachedElementGuid),
visibleTimeLength); //TODO: Implement Material
2025-02-02 21:59:43 -05:00
}
public override GameElement DuplicateBM(GameElement parent)
2025-02-02 21:59:43 -05:00
{
return Trail.GenerateElement(elementName, elementGuid, tags,
false, parent, visibleTimeLength); //TODO: Implement Material
2025-02-02 21:59:43 -05:00
}
}
}
2025-02-02 08:34:54 -05:00
}