CSC8503_Advanced_Game_Technologies / CSC8503 / GameTech / RacecourseSingleGame.h
RacecourseSingleGame.h
Raw
#pragma once
#include "GameTechRenderer.h"
#include "../CSC8503Common/PhysicsSystem.h"
#include "../CSC8503Common/PlayerObject.h"
#include "../CSC8503Common/BonusObject.h"
#include "../CSC8503Common/SnowObject.h"

namespace NCL
{
	namespace CSC8503
	{
		class RacecourseSingleGame {
		public:
			RacecourseSingleGame();
			virtual ~RacecourseSingleGame();

			virtual void UpdateGame(float dt);
			bool IsOver() { return gameFinished; }
	
		protected:
			void InitialiseAssets();

			void InitCamera();
			void UpdateKeys(float dt);

			void InitWorld();

			void EndGame(float dt);
			void DisplayGrid();

			void MovePlayerCharacter(float dt);
			void CameraMovement();

			bool SelectObject();
			void MoveSelectedObject();

			void ChangePlayerColourOnSnow(float dt);


			GameObject* AddFloorToWorld(const Vector3& position, const Vector3& scale, const Vector4& colour, const int collisionResolution);

			PlayerObject* AddPlayerToWorld(const Vector3& position);

			GameObject* AddCubeToWorld(const Vector3& position, Vector3 dimensions, float inverseMass, const Vector4& colour = Vector4(1,1,1,1));
			GameObject* AddSphereToWorld(const Vector3& position, float radius, float inverseMass, const Vector4& colour = Vector4(1, 1, 1, 1));

			GameObject* AddCharacterToWorld(const Vector3& position);

			GameObject* AddWallToWorld(const Vector3& position, const Vector3& scale, const Vector4& colour = Vector4(0.5,0.5,0.5,1));

			GameObject* AddRampToWorld(const Vector3& position, const Vector3& scale, const Vector3& rotation, const float inverseMass);

			void AddGateToWorld(const Vector3& position, const Vector3& rotation);
			void AddFinishGateToWorld(const Vector3& position, const Vector3& rotation);

			void AddJellyToWorld(const Vector3& position);
			void AddSnowToWorld(const Vector3& position);

			GameObject* AddBonusToWorld(const Vector3& position, const Vector4& colour = Vector4(1, 1, 1, 1));

			void PlayerAbillity();
		
			std::vector<GameObject*> movables;
			std::vector<GameObject*> movableDoors;
			std::vector<GameObject*> movablePlatforms;
			std::vector<GameObject*> obstacles;
			std::vector<GameObject*> obstacleDoors;
			std::vector<GameObject*> obstacleMaze;
			std::vector<GameObject*> bonus;

			GameTechRenderer* renderer;
			PhysicsSystem* physics;
			GameWorld* world;

			bool useGravity;
			bool inSelectionMode;

			float	forceMagnitude;

			GameObject* selectionObject = nullptr;

			float levelTimer = 0.0f;
			float endGameTimer = 0.0f;
			float jumpTimer = 0.0f;
			float snowTimer = 0.0f;
			bool gameFinished = false;
			bool levelCompleted = false;

			Vector4 playerOriginalColour;

			void DrawDisplay(float dt);

			OGLMesh* capsuleMesh = nullptr;
			OGLMesh* cubeMesh = nullptr;
			OGLMesh* sphereMesh = nullptr;
			OGLTexture* basicTex = nullptr;
			OGLShader* basicShader = nullptr;

			//Coursework Meshes
			OGLMesh* charMeshA = nullptr;
			OGLMesh* charMeshB = nullptr;
			OGLMesh* enemyMesh = nullptr;
			OGLMesh* bonusMesh = nullptr;

			//States
			SnowObject* AddSnowFloorToWorld(const Vector3& position, const Vector3& scale, const Vector4& colour, const int collisionResolution);
			SnowObject* snowObject = nullptr;

			//Coursework Additional functionality	
			GameObject* lockedObject = nullptr;
			Vector3 lockedOffset = Vector3(0, 14, 20);
			//Vector3 lockedOffset = Vector3(0, 5, 20);
			void LockCameraToObject(GameObject* o) {
				lockedObject = o;
			}

			PlayerObject* playerCharacter = nullptr;
			

			unsigned int sphereNr = 0;
		};
	}
}