//	Zombie.h - Class representing a zombie.
//  ----------------------------------------------------------------------------
//	This file is part of 'NiallsAVLib', base code for any kind of audiovisual
//	apps.
//	Copyright (C) 2012  Niall Moody
//	
//	This program is free software: you can redistribute it and/or modify
//	it under the terms of the GNU General Public License as published by
//	the Free Software Foundation, either version 3 of the License, or
//	(at your option) any later version.
//
//	This program is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU General Public License
//	along with this program.  If not, see <http://www.gnu.org/licenses/>.
//	----------------------------------------------------------------------------

#ifndef ZOMBIE_H_
#define ZOMBIE_H_

#include "ThreeFloats.h"
#include "NPC.h"

class GamePlayState;
class Tank;

///	Class representing a zombie.
class Zombie : public NPC
{
  public:
	///	Constructor.
	Zombie(const TwoFloats& pos, const ThreeFloats& col);
	///	Destructor.
	~Zombie();

	///	Moves the Zombie.
	void update(GamePlayState& state);
	///	Draws the Zombie.
	void draw(shared_ptr<Drawer>& d, float timestepInterp);

	///	Multiplies the zombie's global speed by the passed-in value.
	/*!
		This is used to speed up/slow down zombies when moving through
		speed/slow field puddles. It is reset at the end of each update() call.
	 */
	void multiplyGlobalSpeed(float val);

	///	Returns true if the Zombie is dead.
	bool getDead() {return dead;};
	///	Returns the Zombie's colour.
	const ThreeFloats& getColour() const {return colour;};

	///	Sets the zombie's position.
	void setPosition(const TwoFloats& pos);

	///	Returns true if this entity wants to know when it collides with the named entity type.
	bool interestedInCollisionsWith(const std::wstring& entity) const;
	///	Called when this entity collides with another.
	bool collide(const shared_ptr<Collidable>& other, GamePlayState& state);

	///	Returns the entity's position.
	const TwoFloats& getPosition() const {return position;};
	///	Returns the entity's radius.
	float getRadius() const {return 12.0f;};
	///	Returns true if other entities can pass through this one.
	/*!
		If this is true, collide() will only be called for this entity, rather
		than both of the entities involved (i.e. Pickups will be informed that a
		Tank collided with them, but the Tank will not be told that).
	 */
	bool getIncorporeal() const {return false;};
  private:
	///	The Zombie's position.
	TwoFloats position;
	///	The Zombie's direction.
	TwoFloats direction;
	///	The Zombie's desired direction.
	TwoFloats desiredDirection;
	///	The Zombie's colour.
	ThreeFloats colour;

	///	The zombie's global speed (for speed/slow puddles).
	float globalSpeed;

	///	Counter used to update desired direction.
	int directionCount;

	///	Used to make the zombie invulnerable for a short time after its birth.
	int birthCount;
	///	True if the Zombie is dead.
	bool dead;
};

#endif
