using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerReplay : MonoBehaviour { public Transform[] joints = new Transform[25]; public Material boneMaterial; // (need to implement controller click to trigger save) public void Save() { SaveSystem.Save(this); } public void Load() { JointsData data = SaveSystem.Load(); if(data == null) { Debug.Log("Load failed"); return; } for(int i = 0; i < joints.Length; i++) { // Create GameObject cubes for joints GameObject jointObj = GameObject.CreatePrimitive(PrimitiveType.Cube); LineRenderer lr = jointObj.AddComponent(); lr.positionCount = 2; lr.material = boneMaterial; lr.startWidth = 0.3f; lr.endWidth = 0.3f; jointObj.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); // (need to test) jointObj.transform.position = new Vector3(data.jointsPositionsX[i], data.jointsPositionsY[i], data.jointsPositionsZ[i]); // Connect the joints with LineRenderer } } }