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

namespace NCL {
	namespace CSC8503 {
		class MultiGame {
		public:
			MultiGame(int enemies);
			virtual ~MultiGame();

			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();

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

			PlayerObject* AddPlayerToWorld(const Vector3& position);

			GameObject* AddAIOpponentToWorld(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 MoveEnemies(float dt);

			std::vector<GameObject*> obstacles;
			std::vector<GameObject*> bonus;

			std::vector<AIOpponentObject*> enemies;

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

			bool useGravity;
			bool inSelectionMode;

			float	forceMagnitude;

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


			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;

			Vector4 playerOriginalColour;

			void DrawDisplay(float dt);

			bool SelectObject();

			//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;

			GameObject* selectionObject = nullptr;

			int numberOfEnemies;
		};
	}
}