StreetPartMetaTag.cs 396 B

123456789101112131415
  1. using UnityEngine;
  2. public class StreetPartMetaTag : MonoBehaviour
  3. {
  4. public const string TAG_EVEN = "street_even";
  5. public const string TAG_UNEVEN = "street_uneven";
  6. private const float SLOPE_THRES = .5f;
  7. private void Awake()
  8. {
  9. var slope = transform.parent.localRotation.eulerAngles.z;
  10. tag = Mathf.Abs(slope) <= SLOPE_THRES ? TAG_EVEN : TAG_UNEVEN;
  11. }
  12. }