// Moves player along rail private void MovePlayer() { transition += Time.deltaTime / waypoints[currentSeg].transTime; if (transition > 1) { // Triggers Game Event gameEvents.PlayEvent(waypoints[currentSeg]); goalIndex++; // Transitions to next point on rail transition = 0; currentSeg++; } // Sets target location to next node if it exists if (railSys.waypoints[currentSeg + 1]) { transform.position = railSys.LinearPosition(currentSeg, transition); transform.rotation = railSys.Orientation(currentSeg, transition); } else { railSys = null; } }
/// <summary> /// This method is used to add the button to the editor. /// When pressed, it will update the railNode List of the rails Object current list of child node. /// </summary> public override void OnInspectorGUI() { base.OnInspectorGUI(); RailSystem data = (RailSystem)target; if (GUILayout.Button("Update")) { data.setNodes(); EditorUtility.SetDirty(target); } }