#include "SittingEnemy.h"
#include "LD.h"
#include "Level.h"
#include "Player.h"

#include <list>



SittingEnemy::SittingEnemy() :
  GameObject( LD::GO_SITTING_ENEMY )
{
  m_Texture = LD::TEX_SITTING_ENEMY_1;
  Width = 32;
  Height = 32;
  AnimDelay = 0.0f;
  SizeFactor = 0.25f;
  pTarget = NULL;
}


void SittingEnemy::Display()
{
  //GameObject::Display();
  int     trueWidth = (int)( Width * SizeFactor );
  int     trueHeight = (int)( Height * SizeFactor );
  theApp.RenderTextureSection2d( X - trueWidth / 2, Y - trueHeight / 2, 
                                 theApp.m_TexSec[m_Texture], 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 
                                 trueWidth, trueHeight );
}



void SittingEnemy::Update( Level& Level, float ElapsedTime )
{
  AnimDelay += ElapsedTime;
  if ( fmodf( AnimDelay, 0.5f ) >= 0.25f )
  {
    m_Texture = LD::TEX_SITTING_ENEMY_1;
  }
  else
  {
    m_Texture = LD::TEX_SITTING_ENEMY_2;
  }

}



RECT SittingEnemy::Bounds()
{
  RECT    rc;

  int     trueWidth = (int)( Width * SizeFactor );
  int     trueHeight = (int)( Height * SizeFactor );

  SetRect( &rc, X - trueWidth / 2, Y - trueHeight / 2, X + trueWidth / 2, Y + trueHeight / 2 );

  return rc;
}



