view LightClone/Source/Bot.h @ 64:3507bd831c7f

Hook up ServiceProvider
author koryspansel <koryspansel@bendbroadband.com>
date Tue, 04 Oct 2011 13:02:45 -0700
parents 00d17d8f407d
children 41980ff0607d
line wrap: on
line source

/*
 * Bot
 */

#ifndef __BOT_H__
#define __BOT_H__

#include "Core.h"
#include "RenderContext.h"
#include "ResourceManager.h"
#include "VirtualMachine.h"
#include "Environment.h"
#include "Clock.h"
#include "Program.h"
#include "ServiceProvider.h"

/*
 * BotState
 */
enum
{
	BotState_Idle,
	BotState_Evaluate,
	BotState_Animate,
	BotState_Pause,
};

/*
 * BotSequence
 */
enum
{
	BotSequence_Forward,
	BotSequence_RotateCW,
	BotSequence_RotateCCW,
	BotSequence_Jump,
	BotSequence_Light,
};

/*
 * Bot
 */
class Bot
{
	/*
	 * BotSequencer
	 */
	struct BotSequencer
	{
		/*
		 * nSequence
		 */
		uint32 nSequence;

		/*
		 * fTimer
		 */
		float fTimer;

		/*
		 * fSpeed
		 */
		float fSpeed;

		/*
		 * kPosition
		 */
		Position kPosition;

		/*
		 * kDirection
		 */
		uint32 kDirection;

		/*
		 * nColor
		 */
		uint32 nColor;
	};

private:

	/*
	 * pEffect
	 */
	ID3DXEffect* pEffect;

	/*
	 * pVertexBuffer
	 */
	IDirect3DVertexBuffer9* pVertexBuffer;

	/*
	 * pTexture
	 */
	IDirect3DTexture9* pTexture;

	/*
	 * pEnvironment
	 */
	Environment* pEnvironment;

	/*
	 * kMachine
	 */
	VirtualMachine kMachine;

	/*
	 * kClock
	 *	The clock used to keep track of VM execution
	 */
	Clock kClock;

	/*
	 * nState
	 */
	uint32 nState;

	/*
	 * kSequencer
	 */
	BotSequencer kSequencer;

	/*
	 * kPosition
	 */
	Position kPosition;

	/*
	 * kDirection
	 */
	uint32 kDirection;

	/*
	 * nColor
	 */
	uint32 nColor;

	/*
	 * kSize
	 */
	D3DXVECTOR3 kSize;

public:

	/*
	 * Bot
	 */
	Bot();

	/*
	 * Reset
	 */
	ErrorCode Initialize(ServiceProvider* pServiceProvider);

	/*
	 * Terminate
	 */
	void Terminate();

	/*
	 * Setup
	 */
	void Setup(Environment* pInstance);

	/*
	 * Reset
	 */
	void Reset();

	/*
	 * SetPosition
	 */
	void SetPosition(const Position& kPosition);

	/*
	 * SetDirection
	 */
	void SetDirection(uint32 nDirection);

	/* 
	 * GetWorldPosition
	 */
	const D3DXVECTOR3 GetWorldPosition() const;

	/*
	 * GetWorldOrientation
	 */
	const D3DXVECTOR3 GetWorldOrientation() const;

	/*
	 * Upload
	 */
	ErrorCode Upload(const Program& kProgram);

	/*
	 * Update
	 */
	bool Update(float fElapsed);

	/*
	 * Render
	 */
	void Render(RenderContext& kContext, Camera& kCamera);

private:
	
	/*
	 * SetupVertexBuffer
	 */
	ErrorCode SetupVertexBuffer();
};

#endif //__BOT_H__