#pragma once

#include "sprite.h"

enum ObjectType {
	Object_Volcano,

	Object_Collectible0_0,
	Object_Collectible0_1,
	Object_Collectible0_2,
	Object_Collectible0_3,
	Object_Collectible0_4,

	Object_Collectible1_0,
	Object_Collectible1_1,
	Object_Collectible1_2,
	Object_Collectible1_3,
	Object_Collectible1_4,

	Object_Collectible2_0,
	Object_Collectible2_1,
	Object_Collectible2_2,
	Object_Collectible2_3,
	Object_Collectible2_4,

	Object_Collectible3_0,
	Object_Collectible3_1,
	Object_Collectible3_2,
	Object_Collectible3_3,
	Object_Collectible3_4,

	Object_Decoration0_0,
	Object_Decoration0_1,
	Object_Decoration0_2,
	Object_Decoration0_3,
	Object_Decoration0_4,
	Object_Decoration1_0,
	Object_Decoration1_1,
	Object_Decoration1_2,
	Object_Decoration1_3,
	Object_Decoration1_4,
	Object_Decoration2_0,
	Object_Decoration2_1,
	Object_Decoration2_2,
	Object_Decoration2_3,
	Object_Decoration2_4,

	Object_Cloud0,
	Object_Meteor,
	Object_Building0,
	Object_Building1,
	Object_Building2,
	Object_Building3,
	Object_Rocket,
	Object_Particle
};

enum ParticleType {
	Particle_Lava,
	Particle_Smoke
};

class GameFrame;

class GamePlanetObject : public Sprite {
public:
	GamePlanetObject(Vector2f center, float dist, float baseAngle, ObjectType type, GameFrame* frame);
	virtual ~GamePlanetObject() {}

	virtual bool step(float t, float at);
	virtual void setAngle(float ang);
	void setCenter(Vector2f c) { center = c; }
	void setDist(float d) { dist = d; }
	void setTimeLeft(float t, float stageTotal);
	ObjectType getType() const { return type; }

	void setActivationTime(float t) { activationTime = t; }
	bool isActive() { return elapsedTime >= activationTime; }

	void render(Renderer& renderer) const;

	static int getCollectibleGroup(ObjectType type);
	static String getCollectibleCode(ObjectType type);
	static String getCollectibleImage(ObjectType type);
	static String getCollectibleAnimation(ObjectType type);
	static String getCollectibleName(ObjectType type);

protected:

	void init(String name, Vector2f offset, float distOff, float colRadius, Collision::Mask colType);
	void spawnParticle(float dist, float baseAngle, Vector2f vel, float ttl, ParticleType type);

	spInputBase input;

	ObjectType type;
	float baseAngle;
	float dist;
	float baseDist;
	float speed;
	float speedY;
	float cooldown;
	float shooting;
	float activationTime;
	float elapsedTime;
	float activity;
	GameFrame* frame;
	Vector2f center;
};

typedef shared_ptr<GamePlanetObject> spGamePlanetObject;
