- Добавил систему диалогов - Создал классы Sequencer.cs и SequenceAction.cs для воссоздания последовательности действий - Добавил иеханику последовательности действий в Message.cs и MessageController.cs
35 lines
1.1 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|
|
} |