diff --git a/entities/FactionComponent.cpp b/entities/FactionComponent.cpp deleted file mode 100644 index 8d7d622..0000000 --- a/entities/FactionComponent.cpp +++ /dev/null @@ -1,92 +0,0 @@ -#include "FactionComponent.h" -namespace BS { - namespace Player { - bool FactionComponent::getSend(){ - return this->send; - } - void FactionComponent::setSend(bool value) - { - this->send = value; - } - int FactionComponent::getSTeam() - { - return this->sTeam; - } - void FactionComponent::setSTeam(int value) - { - this->sTeam = value; - this->send = true; - } - int FactionComponent::getCTeam() - { - return this->cTeam; - } - void FactionComponent::setCTeam(int value) - { - this->cTeam = value; - } - FactionComponent::FactionComponent(WorldEntity* owner) - { - MOB = 4; - PLAYER = 3; - TEAM_BLUE = 2; - TEAM_RED = 1; - NONE = 0; - this->owner = owner; - } - void FactionComponent::Update() - { - if (this->send) { - this->send = false; - this->SSendTeam(this->sTeam); - } - } - void FactionComponent::SSendTeam(int team) - { - if (CxNet::IsServer) { - SSendTeamMsg sSendTeamMsg = SSendTeamMsg(); - sSendTeamMsg.Guid = this->owner->PlayerData->GUID; - sSendTeamMsg.Team = team; - sSendTeamMsg.Serialize(CxNet::NetBuffer); - CxNet::SendBufferToAllClients(0); - } - } - void FactionComponent::CReceiveSSendTeam(int team) - { - this->setCTeam(team); - } - bool FactionComponent::SIsEnemy(WorldEntity* player) - { - return player->getFactionComponent()->STeam != this->getSTeam(); - } - bool FactionComponent::CIsEnemy(WorldEntity* player) - { - return player->getFactionComponent()->CTeam != this->getCTeam(); - } - void FactionComponent::ToJSON(JsonWriter* w) - { - w->WritePropertyName(new String("PlayerFacingComponent")); - w->WriteStartObject(); - w->WritePropertyName(new String("STeam")); - w->WriteValue(this->getSTeam()); - w->WriteEndObject(); - } - void FactionComponent::FromJSON(JsonReader* r) - { - while (r->Read()) { - if (r->TokenType == JsonToken::PropertyName) { - String* a = (String*)(r->Value); - if (*a == *(new String("STeam"))) { - this->setSTeam(r->ReadAsInt32()->Value); - } - } - else { - if (r->TokenType == JsonToken::EndObject) { - break; - } - } - } - } - - } -} diff --git a/entities/FactionComponent.h b/entities/FactionComponent.h deleted file mode 100644 index df374db..0000000 --- a/entities/FactionComponent.h +++ /dev/null @@ -1,73 +0,0 @@ -#pragma once -#include -#include "WorldEntity.h" -#include "CxNet.h" -#include "SSendTeamMsg.h" -#include "JsonWriter.h" -#include "JsonReader.h" -#include "JsonToken.h" - -using namespace System; -using namespace UnityEngine; -using namespace CxNetworking; -using namespace BS::Networking; -using namespace Newtonsoft::Json; -namespace BS { - namespace Player { - //Forward Declaration - class WorldEntity; - - //Attribute: Serializable* - class FactionComponent : public virtual Object{ - public: - int NONE; - public: - int TEAM_RED; - public: - int TEAM_BLUE; - public: - int PLAYER; - public: - int MOB; - //Attribute: SerializeField* - private: - int sTeam; - //Attribute: SerializeField* - private: - int cTeam; - //Attribute: SerializeField* - private: - bool send; - private: - WorldEntity* owner; - public: - bool getSend(); - public: - void setSend(bool value); - public: - int getSTeam(); - public: - void setSTeam(int value); - public: - int getCTeam(); - public: - void setCTeam(int value); - public: - FactionComponent(WorldEntity* owner); - public: - void Update(); - public: - void SSendTeam(int team); - public: - void CReceiveSSendTeam(int team); - public: - bool SIsEnemy(WorldEntity* player); - public: - bool CIsEnemy(WorldEntity* player); - public: - void ToJSON(JsonWriter* w); - public: - void FromJSON(JsonReader* r); - }; - } -}