Commit 406cf127 authored by 18손재민's avatar 18손재민

이제 모든 플레이어들에게 종이뭉치가 날라가는 것이 보임

parent 5efa8948
...@@ -140,10 +140,13 @@ socket.on('attackMode', function(msg) // number playerId ...@@ -140,10 +140,13 @@ socket.on('attackMode', function(msg) // number playerId
console.log(msg + ' is on attack Mode'); console.log(msg + ' is on attack Mode');
// msg의 id를 가진 사람이 attack Mode이다. // msg의 id를 가진 사람이 attack Mode이다.
}); });
socket.on('attack', function(msg) // {number attackerId, number targetId} socket.on('someoneAttacked', function(msg) // {number attackerId, number targetId}
{ {
// 이때 위의 attack Mode인 사람(msg.attackerId)을 해제해주자. // 이때 위의 attack Mode인 사람(msg.attackerId)을 해제해주자.
console.log(msg.attackerId + ' attack to ' + msg.targetId); console.log(msg.attackerId + ' attacked ' + msg.targetId);
let attackerPos = RoomData.players.find(function(element){ return element.id == msg.attackerId; });
let victimPos = RoomData.players.find(function(element){ return element.id == msg.victimId; });
WordSpace.makeAttackPaper(ScenesData.gameScene, attackerPos.position, victimPos.position);
}); });
socket.on('attacked', function(msg) // object attackData socket.on('attacked', function(msg) // object attackData
{ {
...@@ -161,11 +164,6 @@ socket.on('attacked', function(msg) // object attackData ...@@ -161,11 +164,6 @@ socket.on('attacked', function(msg) // object attackData
attackedEvent.resetCycle(ScenesData.gameScene, 4000, 0, false); attackedEvent.resetCycle(ScenesData.gameScene, 4000, 0, false);
WordSpace.attackedEvents.push(attackedEvent); WordSpace.attackedEvents.push(attackedEvent);
console.log(msg.attacker);
console.log(msg.victim);
let victimPos = RoomData.players.find(function(element){ return element.id == msg.victim.id; });
let attackerPos = RoomData.players.find(function(element){ return element.id == msg.attacker.id; });
WordSpace.makeAttackPaper(ScenesData.gameScene, attackerPos.position, victimPos.position);
//console.log(timeout); //console.log(timeout);
}); });
socket.on('defeat', function(msg) // object player socket.on('defeat', function(msg) // object player
......
...@@ -95,7 +95,7 @@ io.on('connection', function(socket) ...@@ -95,7 +95,7 @@ io.on('connection', function(socket)
socket.on('attack', function(msg) socket.on('attack', function(msg)
{ {
socket.playerData.currentRoom.announceToTarget(msg.victim.id, 'attacked', msg); socket.playerData.currentRoom.announceToTarget(msg.victim.id, 'attacked', msg);
socket.playerData.currentRoom.announceToRoom('attack', {attackerId: msg.attacker.id, targetId: msg.victim.id}); socket.playerData.currentRoom.announceToRoom('someoneAttacked', {attackerId: msg.attacker.id, victimId: msg.victim.id});
//console.log('attack ' + msg.target + ' by ' + msg.attacker.id + ' with ' + msg.text); //console.log('attack ' + msg.target + ' by ' + msg.attacker.id + ' with ' + msg.text);
setTimeout(function() setTimeout(function()
{ {
......
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