Danro/Assets/Scripts/Behaviour/MessagePlaceholder.cs
Danil Iarosh 7f14981d8b added dialogue system
- Добавил систему диалогов
- Создал классы Sequencer.cs и SequenceAction.cs для воссоздания последовательности действий
- Добавил иеханику последовательности действий в Message.cs и MessageController.cs
2025-12-10 08:32:15 +03:00

35 lines
1.1 KiB
C#

using UnityEngine;
namespace RR.Common.Behaviour
{
public class MessagePlaceholder : MonoBehaviour
{
private Transform _parentTransform;
private Quaternion _lastParentRotation;
private void Awake()
{
_parentTransform = transform.parent;
if (_parentTransform != null)
{
_lastParentRotation = _parentTransform.rotation;
}
}
private void Update()
{
// Компенсируем поворот только если родитель изменил rotation
if (_parentTransform != null && _parentTransform.rotation != _lastParentRotation)
{
_lastParentRotation = _parentTransform.rotation;
transform.rotation = Quaternion.identity;
}
// Используем childCount вместо GetComponentsInChildren — намного быстрее
if (transform.childCount == 0)
{
Destroy(gameObject);
}
}
}
}