home *** CD-ROM | disk | FTP | other *** search
- class com.neodelight.game.PlayerProp
- {
- var def;
- var pValue;
- var pMin;
- var pMax;
- function PlayerProp(min, max, def, act)
- {
- if(min == undefined)
- {
- min = 4.9e-324;
- }
- if(max == undefined)
- {
- max = 1.7976931348623157e+308;
- }
- this.min = min;
- this.max = max;
- this.def = com.neodelight.std.XMath.toNumber(def);
- this.value = act != undefined ? act : def;
- }
- function set value(value)
- {
- this.pValue = Math.max(this.min,Math.min(this.max,value));
- }
- function get value()
- {
- return this.pValue;
- }
- function set min(min)
- {
- this.pMin = min;
- this.pValue = Math.max(this.min,Math.min(this.max,this.pValue));
- }
- function get min()
- {
- return this.pMin;
- }
- function set max(max)
- {
- this.pMax = max;
- this.pValue = Math.max(this.min,Math.min(this.max,this.pValue));
- }
- function get max()
- {
- return this.pMax;
- }
- function reset()
- {
- this.value = this.def;
- }
- function toString()
- {
- return "[PlayerProp {value:" + this.value + ", def:" + this.def + " min:" + this.min + ", max:" + this.max + "}]";
- }
- }
-