Пример #1
0
        virtual protected void OnDrawGizmosSelected()
        {
            if (BC == null)
            {
                return;
            }

            GameObject target = UnityEditor.Selection.activeObject as GameObject;

            if (target == BC.gameObject)
            {
                IsoTile _tile = GetComponentInParent <IsoTile>();
                if (!_tile.GetSideObjects(Iso2DObject.Type.Side_Union, Iso2DObject.Type.Side_X, Iso2DObject.Type.Side_Y, Iso2DObject.Type.Side_Z).All(r => target != r.SC.gameObject))
                {
                    return;
                }

                Gizmos.color = new Color(0.95f, 0.5f, 0.05f, 0.65f);
                Bounds _bounds      = GlobalBounds;
                Bounds _tile_bounds = _tile.GetBounds_SideOnly();
                Gizmos.DrawWireCube(_tile_bounds.center, _tile_bounds.size);
                _bounds.center = new Vector3(_bounds.center.x, _tile_bounds.max.y, _bounds.center.z);
                _bounds.size   = new Vector3(_bounds.size.x, 0, _bounds.size.z);
                Gizmos.DrawWireCube(_bounds.center, _bounds.size);
            }
        }
Пример #2
0
        public static float DropToFloor(this IsoTile _tile, float _fMaxHeight           = 10f, bool bDontMove = false,
                                        QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.Collide)
        {
            if (_tile == null || _tile.gameObject == null)
            {
                return(0);
            }

            var fResult = DropToFloor(_tile.GetBounds_SideOnly(), _tile.gameObject, _fMaxHeight, bDontMove, queryTriggerInteraction);

            _tile.coordinates.Apply_SnapToGrid();
            return(fResult);
        }