2018-02-12 16:01:20 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
2020-01-15 12:07:09 +00:00
|
|
|
* @copyright 2020 Photon Storm Ltd.
|
2019-05-10 15:15:04 +00:00
|
|
|
* @license {@link https://opensource.org/licenses/MIT|MIT License}
|
2018-02-12 16:01:20 +00:00
|
|
|
*/
|
|
|
|
|
2017-08-15 22:36:00 +00:00
|
|
|
var TYPE = require('../TYPE');
|
|
|
|
|
2018-02-09 01:40:41 +00:00
|
|
|
/**
|
2018-09-28 11:19:21 +00:00
|
|
|
* The Impact Check Against component.
|
|
|
|
* Should be applied as a mixin.
|
2018-02-09 01:40:41 +00:00
|
|
|
*
|
2019-02-12 15:01:54 +00:00
|
|
|
* @namespace Phaser.Physics.Impact.Components.CheckAgainst
|
2018-02-09 01:40:41 +00:00
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-08-15 22:36:00 +00:00
|
|
|
var CheckAgainst = {
|
|
|
|
|
2018-02-09 01:40:41 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Physics.Impact.Components.CheckAgainst#setAvsB
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
2018-03-18 23:42:09 +00:00
|
|
|
* @return {Phaser.GameObjects.GameObject} This Game Object.
|
2018-02-09 01:40:41 +00:00
|
|
|
*/
|
2017-08-16 21:10:19 +00:00
|
|
|
setAvsB: function ()
|
|
|
|
{
|
|
|
|
this.setTypeA();
|
|
|
|
|
|
|
|
return this.setCheckAgainstB();
|
|
|
|
},
|
|
|
|
|
2018-02-09 01:40:41 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Physics.Impact.Components.CheckAgainst#setBvsA
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
2018-03-18 23:42:09 +00:00
|
|
|
* @return {Phaser.GameObjects.GameObject} This Game Object.
|
2018-02-09 01:40:41 +00:00
|
|
|
*/
|
2017-08-16 21:10:19 +00:00
|
|
|
setBvsA: function ()
|
|
|
|
{
|
|
|
|
this.setTypeB();
|
|
|
|
|
|
|
|
return this.setCheckAgainstA();
|
|
|
|
},
|
|
|
|
|
2018-02-09 01:40:41 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Physics.Impact.Components.CheckAgainst#setCheckAgainstNone
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
2018-03-18 23:42:09 +00:00
|
|
|
* @return {Phaser.GameObjects.GameObject} This Game Object.
|
2018-02-09 01:40:41 +00:00
|
|
|
*/
|
2017-08-15 22:36:00 +00:00
|
|
|
setCheckAgainstNone: function ()
|
|
|
|
{
|
|
|
|
this.body.checkAgainst = TYPE.NONE;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-09 01:40:41 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Physics.Impact.Components.CheckAgainst#setCheckAgainstA
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
2018-03-18 23:42:09 +00:00
|
|
|
* @return {Phaser.GameObjects.GameObject} This Game Object.
|
2018-02-09 01:40:41 +00:00
|
|
|
*/
|
2017-08-15 22:36:00 +00:00
|
|
|
setCheckAgainstA: function ()
|
|
|
|
{
|
|
|
|
this.body.checkAgainst = TYPE.A;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-09 01:40:41 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Physics.Impact.Components.CheckAgainst#setCheckAgainstB
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
2018-03-18 23:42:09 +00:00
|
|
|
* @return {Phaser.GameObjects.GameObject} This Game Object.
|
2018-02-09 01:40:41 +00:00
|
|
|
*/
|
2017-08-15 22:36:00 +00:00
|
|
|
setCheckAgainstB: function ()
|
|
|
|
{
|
|
|
|
this.body.checkAgainst = TYPE.B;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-09 01:40:41 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Physics.Impact.Components.CheckAgainst#checkAgainst
|
2018-03-18 23:42:09 +00:00
|
|
|
* @type {number}
|
2018-02-09 01:40:41 +00:00
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-08-15 22:36:00 +00:00
|
|
|
checkAgainst: {
|
|
|
|
|
|
|
|
get: function ()
|
|
|
|
{
|
|
|
|
return this.body.checkAgainst;
|
|
|
|
},
|
|
|
|
|
|
|
|
set: function (value)
|
|
|
|
{
|
|
|
|
this.body.checkAgainst = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = CheckAgainst;
|