import { GALAXY } from '../const/galaxy' ; import { IStarSystemConstructor } from '../interfaces/interfaces' ; export class StarSystem { private circle : Phaser . GameObjects . Arc ; private starSystemExists : boolean ; private position : Phaser . Math . Vector2 ; private radius : number ; private color : number ; private alpha : number ; private rnd : Phaser . Math . RandomDataGenerator ; private scene : Phaser . Scene ; constructor ( params ) { this . scene = params . scene ; this . position = new Phaser . Math . Vector2 ( params . x , params . y ) ; let seed = 1586603672891738926694102 * this . position . x * this . position . y ; this . rnd = new Phaser . Math . RandomDataGenerator ( [ seed . toString ( ) ] ) ; this . starSystemExists = this . rnd . between ( 0 , 20 ) === 1 ? true : false ; if ( this . starSystemExists ) { this . radius = this . rnd . between ( 0 , 8 ) ; this . color = GALAXY . planetColors [ this . rnd . between ( 0 , GALAXY . planetColors . length - 1 ) ] ; this . alpha = this . rnd . realInRange ( 0.5 , 1 ) ; this . circle = this . scene . add . circle ( this . position . x , this . position . y , this . radius , this . color , this . alpha ) . setInteractive ( ) ; } } public isStarSystemAlive ( ) { return this . starSystemExists ; } }