mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-23 12:33:02 +00:00
42 lines
No EOL
1.1 KiB
C#
42 lines
No EOL
1.1 KiB
C#
using SanAndreasUnity.Importing.RenderWareStream;
|
|
using UnityEngine;
|
|
|
|
namespace SanAndreasUnity.Behaviours
|
|
{
|
|
public class Frame : MonoBehaviour
|
|
{
|
|
private string _path;
|
|
|
|
public int Index { get; private set; }
|
|
public int BoneId { get; private set; }
|
|
public string Name { get; set; }
|
|
|
|
public Frame Parent { get; internal set; }
|
|
public int ParentIndex { get; internal set; }
|
|
|
|
public Vector3 LocalVelocity;
|
|
|
|
public HierarchyAnimationFlags Flags;
|
|
|
|
public string Path
|
|
{
|
|
get { return _path ?? (_path = FindPath()); }
|
|
}
|
|
|
|
internal void Initialize(Importing.Conversion.Geometry.GeometryFrame frame)
|
|
{
|
|
Index = frame.Source.Index;
|
|
BoneId = frame.Source.HAnim != null ? (int)frame.Source.HAnim.NodeId : -1;
|
|
Name = frame.Name;
|
|
|
|
if (frame.Source.HAnim == null) return;
|
|
|
|
Flags = frame.Source.HAnim.Flags;
|
|
}
|
|
|
|
private string FindPath()
|
|
{
|
|
return Parent == null ? Name : string.Format("{0}/{1}", Parent.Path, Name);
|
|
}
|
|
}
|
|
} |