Commit e274a43f authored by 18류지석's avatar 18류지석

시작 단어 10개 생성, 5개 미만 시 대기시간 초기화, 호패 생성 시간 조절

parent 340846c4
......@@ -29,6 +29,7 @@ class WordObject
fontStyle: (this.wordWeight > 5 ? 'bold' : '')
}).setColor('#000000').setOrigin(0.5,0.5);
WordSpace.totalWeight += this.wordWeight;
WordSpace.totalWordNum += 1;
WordSpace.setGameOverTimer();
//console.log("Total weight : " + WordSpace.totalWeight);
}
......@@ -37,6 +38,7 @@ class WordObject
{
console.log(this.generationCode + ': ' + this.wordText + ' destroyed');
WordSpace.totalWeight -= this.wordWeight;
WordSpace.totalWordNum -= 1;
this.wordObj.destroy();
const groupIdx = WordSpace.wordGroup.findIndex(function(item) {return this.isEqualObject(item.generationCode)}, this);
if (groupIdx > -1) WordSpace.wordGroup.splice(groupIdx, 1);
......
......@@ -8,6 +8,7 @@ WordSpace.isImageLoaded = false;
WordSpace.nextWordCode = 0;
WordSpace.totalWeight = 0; //현재 단어 무게 총합
WordSpace.totalWordNum = 0;
WordSpace.brainCapacity = 100; //수용 가능한 단어 무게 최대치
WordSpace.defeatTime = 5000;
WordSpace.gameOverTimer = null; //게임 오버 판정 타이머
......@@ -39,6 +40,15 @@ WordSpace.getSpawnPoint = function()
return {x:_x, y:_y};
}
WordSpace.spaceInitiate = function(scene)
{
let arr = [3, 3, 3, 3, 3, 2, 2, 2, 2, 1]
arr.forEach(function(element)
{
WordSpace.generateWord(scene, SelectWord.selectWord(element));
});
}
WordSpace.AdjustVarByPhase = function(typingRate, phase)
{
if(phase == WordSpace.Phase.READY)
......@@ -192,6 +202,15 @@ WordSpace.nameCycle =
}
}
WordSpace.genWordByProb = function(scene)
{
let wordRnd = Math.random();
let wordIdx = wordRnd < WordSpace.GradeProb[0] ? 3 :
wordRnd < WordSpace.GradeProb[1] ? 2 :
wordRnd < WordSpace.GradeProb[2] ? 1 : 0;
WordSpace.generateWord(scene, SelectWord.selectWord(wordIdx));
}
WordSpace.wordCycle =
{
delay: 0,
......@@ -205,11 +224,7 @@ WordSpace.wordCycle =
delay: _delay,
callback: function()
{
let wordRnd = Math.random();
let wordIdx = wordRnd < WordSpace.GradeProb[0] ? 3 :
wordRnd < WordSpace.GradeProb[1] ? 2 :
wordRnd < WordSpace.GradeProb[2] ? 1 : 0;
WordSpace.generateWord(this, SelectWord.selectWord(wordIdx));
WordSpace.genWordByProb(scene);
},
callbackScope: scene,
loop: true
......@@ -320,6 +335,12 @@ WordSpace.findWord = function(wordText)
}
weightest.destroy();
WordSpace.nameCycle.resetCycle(WordSpace.gameSceneForTest, WordSpace.NameSpawnDelay, WordSpace.nameCycle.currentCycle.getElapsed() + WordSpace.NameSpawnReduce);
while(WordSpace.totalWordNum < 5)
{
WordSpace.genWordByProb(WordSpace.gameSceneForTest);
WordSpace.wordCycle.resetCycle(WordSpace.gameSceneForTest, WordSpace.WordSpawnDelay, 0);
}
}
else if (wordText === '공격' && WordSpace.attackGauge.value >= 3) // 공격모드 진입.
{
......
......@@ -37,6 +37,7 @@ function create()
WordSpace.varAdjustCycle.resetCycle(this, 100, 0);
WordSpace.attackGauge.resetCycle(this);
CSVParsing.CSVParse(this);
WordSpace.spaceInitiate(this);
}
function update()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment