2017-07-18 01:36:45 +00:00
|
|
|
// Phaser.Input.InteractiveObject
|
|
|
|
|
2017-07-25 03:10:50 +00:00
|
|
|
var Class = require('../utils/Class');
|
|
|
|
|
|
|
|
var InteractiveObject = new Class({
|
|
|
|
|
|
|
|
initialize:
|
|
|
|
|
|
|
|
function InteractiveObject (gameObject, hitArea, hitAreaCallback)
|
|
|
|
{
|
|
|
|
this.gameObject = gameObject;
|
|
|
|
|
|
|
|
this.enabled = true;
|
|
|
|
this.draggable = false;
|
|
|
|
|
|
|
|
this.hitArea = hitArea;
|
|
|
|
this.hitAreaCallback = hitAreaCallback;
|
|
|
|
|
|
|
|
this.localX = 0;
|
|
|
|
this.localY = 0;
|
|
|
|
|
|
|
|
// this.dragX = 0;
|
|
|
|
// this.dragY = 0;
|
2017-07-18 01:36:45 +00:00
|
|
|
|
2017-07-25 03:10:50 +00:00
|
|
|
// this.callbackContext = gameObject;
|
2017-07-18 12:54:01 +00:00
|
|
|
|
2017-07-25 03:10:50 +00:00
|
|
|
// onDragStart: NOOP,
|
|
|
|
// onDrag: NOOP,
|
|
|
|
// onDragEnd: NOOP
|
|
|
|
},
|
2017-07-18 01:36:45 +00:00
|
|
|
|
2017-07-25 03:53:23 +00:00
|
|
|
onUp: function (gameObject, pointer, x, y)
|
2017-07-25 03:10:50 +00:00
|
|
|
{
|
|
|
|
// Empty by default. Override via setCallback.
|
|
|
|
},
|
2017-07-18 01:36:45 +00:00
|
|
|
|
2017-07-25 03:53:23 +00:00
|
|
|
onDown: function (gameObject, pointer, x, y)
|
2017-07-25 03:10:50 +00:00
|
|
|
{
|
|
|
|
// Empty by default. Override via setCallback.
|
|
|
|
},
|
2017-07-18 12:54:01 +00:00
|
|
|
|
2017-07-25 03:53:23 +00:00
|
|
|
onOver: function (gameObject, pointer, x, y)
|
2017-07-25 03:10:50 +00:00
|
|
|
{
|
|
|
|
// Empty by default. Override via setCallback.
|
|
|
|
},
|
2017-07-18 01:36:45 +00:00
|
|
|
|
2017-07-25 03:53:23 +00:00
|
|
|
onOut: function (gameObject, pointer)
|
2017-07-25 03:10:50 +00:00
|
|
|
{
|
|
|
|
// Empty by default. Override via setCallback.
|
|
|
|
},
|
2017-07-21 12:59:22 +00:00
|
|
|
|
2017-07-25 03:53:23 +00:00
|
|
|
onMove: function (gameObject, pointer, x, y)
|
2017-07-25 03:10:50 +00:00
|
|
|
{
|
|
|
|
// Empty by default. Override via setCallback.
|
|
|
|
},
|
2017-07-24 13:09:57 +00:00
|
|
|
|
2017-07-25 03:10:50 +00:00
|
|
|
destroy: function ()
|
|
|
|
{
|
|
|
|
this.gameObject = undefined;
|
|
|
|
this.hitArea = undefined;
|
|
|
|
this.hitAreaCallback = undefined;
|
|
|
|
}
|
2017-07-24 13:09:57 +00:00
|
|
|
|
2017-07-25 03:10:50 +00:00
|
|
|
});
|
2017-07-18 01:36:45 +00:00
|
|
|
|
|
|
|
module.exports = InteractiveObject;
|