#pragma once

#include "Game.h"



#include "../vsgl3/glHelper.h"

class PLayerTankGraphics : public IGraphicsObject
{
public:

  PLayerTankGraphics();
  ~PLayerTankGraphics();

  void draw(float4x4 worldViewMatrix, float4x4 projectionMatrix) const;
  void translate(float3 a_pos);
  void rotateY(float angle);

  void animateStart(int a_flags, float a_timeStart);

  // PLayerTankGraphics only methods
  //
  void rotateTurret(float a_angle) { m_turretAngle = a_angle; }

protected:

  ShaderProgram* m_pProgram;
  //SimpleMesh*    m_pMesh;
  Texture2D*     m_pTex;

  SimpleMesh*    m_pTurret;
  SimpleMesh*    m_pCorpus;

  float3 m_translateToWorldPos;
  float  m_rotY;

  float  m_turretAngle;

  float3 m_prevCellPos;
  float  m_prevRotAngle;
  int    m_animType;
  float  m_animTimeStart;

};



class Player : public IGameObject
{

public:

  Player(int a_x, int a_y);
  ~Player();

  std::vector<IGraphicsObject*> getDrawList();
  void move(int a_flags, int a_cells);

  // PLayer only methods
  //
  void rotateTurret(float a_angle)
  {
    PLayerTankGraphics* pTank = dynamic_cast<PLayerTankGraphics*>(m_pMesh);
    if (pTank == NULL)
      return;
    pTank->rotateTurret(a_angle);
  }

  bool inputIsBlocked();

protected:

  IGraphicsObject* m_pMesh;
  float m_animTimeStart;
};

