Implemented a Kraken State Machine that can grab the player, and the Generating Bricks option.
This commit is contained in:
@@ -19,6 +19,7 @@ struct Brick : Component
|
||||
//0 = empty, 1 = normal, 2 = multi-brick, 3 = lifebuoy, 4 = sticky, 5 = blaster, 6 = kraken
|
||||
int Type = 0;
|
||||
bool Removed = false;
|
||||
int Number = 0; // For the Kraken to keep track of which bricks needs replacing.
|
||||
|
||||
//What number of types each is.
|
||||
const int EmptyBrickSpace = 0;
|
||||
|
||||
@@ -16,7 +16,14 @@ namespace Components
|
||||
struct Kraken : Component {
|
||||
|
||||
int Health = 10;
|
||||
|
||||
int CurrentAction = 1;
|
||||
|
||||
const int Idle = 1;
|
||||
const int Grabbing = 2;
|
||||
const int Taunting = 3;
|
||||
const int Moving = 4;
|
||||
const int BrickGenerating = 5;
|
||||
// Idle. Generating bricks. Taunting. No idea.
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// Created by Adniklastrator on 2015-10-16.
|
||||
//
|
||||
|
||||
#ifndef DAYDREAM_EBRICKGENERATING_H
|
||||
#define DAYDREAM_EBRICKGENERATING_H
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct BrickGenerating : Event
|
||||
{
|
||||
glm::vec3 Origin;
|
||||
int TargetLine;
|
||||
int Set;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif //DAYDREAM_EBRICKGENERATING_H
|
||||
@@ -5,6 +5,7 @@
|
||||
#ifndef DAYDREAM_KRAKENSYSTEM_H
|
||||
#define DAYDREAM_KRAKENSYSTEM_H
|
||||
|
||||
#include <random>
|
||||
|
||||
#include "Core/System.h"
|
||||
#include "Core/CTransform.h"
|
||||
@@ -15,9 +16,11 @@
|
||||
#include "Physics/CRectangleShape.h"
|
||||
#include "Physics/CCircleShape.h"
|
||||
#include "Physics/CPhysics.h"
|
||||
#include "Physics/EContact.h"
|
||||
#include "Game/EPause.h"
|
||||
#include "Game/EKrakenAppear.h"
|
||||
#include "Game/EKrakenAttack.h"
|
||||
#include "Game/EBrickGenerating.h"
|
||||
#include "Game/CTravels.h"
|
||||
#include "Game/CKraken.h"
|
||||
#include "Sound/CCollisionSound.h"
|
||||
@@ -40,20 +43,37 @@ public:
|
||||
void Initialize() override;
|
||||
void InitializeObjects();
|
||||
|
||||
void Update(double dt) override;
|
||||
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
|
||||
|
||||
bool IsPaused() const { return m_Pause; }
|
||||
void SetPause(const bool& pause) { m_Pause = pause; }
|
||||
private:
|
||||
std::mt19937 m_RandomGenerator;
|
||||
|
||||
bool m_Pause = false;
|
||||
bool m_KrakenBattle = false;
|
||||
bool m_ReturnToIdle = false;
|
||||
EntityID m_KrakenTemplate;
|
||||
std::string m_Action = "Idle";
|
||||
float m_KrakenTimer = 0;
|
||||
float m_KrakenSecondsToAction = 1;
|
||||
const int Idle = 1;
|
||||
|
||||
std::array<int, 14> m_Bricks;
|
||||
std::array<int, 14> m_Colors;
|
||||
|
||||
dd::EventRelay<KrakenSystem, dd::Events::Pause> m_EPause;
|
||||
dd::EventRelay<KrakenSystem, dd::Events::Contact> m_EContact;
|
||||
dd::EventRelay<KrakenSystem, dd::Events::KrakenAppear> m_EKrakenAppear;
|
||||
dd::EventRelay<KrakenSystem, dd::Events::KrakenAttack> m_EKrakenAttack;
|
||||
dd::EventRelay<KrakenSystem, dd::Events::BrickGenerating> m_EBrickGenerating;
|
||||
bool OnPause(const dd::Events::Pause &event);
|
||||
bool OnContact(const dd::Events::Contact &event);
|
||||
bool OnKrakenAppear(const dd::Events::KrakenAppear &event);
|
||||
bool OnKrakenAttack(const dd::Events::KrakenAttack &event);
|
||||
bool OnBrickGenerating(const dd::Events::BrickGenerating &event);
|
||||
void GetBrickSet();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "Game/EPowerUpTaken.h"
|
||||
|
||||
#include "Game/EKrakenAppear.h"
|
||||
#include "Game/EBrickGenerating.h"
|
||||
|
||||
#include "Physics/CPhysics.h"
|
||||
#include "Physics/CCircleShape.h"
|
||||
@@ -91,7 +92,7 @@ public:
|
||||
|
||||
void CreateBasicLevel(int, int, glm::vec2, float);
|
||||
void CreateLevel(int);
|
||||
void CreateBrick(int, int, glm::vec2, float, int, int, int, glm::vec4);
|
||||
EntityID CreateBrick(int, int, glm::vec2, float, int, int, int, glm::vec4);
|
||||
void BrickHit(EntityID, EntityID, int);
|
||||
|
||||
void OnEntityRemoved(EntityID entity);
|
||||
@@ -135,7 +136,7 @@ private:
|
||||
bool m_Initialized = false;
|
||||
bool m_Pause = false;
|
||||
int m_LooseBricks = 0;
|
||||
int m_CurrentCluster = 0;
|
||||
int m_CurrentCluster = 1;
|
||||
int m_CurrentLevel = 1;
|
||||
int m_MultiBalls = 0;
|
||||
int m_PowerUps = 0;
|
||||
@@ -162,6 +163,9 @@ private:
|
||||
std::array<int, 42> m_Bricks;
|
||||
std::array<glm::vec4, 42> m_Colors;
|
||||
|
||||
std::array<int, 14> m_BrickSet;
|
||||
std::array<glm::vec4, 14> m_ColorSet;
|
||||
|
||||
dd::EventRelay<LevelSystem, dd::Events::Contact> m_EContact;
|
||||
dd::EventRelay<LevelSystem, dd::Events::ScoreEvent> m_EScoreEvent;
|
||||
dd::EventRelay<LevelSystem, dd::Events::MultiBall> m_EMultiBall;
|
||||
@@ -171,6 +175,7 @@ private:
|
||||
dd::EventRelay<LevelSystem, dd::Events::StageCleared> m_EStageCleared;
|
||||
dd::EventRelay<LevelSystem, dd::Events::Pause> m_EPause;
|
||||
dd::EventRelay<LevelSystem, dd::Events::HitPad> m_EHitPad;
|
||||
dd::EventRelay<LevelSystem, dd::Events::BrickGenerating> m_EBrickGenerating;
|
||||
|
||||
bool OnContact(const dd::Events::Contact &event);
|
||||
bool OnScoreEvent(const dd::Events::ScoreEvent &event);
|
||||
@@ -181,6 +186,8 @@ private:
|
||||
bool OnStageCleared(const dd::Events::StageCleared &event);
|
||||
bool OnPause(const dd::Events::Pause &event);
|
||||
bool OnHitPad(const dd::Events::HitPad &event);
|
||||
bool OnBrickGenerating(const dd::Events::BrickGenerating &event);
|
||||
void GetBrickSet(int Set);
|
||||
|
||||
void GetNextLevel();
|
||||
void SetBrokenModel(EntityID entity);
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
#include "Game/EScreenShake.h"
|
||||
#include "Game/EActionButton.h"
|
||||
|
||||
#include "Game/EBrickGenerating.h"
|
||||
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#ifndef DAYDREAM_SCREENSHAKESYSTEM_H
|
||||
#define DAYDREAM_SCREENSHAKESYSTEM_H
|
||||
|
||||
#include <random>
|
||||
|
||||
#include "Core/System.h"
|
||||
#include "Core/CTransform.h"
|
||||
@@ -38,6 +39,8 @@ public:
|
||||
bool IsPaused() const { return m_Pause; }
|
||||
void SetPause(const bool& pause) { m_Pause = pause; }
|
||||
private:
|
||||
std::mt19937 m_RandomGenerator;
|
||||
|
||||
bool m_Pause;
|
||||
bool m_ScreenShake;
|
||||
int m_ShakeIntensity;
|
||||
|
||||
Reference in New Issue
Block a user