70 lines
1.5 KiB
C++
70 lines
1.5 KiB
C++
#include "remoteplayer.h"
|
|
#include <iostream>
|
|
#include <cstring>
|
|
|
|
|
|
RemotePlayer::RemotePlayer(netprot::PlayerInfo pinfo) : Player(Vector3f(0, 0, 0), 0, 0), m_pinfo(pinfo), m_aminacc(0.0f), m_animstate(Anim::STILL), m_team_id(0), current(), previous() {
|
|
|
|
}
|
|
|
|
void RemotePlayer::Init() {
|
|
|
|
}
|
|
|
|
void RemotePlayer::Feed(const netprot::Output out) {
|
|
|
|
current.position = out.position;
|
|
current.direction = out.direction;
|
|
current.states = out.states;
|
|
current.id = out.id;
|
|
|
|
//a revoir pour le jump et le shoot en meme temps lorsque les test seront possible
|
|
|
|
if (current.position != previous.position)
|
|
{
|
|
Vector3f positionDelta = current.position - previous.position;
|
|
m_position = current.position + positionDelta;
|
|
m_direction = current.direction;
|
|
|
|
}
|
|
|
|
if(current.direction != previous.direction)
|
|
{
|
|
m_direction = current.direction;
|
|
current.direction = current.direction;
|
|
}
|
|
|
|
if (current.states.shooting) {
|
|
//true;
|
|
m_animstate = Anim::SHOOTING;
|
|
}
|
|
else if (current.states.jumping) {
|
|
//true;
|
|
m_animstate = Anim::JUMPING;
|
|
}
|
|
else if (current.states.dead) {
|
|
//true;
|
|
m_animstate = Anim::DEAD;
|
|
}
|
|
else if(current.states.powerup){
|
|
//true;
|
|
m_animstate = Anim::POWERUP;
|
|
}
|
|
else if (current.states.still) {
|
|
//true;
|
|
m_animstate = Anim::STILL;
|
|
}
|
|
else if (current.states.running) {
|
|
//true;
|
|
m_animstate = Anim::RUNNING;
|
|
}
|
|
|
|
|
|
previous.direction = current.direction;
|
|
previous.position = current.position;
|
|
previous.states = current.states;
|
|
previous.id = current.id;
|
|
|
|
|
|
|
|
} |