/
GeekNerd
/
ServerModelingProject
Обзор
Документация
Войти
/
GeekNerd
/
ServerModelingProject
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Assets/Scripts/DataClasses/PlacedRack.cs
28 строк
757 B
Gorney-Alex
Init
30 май 2026, 19:05
30 май 2026, 19:05
3cdcc49
Код
Авторство
О чём код?
using System; using UnityEngine; namespace DataClasses { [Serializable] public class PlacedRack { public RackData Model; public Vector2 Position; public float Rotation; public int ZoneId; public Rect GetFootprintRect() { if (Model == null) { return new Rect(Position, Vector2.zero); } bool rotated = Mathf.Abs(Mathf.Repeat(Rotation, 180f) - 90f) < 0.01f; float width = rotated ? Model.Length : Model.Width; float length = rotated ? Model.Width : Model.Length; return new Rect(Position.x - width * 0.5f, Position.y - length * 0.5f, width, length); } } }