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