#pragma once

#include	"Common.h"

// class for handling ONE alien
class CAlien
{
public:
	// constructor and destructor
	CAlien();
	~CAlien();

	void	Reset();
	void	Update();

	// check sprite -> alien collision 
	int		CheckCollision(int iSprite)											{ return agk::GetSpriteCollision(iSprite, m_iShipSprID); }

	// set position of alien, ship with engine
	void	SetPosition(float fX, float fY)										{ agk::SetSpritePosition(m_iShipSprID, fX, fY); agk::SetParticlesPosition(m_iEnginePfxID, fX, fY); }

	void	GetPosition(float *fX, float *fY);

private:
	friend class CAliens;

	//	ship sprite and engine particle effect id's
	int			m_iShipSprID		= 0;
	int			m_iEnginePfxID		= 0;

	//	ship speed
	float		m_fSpeed			= 0.0f;

	//	flying wave form
	float		m_fValueA			= 0.0f;
	float		m_fValueB			= 0.0f;

	//	image id's for ship-sprite and engine-particles
	//	here we use the id's defined in 'Common.h'
	int			m_iShipImgID		= IMGID_ALIENSHIP;
	int			m_iParticleImgID	= IMGID_ALIENPARTICLE;
};

// class for handling explosions
class CExplosion
{
public:
	// constructor and destructor
	CExplosion();
	~CExplosion();

	void	Refresh();

	// check if explosion active
	int		IsActive()															{ return m_iActive; };

	void	Explode(float fX, float fY);

private:
	friend class CAliens;

	// particle effect id for explosion
	int		m_iParticlePfxID	= 0;

	// state flag
	int		m_iActive			= 0;
};

// class for handling ALL aliens
class CAliens
{
public:
	// constructor and destructor
	CAliens();
	~CAliens();

	//void	CreateAliens();
	void	CreateAlienExplosions();
	void	UpdateAliens();
	void	ResetAliens();
	void	ExplodeAlien(float x, float y);
	CAlien*		CheckCollisionWithAliens(int iSprite);

private:
	//	use 10 aliens
	CAlien		m_AliensSprID[10]		= {};

	// use 5 explosions
	CExplosion	m_ExplosionsPfxID[5]	= {};
};

