Commit ece8a72e authored by 18손재민's avatar 18손재민

이제 호패가 랜덤하게 생성됨. 호패를 가진 플레이어를 공격 시 공격 단어가 전송 됨

parent 44c46a35
var GameServer = GameServer || {};
GameServer.Phase = {READY: 0, START: 1, MAIN: 2, MUSIC: 3};
GameServer.startCount = 3;
GameServer.startCount = 5;
GameServer.currentPlayer = [];
GameServer.playingRoom = [];
......
......@@ -60,8 +60,7 @@ var gameScene = new Phaser.Class(
WordSpace.setPlayerTyping.initiate(this);
WordSpace.nameWordTextForTest = WordSpace.gameSceneForTest.add.text(50,400,'현재 가진 호패들 : 없음').setDepth(10).setColor('#000000');
WordSpace.nameQueue.shuffle();
WordSpace.nameQueue.initiate();
},
update: function()
......
......@@ -148,14 +148,11 @@ class NameWord extends WordObject
{
constructor(name, _isStrong = false)
{
super(name);
this.ownerId = RoomData.players.find(function(element)
{
return element.nickname === name;
}).id;
super(name.nickname);
this.ownerId = name.id;
this.wordWeight = 2;
this.isStrong = _isStrong;
console.log('Name : ' + name + ', Strong : ' + this.isStrong + ', Weight : ' + this.wordWeight);
console.log('Name : ' + name.nickname + ', Strong : ' + this.isStrong + ', Weight : ' + this.wordWeight);
}
destroy()
{
......
......@@ -252,12 +252,7 @@ WordSpace.generateWord =
},
Name: function(scene, isStrong, lenRate)
{
//To do
/*RoomData.players.forEach(function(element)
{
WordSpace.generateWord.Attack(WordSpace.gameSceneForTest, wordText, grade, PlayerData.nickname, element.isStrong);
});*/
word = new NameWord(PlayerData.nickname, isStrong);
word = new NameWord(WordSpace.nameQueue.pop(), isStrong);
WordSpace.pushWord(scene, word, lenRate);
}
}
......@@ -280,6 +275,7 @@ function gameOver()
{
WordSpace.wordCycle.currentCycle.remove();
WordSpace.nameCycle.currentCycle.remove();
WordSpace.varAdjustCycle.currentCycle.remove();
//To Do
console.log('defeat');
}
......@@ -368,7 +364,6 @@ WordSpace.attack = function(wordText, grade)
if (wordText != '')
{
console.log('attack ' + wordText + ', grade: ' + grade);
//호패에 따른 isStrong 구분 필요함
WordSpace.nameGroup.forEach(function(element)
{
let attackData =
......@@ -384,7 +379,6 @@ WordSpace.attack = function(wordText, grade)
//WordSpace.generateWord.Attack(WordSpace.gameSceneForTest, wordText, grade, PlayerData.nickname, element.isStrong);
});
WordSpace.nameGroup = [];
WordSpace.attackGauge.resetValue();
WordSpace.setPlayerTyping.add(wordText);
}
......@@ -396,6 +390,7 @@ WordSpace.attack = function(wordText, grade)
Input.attackMode = false;
WordSpace.attackGauge.pauseCycle(false);
}
WordSpace.nameQueue =
{
queue: [],
......@@ -414,13 +409,18 @@ WordSpace.nameQueue =
if(element.nickname != PlayerData.nickname && element.isAlive)
WordSpace.nameQueue.queue.push(element);
});
console.log(WordSpace.nameQueue.queue);
console.log(RoomData.aliveCount);
/*console.log(WordSpace.nameQueue.queue);
console.log(RoomData.aliveCount);*/
},
pop: function()
{
let tempElement = WordSpace.nameQueue.queue.pop();
let tempElement = WordSpace.nameQueue.queue.shift();
if(WordSpace.nameQueue.queue.length <= RoomData.aliveCount) this.shuffle();
return tempElement;
},
initiate: function()
{
this.shuffle();
this.shuffle();
}
}
\ No newline at end of file
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