2015-03-01 07:00:17 +00:00
|
|
|
/**
|
2015-03-23 23:27:14 +00:00
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
2016-04-04 21:15:01 +00:00
|
|
|
* @copyright 2016 Photon Storm Ltd.
|
2015-03-23 23:27:14 +00:00
|
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The InCamera component checks if the Game Object intersects with the Game Camera.
|
2015-03-01 07:00:17 +00:00
|
|
|
*
|
|
|
|
* @class
|
|
|
|
*/
|
2015-02-17 05:15:04 +00:00
|
|
|
Phaser.Component.InCamera = function () {};
|
|
|
|
|
|
|
|
Phaser.Component.InCamera.prototype = {
|
|
|
|
|
|
|
|
/**
|
2015-03-23 23:27:14 +00:00
|
|
|
* Checks if this Game Objects bounds intersects with the Game Cameras bounds.
|
|
|
|
*
|
|
|
|
* It will be `true` if they intersect, or `false` if the Game Object is fully outside of the Cameras bounds.
|
|
|
|
*
|
|
|
|
* An object outside the bounds can be considered for camera culling if it has the AutoCull component.
|
2015-02-17 05:15:04 +00:00
|
|
|
*
|
2015-03-23 23:27:14 +00:00
|
|
|
* @property {boolean} inCamera
|
2015-02-17 05:15:04 +00:00
|
|
|
* @readonly
|
|
|
|
*/
|
|
|
|
inCamera: {
|
|
|
|
|
|
|
|
get: function() {
|
|
|
|
|
|
|
|
return this.game.world.camera.view.intersects(this._bounds);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|