GameObject base class is implemented
This commit is contained in:
parent
77fff585d2
commit
0f130ad7e5
45
src/Game/GameObject/GameObject.js
Normal file
45
src/Game/GameObject/GameObject.js
Normal file
@ -0,0 +1,45 @@
|
||||
import * as PIXI from "../../pixi/pixi.mjs"
|
||||
|
||||
/**
|
||||
* Base class for all game objects.
|
||||
* Contains only necessary functions
|
||||
*/
|
||||
export class GameObject {
|
||||
|
||||
id = -1;
|
||||
tickEnabled = true;
|
||||
// markedAsWaitingForDestruction = false;
|
||||
// markedAsInitialized = false;
|
||||
|
||||
/**
|
||||
* GameObject id
|
||||
* @param {Number} id
|
||||
* @param {Boolean} tickAble
|
||||
*/
|
||||
constructor(id, tickAble)
|
||||
{
|
||||
this.id = id;
|
||||
this.tickEnabled = tickAble;
|
||||
};
|
||||
|
||||
/**
|
||||
* called before object's destruction
|
||||
*/
|
||||
preDestroy(){};
|
||||
|
||||
/**
|
||||
* called after spawn
|
||||
*/
|
||||
afterSpawn(){};
|
||||
|
||||
/**
|
||||
* called before spawn
|
||||
*/
|
||||
preSpawn(){};
|
||||
|
||||
/**
|
||||
* called every frame
|
||||
* @param {PIXI.Ticker} ticker
|
||||
*/
|
||||
tick(ticker){};
|
||||
};
|
@ -61,6 +61,7 @@ let nightAmbientSoundCue = new NumberCue(
|
||||
);
|
||||
|
||||
export function handleSounds(tick) {
|
||||
// console.log(tick);
|
||||
let p = getDayPhase();
|
||||
ambientDay.volume(dayAmbientSoundCue.getValueAt(p) * globalSoundVolume * ambientSoundVolume * 0.6);
|
||||
ambientNight.volume(nightAmbientSoundCue.getValueAt(p) * globalSoundVolume * ambientSoundVolume * 0.6);
|
||||
|
Loading…
x
Reference in New Issue
Block a user