StreetPartMetaTag.cs 470 B

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