Advertisement
nio_kasgami

musicBoxTest

May 10th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //-----------------------------------------------------------------------------
  2. /**
  3.  * The Core class who handle all the panic meter in the game.
  4.  *
  5.  * @class Panic
  6.  * @nameSpace Enigma
  7.  */
  8.  
  9.  namespace Enigma {
  10.  
  11.    export class Panic {
  12.  
  13.      // attr_accessor : fear
  14.      public get fear() : number { return this._fearPoint; }
  15.      public set fear(v : number) { this._fearPoint = v; }
  16.  
  17.      // attr_accessor : fearMax
  18.      public get fearMax() : number { return this._maxFearPoint; }
  19.      public set fearMax(v : number) { this._maxFearPoint = v; }
  20.  
  21.      // attr_reader : fearStates
  22.      public get fearStates() : Array<number> { return this._fearStates; }
  23.  
  24.      private _fearPoint : number;
  25.      private _maxFearPoint : number;
  26.      private _fearEnabled : boolean;
  27.      private _fearStates : Array<number>;
  28.      private _fearDelay : number;
  29.      private _isInPanic : boolean;
  30.  
  31.      constructor() {
  32.        this.initMembers();
  33.      }
  34.  
  35.      private initMembers(){
  36.        this._fearPoint = 0;
  37.        this._maxFearPoint = 1000;
  38.        this._fearEnabled = false;
  39.        this._fearStates = [2, 3, 4, 5];
  40.        this._fearDelay = 0;
  41.        this._isInPanic = false;
  42.      }
  43.  
  44.      public resetFear(){
  45.          this._fearPoint = 0;
  46.      }
  47.  
  48.      public maxFear(){
  49.          this._fearPoint = this._maxFearPoint;
  50.      }
  51.  
  52.      public setFear(value : number){
  53.          this._fearPoint = value;
  54.      }
  55.  
  56.      public addFear(value : number){
  57.        if(this._fearDelay !== 0){
  58.            this._fearPoint += 0;
  59.        } else {
  60.            this._fearPoint += value;
  61.        }
  62.      }
  63.  
  64.      public removeFear(value : number){
  65.          this._fearPoint -= value;
  66.      }
  67.  
  68.      public progressiveFearIncreasing(){
  69.          this._fearPoint++;
  70.      }
  71.  
  72.      public progressiveFearDecreasing(){
  73.          this._fearPoint--;
  74.      }
  75.  
  76.  
  77.      public enableFear(bool : boolean){
  78.          this._fearEnabled = bool;
  79.      }
  80.  
  81.      public setFearDelay(value : number){
  82.          this._fearDelay = value;
  83.      }
  84.  
  85.      public decreaseFearDelayProgressively(){
  86.          this._fearDelay--;
  87.      }
  88.  
  89.      public isInPanic(){
  90.          return this._isInPanic;
  91.      }
  92.  
  93.      public setPanic(bool : boolean){
  94.          this._isInPanic = bool;
  95.      }
  96.  
  97.    } // end class Panic
  98.  
  99.  } // end NameSpace Enigma
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement