GameObject base class is implemented

This commit is contained in:
TorgaW 2024-04-13 21:20:59 +03:00
parent 77fff585d2
commit 0f130ad7e5
2 changed files with 46 additions and 0 deletions

View 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){};
};

View File

@ -61,6 +61,7 @@ let nightAmbientSoundCue = new NumberCue(
); );
export function handleSounds(tick) { export function handleSounds(tick) {
// console.log(tick);
let p = getDayPhase(); let p = getDayPhase();
ambientDay.volume(dayAmbientSoundCue.getValueAt(p) * globalSoundVolume * ambientSoundVolume * 0.6); ambientDay.volume(dayAmbientSoundCue.getValueAt(p) * globalSoundVolume * ambientSoundVolume * 0.6);
ambientNight.volume(nightAmbientSoundCue.getValueAt(p) * globalSoundVolume * ambientSoundVolume * 0.6); ambientNight.volume(nightAmbientSoundCue.getValueAt(p) * globalSoundVolume * ambientSoundVolume * 0.6);