///<summary> /// Unity callback, /// /// validate inner radius less than outer range. /// Set SphereCollider equal to outer range. ///</summary> void OnValidate() { if (World) { EnvironmentmapManager manager = (EnvironmentmapManager)FindObjectOfType(typeof(EnvironmentmapManager)); manager._environmentMap = _environment; } if (_influenceRadius != null) { _influenceRadius.radius = _outerRange; } if (_innerRange > _outerRange) { _innerRange = _outerRange; } if (_innerRange < _outerRange / 2) { _innerRange = _outerRange / 2; } }
public bool Capture = true; //Capture environment map? ///<summary> /// Unity callback, /// /// initialize all game components. ///</summary> void Start() { if (objectList == null) { objectList = new ArrayList(); } _boundingBox = ((BoxCollider)gameObject.GetComponent <BoxCollider>()); if (_boundingBox == null) { _boundingBox = (BoxCollider)gameObject.AddComponent <BoxCollider>(); } _influenceRadius = ((SphereCollider)gameObject.GetComponent <SphereCollider>()); if (_influenceRadius == null) { _influenceRadius = (SphereCollider)gameObject.AddComponent <SphereCollider>(); } _influenceRadius.isTrigger = true; if (gameObject.camera == null) { gameObject.AddComponent <Camera>(); } _AABBmax = _boundingBox.bounds.max; _AABBmin = _boundingBox.bounds.min; camera.enabled = false; // Set the global environment map to the manager object. if (World) { EnvironmentmapManager manager = (EnvironmentmapManager)FindObjectOfType(typeof(EnvironmentmapManager)); manager._environmentMap = _environment; } }