]>
Commit | Line | Data |
---|---|---|
1 | import { Component } from '@serpentity/serpentity'; | |
2 | ||
3 | /** | |
4 | * Component that stores a dash skill | |
5 | * | |
6 | * @extends {external:Serpentity.Component} | |
7 | * @class GrabComponent | |
8 | * @param {object} config a configuration object to extend. | |
9 | */ | |
10 | export default class GrabComponent extends Component { | |
11 | constructor(config) { | |
12 | ||
13 | super(config); | |
14 | ||
15 | /** | |
16 | * The properthy that holds the grab state | |
17 | * | |
18 | * @property {boolean} grabbing | |
19 | * @instance | |
20 | * @memberof GrabComponent | |
21 | */ | |
22 | this.dashing = this.grabbing || false; | |
23 | ||
24 | /** | |
25 | * The constraint used for the grab | |
26 | * | |
27 | * @property {external:MatterJs.Constraint} constraint | |
28 | * @instance | |
29 | * @memberof GrabComponent | |
30 | */ | |
31 | this.constraint = this.constraint || null; | |
32 | ||
33 | /** | |
34 | * Whether the grab is locked from occuring | |
35 | * | |
36 | * @property {boolean} locked | |
37 | * @instance | |
38 | * @memberof GrabComponent | |
39 | */ | |
40 | this.locked = this.locked || false; | |
41 | ||
42 | /** | |
43 | * Cooldown before lock is removed | |
44 | * | |
45 | * @property {number} cooldown | |
46 | * @instance | |
47 | * @memberof GrabComponent | |
48 | */ | |
49 | this.cooldown = this.cooldown || 3000; | |
50 | ||
51 | /** | |
52 | * Current cooldown | |
53 | * | |
54 | * @property {number} currentCooldown | |
55 | * @instance | |
56 | * @memberof GrabComponent | |
57 | */ | |
58 | this.currentCooldown = 0; | |
59 | } | |
60 | }; |