12345678910111213141516171819202122232425 |
- using UnityEngine;
- using System.Collections;
- public class Collidable : CompareXMonoBehaviour
- {
- Bounds _bounds;
- int _lastRectTickCalculation;
- BoxCollider _boxCollider;
- protected virtual void Awake()
- {
- _boxCollider = GetComponent<BoxCollider>();
- AVDebug.Assert(_boxCollider != null, "We need a box collider on this "+name+" in order to be able to extract bounds for collisions");
- }
- public Bounds GetBounds()
- {
- if (RecordingManager.Ticks != _lastRectTickCalculation)
- {
- _bounds = _boxCollider.bounds;
- _lastRectTickCalculation = RecordingManager.Ticks;
- }
- return _bounds;
- }
- }
|