2023-11-17 16:09:21 +01:00
|
|
|
using System;
|
2023-11-16 12:14:12 +01:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
2023-11-17 16:09:21 +01:00
|
|
|
using NUnit.Framework.Internal;
|
|
|
|
using TMPro;
|
|
|
|
using UnityEditor;
|
2023-11-16 12:14:12 +01:00
|
|
|
using UnityEngine;
|
2023-11-17 16:09:21 +01:00
|
|
|
using UnityEngine.Serialization;
|
2023-11-16 12:14:12 +01:00
|
|
|
|
2023-11-17 16:09:21 +01:00
|
|
|
[System.Serializable]
|
2023-11-16 12:14:12 +01:00
|
|
|
public class RollerProperties : MonoBehaviour {
|
2023-11-17 16:09:21 +01:00
|
|
|
[SerializeField] public bool start = false;
|
|
|
|
|
|
|
|
[SerializeField] public bool clockwise = false;
|
|
|
|
|
|
|
|
[SerializeField] public GameObject linkTo = null;
|
|
|
|
|
|
|
|
[SerializeField] public RotationType movement = RotationType.Fixed;
|
|
|
|
|
|
|
|
protected internal float currentDistance;
|
|
|
|
|
|
|
|
protected internal GameObject text;
|
|
|
|
|
|
|
|
private void Update() {
|
|
|
|
if (text != null) {
|
|
|
|
text.transform.position = transform.position;
|
|
|
|
text.transform.rotation = transform.rotation;
|
|
|
|
}
|
2023-11-16 12:14:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
2023-11-17 16:09:21 +01:00
|
|
|
void OnDrawGizmos() {
|
|
|
|
foreach (var distanceJoint in gameObject.GetComponents<DistanceJoint2D>()) {
|
|
|
|
Gizmos.color = new Color(1, .3f, 0);
|
|
|
|
var cableStart = transform.TransformPoint(distanceJoint.anchor);
|
|
|
|
var cableEnd = distanceJoint.connectedBody.transform.TransformPoint(distanceJoint.connectedAnchor);
|
|
|
|
Gizmos.DrawLine(cableStart, cableEnd);
|
|
|
|
Gizmos.color = Color.yellow;
|
|
|
|
Gizmos.DrawCube(cableStart, new Vector3(0.1f, 0.1f, 0.1f));
|
|
|
|
Gizmos.color = Color.red;
|
|
|
|
Gizmos.DrawCube(cableEnd, new Vector3(0.1f, 0.1f, 0.1f));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public enum RotationType {
|
|
|
|
Fixed,
|
|
|
|
Rotatable,
|
|
|
|
Powered,
|
|
|
|
Free
|
2023-11-16 12:14:12 +01:00
|
|
|
}
|
2023-11-17 16:09:21 +01:00
|
|
|
}
|