Compare commits

..

34 Commits

Author SHA1 Message Date
Jace 9b98bbbea8 Fields are now set to dirty when they're changed! 2016-03-12 01:26:03 +01:00
Jace 80649ce51d Updated the ENTIRE CODEBASE TO MATCH 2016-03-12 00:38:33 +01:00
Jace a4b0b108d4 Created a wrapper for field types that is able to detect changes to set dirty flags in the future 2016-03-12 00:38:26 +01:00
Jace b7d93058b1 Added base work for dity bits in components 2016-03-08 21:11:59 +01:00
Jace 5d53fc74cb Merge branch 'Dirtybit' of github.com:teamfisk/TacticalZ into Dirtybit 2016-03-08 15:46:21 +01:00
Jace ecc8d998cf Added ComponentInfo::Field_t::Index 2016-03-08 15:46:14 +01:00
William Moberg e3c0fb2178 Added SetDirty function. 2016-03-08 15:44:02 +01:00
William Moberg 090bd806ce Added DirtyBit enum to Dirty getter in ComponentWrapper. 2016-03-08 15:39:16 +01:00
William Moberg 3436ba6656 Merge pull request #177 from teamfisk/AmmoPickup
Fixed some systems added twice in Game.cpp
2016-03-08 09:46:36 +01:00
verysecrethero fc3a3a8f2e Fixed a crashbug in Ammo/HealthPickup which was actually caused by systems being added twice in Game.cpp. This is also a possible fix for DamageIndicator,Capturepoint,TextField,KillFeed 2016-03-07 17:16:18 +01:00
Tobias Dahl 3edc2f4819 Merge pull request #174 from teamfisk/CapturePointFixBranch
CapturePoints now have red/blue/spectator model-children
2016-03-07 15:25:22 +01:00
Adam Byléhn 9c3fa25834 Merge pull request #176 from teamfisk/PlayerHUD
Player hud
2016-03-07 15:14:37 +01:00
verysecrethero 3eaad275ba New CapturePointAddition fixed to work on Network by Joachim 2016-03-07 14:50:31 +01:00
Tleety 47ece6a5bf Changed shield component to track Active, so it and sprint glow full if they are active.
Changed how reflections are calculated with light.
2016-03-07 14:42:50 +01:00
verysecrethero 64df3fd7ad CapturePoints now have red/blue/spectator model-children 2016-03-07 14:30:27 +01:00
Tleety 99d663d5a2 ShiftIcon should now track ability depending on what ability the player has and change icon accordingly. 2016-03-07 13:55:37 +01:00
Tleety 388fe7c259 Fixed some stuff on the player HUD 2016-03-07 11:28:10 +01:00
Tobias Dahl 46d7c8bea4 Merge pull request #172 from teamfisk/ScoreBoard
Score board
2016-03-07 11:09:17 +01:00
Tleety c7099de9e4 Merge remote-tracking branch 'origin/master' into ScoreBoard
# Conflicts:
#	assets
2016-03-07 10:58:55 +01:00
Tleety cb9dad5c67 Merge remote-tracking branch 'origin/master' into ScoreBoard 2016-03-07 10:49:57 +01:00
Tleety a8f2d0a8e6 Some assets, some fixes to the scoreboard 2016-03-07 10:48:46 +01:00
Jace b7a7f7fd5e ???? 2016-03-04 15:02:01 +01:00
Jace 434ff1e7eb ???? 2016-03-04 10:06:49 +01:00
Jace e58b5ffd6f Merge remote-tracking branch 'origin/Movement' into Weapons
# Conflicts:
#	resources/Schema/Entities/Player.xml
#	src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp
2016-03-04 09:43:34 +01:00
Jace 4557455e49 HUD stuff 2016-03-04 09:41:12 +01:00
viktorljung c1f5cf65a7 Movement animations 2016-03-04 09:39:16 +01:00
Jace a8ad85b004 Merge remote-tracking branch 'origin/IconsForPlaytest' into Weapons 2016-03-04 09:39:11 +01:00
Jace 3ac8a5c7ef Working map 2016-03-04 09:38:38 +01:00
Jace ebd4c58c41 "Fixed" weapon spawning over network 2016-03-04 09:23:18 +01:00
Jace 42cccfbac0 Merge branch 'Weapons' of github.com:teamfisk/TacticalZ into Weapons
# Conflicts:
#	assets
#	src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp
2016-03-04 08:56:58 +01:00
Jocke e2674d915e Constrained weapon behavior to client side only 2016-03-04 08:55:55 +01:00
Jace 2b55450c18 Cray cray weapons 2016-03-04 08:54:59 +01:00
viktorljung 7ba0e4ea9d Run, Strafe and jump animations now playing 2016-03-04 08:35:02 +01:00
Jocke d78a7e20e2 Merge branch 'master' into Weapons 2016-03-04 08:29:33 +01:00
81 changed files with 14838 additions and 10236 deletions
+1 -1
Submodule assets updated: d3be164b69...52ea74c5d5
+12
View File
@@ -2,6 +2,7 @@
#define ComponentInfo_h__
#include "../Common.h"
#include "Entity.h"
#include <boost/shared_array.hpp>
struct ComponentInfo
@@ -21,6 +22,7 @@ struct ComponentInfo
{
std::string Name;
std::string Type;
unsigned char Index;
unsigned int Offset;
unsigned int Stride;
};
@@ -32,6 +34,16 @@ struct ComponentInfo
unsigned int Stride = 0;
boost::shared_array<char> Defaults = nullptr;
std::shared_ptr<Meta_t> Meta = nullptr;
std::size_t GetHeaderSize() const
{
std::size_t size = 0;
// A component block starts with an entity ID
size += sizeof(EntityID);
return size;
}
};
template<>
+10 -8
View File
@@ -5,16 +5,15 @@
#include "MemoryPool.h"
#include "ComponentInfo.h"
#include "ComponentWrapper.h"
#include "DirtySet.h"
class ComponentPool;
class ComponentPoolForwardIterator
: public std::iterator<std::forward_iterator_tag, ComponentWrapper>
{
public:
ComponentPoolForwardIterator(const ComponentInfo& componentInfo, const MemoryPool<char>::iterator begin, const MemoryPool<char>::iterator end)
: m_ComponentInfo(componentInfo)
, m_MemoryPoolIterator(begin)
, m_MemoryPoolEnd(end)
{ }
ComponentPoolForwardIterator(ComponentPool* pool, const MemoryPool<char>::iterator begin, const MemoryPool<char>::iterator end);
ComponentPoolForwardIterator(const ComponentPoolForwardIterator& other) = default;
ComponentPoolForwardIterator(ComponentPoolForwardIterator&& other) = default;
@@ -27,6 +26,7 @@ public:
ComponentWrapper operator*() const;
private:
ComponentPool* m_ComponentPool;
const ComponentInfo& m_ComponentInfo;
MemoryPool<char>::iterator m_MemoryPoolIterator;
const MemoryPool<char>::iterator m_MemoryPoolEnd;
@@ -34,6 +34,7 @@ private:
class ComponentPool
{
friend class ComponentPoolForwardIterator;
public:
typedef ComponentPoolForwardIterator iterator;
typedef ptrdiff_t difference_type;
@@ -44,7 +45,7 @@ public:
ComponentPool(const ::ComponentInfo& ci)
: m_ComponentInfo(ci)
, m_Pool(ci.Meta->Allocation, sizeof(EntityID) + ci.Stride)
, m_Pool(ci.Meta->Allocation, ci.GetHeaderSize() + ci.Stride)
{ }
~ComponentPool();
ComponentPool(const ComponentPool& other);
@@ -61,8 +62,8 @@ public:
// Delete a component and free its memory
void Delete(ComponentWrapper& wrapper);
iterator begin() const;
iterator end() const;
iterator begin();
iterator end();
size_t size() const;
//Dumps information about what the pool memory looks like right now
@@ -80,6 +81,7 @@ private:
::ComponentInfo m_ComponentInfo;
MemoryPool<char> m_Pool;
std::unordered_map<EntityID, char*> m_EntityToComponent;
DirtySet m_DirtySet;
};
#endif
+181 -37
View File
@@ -4,46 +4,66 @@
#include <boost/shared_array.hpp>
#include <boost/any.hpp>
#include "../Common.h"
#include "../GLM.h"
#include "Entity.h"
#include "ComponentInfo.h"
#include "DirtySet.h"
#include "Util/Any.h"
template <typename T, typename Enable = void>
struct ComponentField { };
template <typename T>
struct ComponentField<T, typename std::enable_if<std::is_trivially_copyable<T>::value>::type>
{
static T& Get(const ComponentInfo::Field_t& info, char* data) { return *reinterpret_cast<T*>(data); }
static void Set(const ComponentInfo::Field_t& info, char* data, const T& value) { Get(data) = value; }
};
template <>
struct ComponentField<std::string, void>
{
static std::string& Get(const ComponentInfo::Field_t& info, char* data) { return **reinterpret_cast<std::string**>(data); }
static void Set(const ComponentInfo::Field_t& info, char* data, const std::string& value) { Get(info, data) = value; }
};
struct ComponentWrapper
{
ComponentWrapper(const ComponentInfo& componentInfo, char* data)
ComponentWrapper(const ComponentInfo& componentInfo, char* data, ::DirtyBitField* dirtyBitField)
: Info(componentInfo)
, EntityID(*reinterpret_cast<::EntityID*>(data))
, Data(data + sizeof(::EntityID))
, Data(data + componentInfo.GetHeaderSize())
, DirtyBitField(dirtyBitField)
{ }
const ComponentInfo& Info;
const ::EntityID EntityID;
char* Data;
::DirtyBitField* DirtyBitField = nullptr;
ComponentInfo::EnumType Enum(const char* fieldName, const char* enumKey)
{
return Info.Meta->FieldEnumDefinitions.at(fieldName).at(enumKey);
}
bool Dirty(DirtySetType type, const std::string& fieldName)
{
if (DirtyBitField == nullptr) {
return true;
} else {
auto& field = Info.Fields.at(fieldName);
return DirtyBitField->operator[](type).count(field.Index) == 1;
}
}
void SetDirty(DirtySetType type, const std::string& fieldName, bool dirty = true)
{
if (DirtyBitField == nullptr) {
return;
}
auto& field = Info.Fields.at(fieldName);
if (dirty) {
DirtyBitField->operator[](type).insert(field.Index);
} else {
DirtyBitField->operator[](type).erase(field.Index);
}
}
void SetAllDirty(const std::string& fieldName, bool dirty = true)
{
LOG_DEBUG("DIRTY: %s %s", Info.Name.c_str(), fieldName.c_str());
for (auto& kv : *DirtyBitField) {
SetDirty(kv.first, fieldName);
}
}
template <typename T>
T& Field(std::string name)
T& Field(const std::string& name)
{
const ComponentInfo::Field_t& field = Info.Fields.at(name);
if (sizeof(T) > field.Stride) {
@@ -55,13 +75,15 @@ struct ComponentWrapper
}
template <typename T>
void SetField(std::string name, const T value) { Field<T>(name) = value; }
//template <typename T>
//void SetField(std::string name, T& value) { Field<T>(name) = value; }
void SetField(const std::string& name, const T& value)
{
Field<T>(name) = value;
SetAllDirty(name);
}
// Specialization for string literals
template <std::size_t N>
void SetField(std::string name, const char(&value)[N]) { Field<std::string>(name) = std::string(value); }
void SetField(const std::string& name, const char(&value)[N]) { SetField(name, std::string(value)); }
void Copy(ComponentWrapper& destination)
{
@@ -95,40 +117,162 @@ struct ComponentWrapper
struct SubscriptProxy
{
friend struct ComponentWrapper;
private:
SubscriptProxy(ComponentWrapper* component, std::string propertyName)
public:
SubscriptProxy(ComponentWrapper* component, std::string fieldName)
: m_Component(component)
, m_PropertyName(propertyName)
, m_FieldName(fieldName)
{ }
ComponentWrapper* m_Component;
std::string m_PropertyName;
std::string m_FieldName;
public:
// Return the integer value of an enum type key for this field
ComponentInfo::EnumType Enum(const char* enumKey) { return m_Component->Enum(m_PropertyName.c_str(), enumKey); }
ComponentInfo::EnumType Enum(const char* enumKey) { return m_Component->Enum(m_FieldName.c_str(), enumKey); }
bool Dirty(DirtySetType type) { return m_Component->Dirty(type, m_FieldName); }
void SetDirty(DirtySetType type, bool dirty = true) { m_Component->SetDirty(type, m_FieldName, dirty); }
void SetAllDirty(bool dirty = true) { m_Component->SetAllDirty(m_FieldName, dirty); }
template <typename T>
operator T&() { return m_Component->Field<T>(m_PropertyName); }
operator const double&() { return m_Component->Field<double>(m_FieldName); }
operator const float&() { return m_Component->Field<float>(m_FieldName); }
operator const int&() { return m_Component->Field<int>(m_FieldName); }
operator const glm::vec3&() { return m_Component->Field<glm::vec3>(m_FieldName); }
operator const glm::vec4&() { return m_Component->Field<glm::vec4>(m_FieldName); }
operator const glm::quat&() { return m_Component->Field<glm::quat>(m_FieldName); }
operator const bool&() { return m_Component->Field<bool>(m_FieldName); }
operator const std::string&() { return m_Component->Field<std::string>(m_FieldName); }
// Don't allow non-const references
// If this wasn't deleted, the above overloads would still get called for some reason...
template <
typename T,
typename = typename std::enable_if<!std::is_base_of<::FIELDLOL, T>::value>::type
>
operator T&() = delete;
// Value assignment
template <typename T>
void operator=(const T val) { m_Component->SetField<T>(m_PropertyName, val); }
// TODO: Pass by reference and rvalue (universal reference?)
//template <typename T>
//void operator=(T& val) { m_Component->SetField<T>(m_PropertyName, val); }
void operator=(const T& val) { m_Component->SetField<T>(m_FieldName, val); }
// Specialization for string literals
template <std::size_t N>
void operator=(const char(&val)[N]) { m_Component->SetField<N>(m_PropertyName, val); }
void operator=(const char(&val)[N]) { m_Component->SetField<N>(m_FieldName, val); }
};
SubscriptProxy operator[](std::string propertyName) { return SubscriptProxy(this, propertyName); }
SubscriptProxy operator[](const std::string& propertyName) { return SubscriptProxy(this, propertyName); }
};
struct FIELDLOL { }; // lol
template <typename T>
struct FieldBase : FIELDLOL
{
FieldBase(ComponentWrapper::SubscriptProxy& Proxy)
: Proxy(Proxy)
, Data(Proxy.m_Component->Field<T>(Proxy.m_FieldName))
{ }
void SetAllDirty() { Proxy.SetAllDirty(); }
FieldBase& operator=(const FieldBase& rhs) { Data = rhs.Data; SetAllDirty(); return *this; }
FieldBase& operator=(const T& rhs) { Data = rhs; SetAllDirty(); return *this; }
template <typename T2> FieldBase& operator+=(const T2& rhs) { Data += rhs; SetAllDirty(); return *this; }
template <typename T2> FieldBase& operator-=(const T2& rhs) { Data -= rhs; SetAllDirty(); return *this; }
template <typename T2> FieldBase& operator*=(const T2& rhs) { Data *= rhs; SetAllDirty(); return *this; }
template <typename T2> FieldBase& operator/=(const T2& rhs) { Data /= rhs; SetAllDirty(); return *this; }
template <typename T2> FieldBase& operator%=(const T2& rhs) { Data %= rhs; SetAllDirty(); return *this; }
template <typename T2> FieldBase& operator&=(const T2& rhs) { Data &= rhs; SetAllDirty(); return *this; }
template <typename T2> FieldBase& operator|=(const T2& rhs) { Data |= rhs; SetAllDirty(); return *this; }
template <typename T2> FieldBase& operator^=(const T2& rhs) { Data ^= rhs; SetAllDirty(); return *this; }
template <typename T2> FieldBase& operator<<=(const T2& rhs) { Data <<= rhs; SetAllDirty(); return *this; }
template <typename T2> FieldBase& operator>>=(const T2& rhs) { Data >>= rhs; SetAllDirty(); return *this; }
T operator+() const { return +Data; }
T operator-() const { return -Data; }
T operator~() const { return ~Data; }
FieldBase& operator++() { Data++; SetAllDirty(); return *this; }
T operator++(int) { T tmp = Data; operator++(); return tmp; }
FieldBase& operator--() { Data--; SetAllDirty(); return *this; }
T operator--(int) { T tmp = Data; operator--(); return tmp; }
operator const T&() const { return Data; }
const T& operator*() const { return operator const T&(); }
protected:
ComponentWrapper::SubscriptProxy Proxy;
T& Data;
};
template <typename T>
struct Field : FieldBase<T>
{
using FieldBase<T>::FieldBase;
using FieldBase<T>::operator=;
};
template <>
struct Field<glm::vec3> : FieldBase<glm::vec3>
{
using FieldBase<glm::vec3>::FieldBase;
using FieldBase<glm::vec3>::operator=;
glm::vec3::value_type x() const { return Data.x; }
void x(glm::vec3::value_type val) { Data.x = val; SetAllDirty(); }
glm::vec3::value_type y() const { return Data.y; }
void y(glm::vec3::value_type val) { Data.y = val; SetAllDirty(); }
glm::vec3::value_type z() const { return Data.z; }
void z(glm::vec3::value_type val) { Data.z = val; SetAllDirty(); }
template <typename T> friend glm::vec3 operator+(const Field<glm::vec3>& lhs, const T& rhs) { return static_cast<glm::vec3>(lhs) + glm::vec3(rhs); }
template <typename T> friend glm::vec3 operator-(const Field<glm::vec3>& lhs, const T& rhs) { return static_cast<glm::vec3>(lhs) - glm::vec3(rhs); }
template <typename T> friend glm::vec3 operator*(const Field<glm::vec3>& lhs, const T& rhs) { return static_cast<glm::vec3>(lhs) * glm::vec3(rhs); }
template <typename T> friend glm::vec3 operator/(const Field<glm::vec3>& lhs, const T& rhs) { return static_cast<glm::vec3>(lhs) / glm::vec3(rhs); }
template <typename T> friend glm::vec3 operator+(const T& lhs, const Field<glm::vec3>& rhs) { return glm::vec3(lhs) + static_cast<glm::vec3>(rhs); }
template <typename T> friend glm::vec3 operator-(const T& lhs, const Field<glm::vec3>& rhs) { return glm::vec3(lhs) - static_cast<glm::vec3>(rhs); }
template <typename T> friend glm::vec3 operator*(const T& lhs, const Field<glm::vec3>& rhs) { return glm::vec3(lhs) * static_cast<glm::vec3>(rhs); }
template <typename T> friend glm::vec3 operator/(const T& lhs, const Field<glm::vec3>& rhs) { return glm::vec3(lhs) / static_cast<glm::vec3>(rhs); }
friend glm::vec3& operator+=(glm::vec3& lhs, const Field<glm::vec3>& rhs) { lhs += *rhs; return lhs; }
};
template <>
struct Field<glm::vec4> : FieldBase<glm::vec4>
{
//Field(glm::vec4& Data)
// : FieldBase(Data)
//{ }
using FieldBase<glm::vec4>::FieldBase;
using FieldBase<glm::vec4>::operator=;
glm::vec4::value_type x() const { return Data.x; }
void x(glm::vec4::value_type val) { Data.x = val; SetAllDirty(); }
glm::vec4::value_type y() const { return Data.y; }
void y(glm::vec4::value_type val) { Data.y = val; SetAllDirty(); }
glm::vec4::value_type z() const { return Data.z; }
void z(glm::vec4::value_type val) { Data.z = val; SetAllDirty(); }
glm::vec4::value_type w() const { return Data.w; }
void w(glm::vec4::value_type val) { Data.w = val; SetAllDirty(); }
template <typename T> friend glm::vec4 operator+(const Field<glm::vec4>& lhs, const T& rhs) { return static_cast<glm::vec4>(lhs) + glm::vec4(rhs); }
template <typename T> friend glm::vec4 operator-(const Field<glm::vec4>& lhs, const T& rhs) { return static_cast<glm::vec4>(lhs) - glm::vec4(rhs); }
template <typename T> friend glm::vec4 operator*(const Field<glm::vec4>& lhs, const T& rhs) { return static_cast<glm::vec4>(lhs) * glm::vec4(rhs); }
template <typename T> friend glm::vec4 operator/(const Field<glm::vec4>& lhs, const T& rhs) { return static_cast<glm::vec4>(lhs) / glm::vec4(rhs); }
template <typename T> friend glm::vec4 operator+(const T& lhs, const Field<glm::vec4>& rhs) { return glm::vec4(lhs) + static_cast<glm::vec4>(rhs); }
template <typename T> friend glm::vec4 operator-(const T& lhs, const Field<glm::vec4>& rhs) { return glm::vec4(lhs) - static_cast<glm::vec4>(rhs); }
template <typename T> friend glm::vec4 operator*(const T& lhs, const Field<glm::vec4>& rhs) { return glm::vec4(lhs) * static_cast<glm::vec4>(rhs); }
template <typename T> friend glm::vec4 operator/(const T& lhs, const Field<glm::vec4>& rhs) { return glm::vec4(lhs) / static_cast<glm::vec4>(rhs); }
friend glm::vec4& operator+=(glm::vec4& lhs, const Field<glm::vec4>& rhs) { lhs += *rhs; return lhs; }
};
// A component wrapper that "owns" its data through a shared pointer
struct SharedComponentWrapper : ComponentWrapper
{
SharedComponentWrapper(const ComponentInfo& componentInfo, boost::shared_array<char> data)
: ComponentWrapper(componentInfo, data.get())
: ComponentWrapper(componentInfo, data.get(), nullptr)
, m_DataReference(data)
{ }
+16
View File
@@ -0,0 +1,16 @@
#ifndef DirtySet_h__
#define DirtySet_h__
#include <set>
#include "ComponentInfo.h"
enum class DirtySetType
{
Transform,
Network
};
typedef std::unordered_map<DirtySetType, std::set<decltype(ComponentInfo::Field_t::Index)>> DirtyBitField;
typedef std::unordered_map<EntityID, DirtyBitField> DirtySet;
#endif
+1 -1
View File
@@ -81,7 +81,7 @@ public:
for (auto& pair : group.PureSystems) {
const std::string& componentName = pair.first;
auto& systems = pair.second;
const ComponentPool* pool = m_World->GetComponents(componentName);
ComponentPool* pool = m_World->GetComponents(componentName);
if (pool == nullptr) {
continue;
}
+1 -1
View File
@@ -35,7 +35,7 @@ public:
// Delete a component off an entity
void DeleteComponent(EntityID entity, const std::string& componentType);
// Get all components of the specified type
const ComponentPool* GetComponents(const std::string& componentType);
ComponentPool* GetComponents(const std::string& componentType);
// Get entity parent
EntityID GetParent(EntityID entity);
// Change the parent of an entity
@@ -12,8 +12,8 @@ template <typename EventContext>
class EditorCameraInputController : public FirstPersonInputController<EventContext>
{
public:
EditorCameraInputController(EventBroker* eventBroker, unsigned int playerID)
: FirstPersonInputController(eventBroker, playerID)
EditorCameraInputController(EventBroker* eventBroker, unsigned int playerID, EntityWrapper playerEntity)
: FirstPersonInputController(eventBroker, playerID, playerEntity)
{
EVENT_SUBSCRIBE_MEMBER(m_EMousePress, &EditorCameraInputController::OnMousePress);
EVENT_SUBSCRIBE_MEMBER(m_EMouseRelease, &EditorCameraInputController::OnMouseRelease);
@@ -6,12 +6,13 @@
#include "../Core/ELockMouse.h"
#include "../Game/Events/EDashAbility.h"
#include "InputHandler.h"
#include "Rendering/EAutoAnimationBlend.h"
template <typename EventContext>
class FirstPersonInputController : public InputController<EventContext>
{
public:
FirstPersonInputController(EventBroker* eventBroker, int playerID);
FirstPersonInputController(EventBroker* eventBroker, int playerID, EntityWrapper playerEntity);
virtual const glm::vec3 Movement() const { return m_Movement; }
virtual const glm::vec3 Rotation() const { return m_Rotation; }
@@ -27,13 +28,15 @@ public:
virtual bool OnCommand(const Events::InputCommand& e) override;
virtual void Reset();
void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer, EntityID playerID);
void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, Field<double> assaultDashCoolDownTimer, EntityID playerID);
virtual bool AssaultDashDoubleTapped() const { return m_AssaultDashDoubleTapped; }
virtual bool PlayerIsDashing() const { return m_PlayerIsDashing; }
bool SpecialAbilityKeyDown() const { return m_SpecialAbilityKeyDown; }
protected:
const int m_PlayerID;
EntityWrapper m_PlayerEntity;
bool m_MouseLocked = false;
glm::vec3 m_Rotation;
glm::vec3 m_Movement;
@@ -65,9 +68,10 @@ protected:
};
template <typename EventContext>
FirstPersonInputController<EventContext>::FirstPersonInputController(EventBroker* eventBroker, int playerID)
FirstPersonInputController<EventContext>::FirstPersonInputController(EventBroker* eventBroker, int playerID, EntityWrapper playerEntity)
: InputController(eventBroker)
, m_PlayerID(playerID)
, m_PlayerEntity(playerEntity)
{
EVENT_SUBSCRIBE_MEMBER(m_ELockMouse, &FirstPersonInputController::OnLockMouse);
EVENT_SUBSCRIBE_MEMBER(m_EUnlockMouse, &FirstPersonInputController::OnUnlockMouse);
@@ -118,13 +122,84 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
if (e.Command == "Forward") {
float val = glm::clamp(e.Value, -1.f, 1.f);
m_Movement.z = -val;
if (m_PlayerEntity.Valid()) {
EntityWrapper playerModel = m_PlayerEntity.FirstChildByName("PlayerModel");
if (playerModel.Valid()) {
if (val > 0) {
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.1;
if(m_Crouching) {
aeb.NodeName = "Walk";
} else {
aeb.NodeName = "Run";
}
aeb.RootNode = playerModel;
aeb.Start = true;
m_EventBroker->Publish(aeb);
} else if (val < 0) {
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.1;
if (m_Crouching) {
aeb.NodeName = "Walk";
} else {
aeb.NodeName = "Run";
}
aeb.RootNode = playerModel;
aeb.Start = true;
aeb.Reverse = true;
m_EventBroker->Publish(aeb);
} else {
}
}
}
}
if (e.Command == "Right") {
float val = glm::clamp(e.Value, -1.f, 1.f);
m_Movement.x = val;
if (m_PlayerEntity.Valid()) {
EntityWrapper playerModel = m_PlayerEntity.FirstChildByName("PlayerModel");
if (playerModel.Valid()) {
if (val > 0) {
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.1;
aeb.NodeName = "Right";
aeb.RootNode = playerModel;
aeb.Start = true;
m_EventBroker->Publish(aeb);
} else if (val < 0) {
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.1;
aeb.NodeName = "Left";
aeb.RootNode = playerModel;
aeb.Start = true;
m_EventBroker->Publish(aeb);
} else {
}
}
}
}
if (glm::length2(m_Movement) > 0) {
m_Movement = glm::normalize(m_Movement);
} else {
if (m_PlayerEntity.Valid()) {
EntityWrapper playerModel = m_PlayerEntity.FirstChildByName("PlayerModel");
if (playerModel.Valid()) {
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.1;
aeb.NodeName = "Idle";
aeb.RootNode = playerModel;
m_EventBroker->Publish(aeb);
}
}
}
}
@@ -159,6 +234,32 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
if (e.Command == "Crouch") {
m_Crouching = e.Value > 0;
if (m_PlayerEntity.Valid()) {
EntityWrapper playerModel = m_PlayerEntity.FirstChildByName("PlayerModel");
if (playerModel.Valid()) {
if (e.Value == 0.f) {
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.NodeName = "StandMovement";
aeb.RootNode = playerModel;
aeb.Start = true;
aeb.Restart = true;
aeb.SingleLevelBlend = true;
m_EventBroker->Publish(aeb);
} else if(e.Value == 1.0f) {
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.NodeName = "CrouchMovement";
aeb.RootNode = playerModel;
aeb.Start = true;
aeb.Restart = true;
aeb.SingleLevelBlend = true;
m_EventBroker->Publish(aeb);
}
}
}
}
if (e.Command == "SpecialAbility") {
@@ -185,7 +286,7 @@ bool FirstPersonInputController<EventContext>::OnLockMouse(const Events::LockMou
}
template <typename EventContext>
void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer, EntityID playerID) {
void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, Field<double> assaultDashCoolDownTimer, EntityID playerID) {
m_AssaultDashDoubleTapDeltaTime += dt;
m_DashEffectResetTimer += dt;
assaultDashCoolDownTimer -= dt;
+1 -1
View File
@@ -52,7 +52,7 @@ public:
void Connect(std::string address, int port);
void Update() override;
private:
UDPClient m_Unreliable;
//UDPClient m_Unreliable;
TCPClient m_Reliable;
std::vector<Events::PlayerSpawned> m_PlayerSpawnEvents;
void parseSpawnEvents();
+1 -1
View File
@@ -36,7 +36,7 @@ public:
private:
// Network channels
TCPServer m_Reliable;
UDPServer m_Unreliable;
//UDPServer m_Unreliable;
UDPServer m_ServerlistRequest;
// dont forget to set these in the childrens receive logic
boost::asio::ip::address m_Address;
+1
View File
@@ -62,6 +62,7 @@ public:
double progress;
bool Start;
bool SingleBlend;
double Weight;
std::unordered_map<EntityWrapper, double> StartWeights;
};
@@ -19,6 +19,8 @@ struct AutoAnimationBlend : Event
bool Restart = false;
bool SingleLevelBlend = false;
double Weight = -1.0;
EntityWrapper AnimationEntity = EntityWrapper::Invalid;
};
@@ -18,15 +18,15 @@ struct ExplosionEffectJob : ModelJob
ExplosionEffectJob(ComponentWrapper explosionEffectComponent, ::Model* model, Camera* camera, glm::mat4 matrix, ::RawModel::MaterialProperties matGroup, ComponentWrapper modelComponent, ::World* world, glm::vec4 fillColor, float fillPercentage, bool isShielded)
: ModelJob(model, camera, matrix, matGroup, modelComponent, world, fillColor, fillPercentage, isShielded)
{
ExplosionOrigin = (glm::vec3)explosionEffectComponent["ExplosionOrigin"];
TimeSinceDeath = (double)explosionEffectComponent["TimeSinceDeath"];
ExplosionDuration = (double)explosionEffectComponent["ExplosionDuration"];
EndColor = (glm::vec4)explosionEffectComponent["EndColor"];
Randomness = (bool)explosionEffectComponent["Randomness"];
RandomnessScalar = (double)explosionEffectComponent["RandomnessScalar"];
Velocity = (glm::vec2)explosionEffectComponent["Velocity"];
ColorByDistance = (bool)explosionEffectComponent["ColorByDistance"];
ExponentialAccelaration = (bool)explosionEffectComponent["ExponentialAccelaration"];
ExplosionOrigin = (Field<glm::vec3>)explosionEffectComponent["ExplosionOrigin"];
TimeSinceDeath = (Field<double>)explosionEffectComponent["TimeSinceDeath"];
ExplosionDuration = (Field<double>)explosionEffectComponent["ExplosionDuration"];
EndColor = (Field<glm::vec4>)explosionEffectComponent["EndColor"];
Randomness = (Field<bool>)explosionEffectComponent["Randomness"];
RandomnessScalar = (Field<double>)explosionEffectComponent["RandomnessScalar"];
Velocity = (Field<glm::vec2>)explosionEffectComponent["Velocity"];
ColorByDistance = (Field<bool>)explosionEffectComponent["ColorByDistance"];
ExponentialAccelaration = (Field<bool>)explosionEffectComponent["ExponentialAccelaration"];
};
glm::vec3 ExplosionOrigin;
+2 -2
View File
@@ -17,8 +17,8 @@ struct TextJob : RenderJob
: RenderJob()
{
Matrix = matrix;
Color = (glm::vec4)textComponent["Color"];
Content = (std::string)textComponent["Content"];
Color = (const glm::vec4&)textComponent["Color"];
Content = (const std::string&)textComponent["Content"];
Resource = font;
if ((int)textComponent["Alignment"] == textComponent["Alignment"].Enum("Left")) {
@@ -12,6 +12,7 @@ public:
{ }
virtual void Update(double dt) override;
private:
};
#endif
+2 -2
View File
@@ -12,8 +12,8 @@ public:
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override
{
ComponentWrapper& transform = m_World->GetComponent(component.EntityID, "Transform");
(double&)component["Time"] += dt;
(glm::vec3&)transform["Position"] = (float)(double)component["Amplitude"] * glm::sin((glm::two_pi<float>() / (float)(double)component["Period"]) * (float)(double)component["Time"]) * (glm::vec3)component["Axis"];
(Field<double>)component["Time"] += dt;
(Field<glm::vec3>)transform["Position"] = (float)(double)component["Amplitude"] * glm::sin((glm::two_pi<float>() / (float)(double)component["Period"]) * (float)(double)component["Time"]) * (glm::vec3)component["Axis"];
}
};
+24 -3
View File
@@ -1,6 +1,25 @@
#include "Common.h"
#include "Core/System.h"
//struct FSubscriptProxy
// {
// friend struct ComponentWrapper;
// FSubscriptProxy(ComponentWrapper* component, std::string fieldName)
// : m_Component(component)
// , m_FieldName(fieldName)
// { }
// ComponentWrapper* m_Component;
// std::string m_FieldName;
// public:
// template <typename T>
// operator Field<T>() { return Field<T>(m_Component->Field<T>(m_FieldName)); }
// };
class RaptorCopterSystem : public PureSystem
{
public:
@@ -9,9 +28,11 @@ public:
, PureSystem("RaptorCopter")
{ }
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cRaptorCopter, double dt) override
{
ComponentWrapper& transform = m_World->GetComponent(component.EntityID, "Transform");
(glm::vec3&)transform["Orientation"] += (float)(double)component["Speed"] * (float)dt * (glm::vec3)component["Axis"];
ComponentWrapper& cTransform = entity["Transform"];
//FSubscriptProxy subOri(&cTransform, "Orientation");
//Field<glm::vec3> orientation = subOri;
(Field<glm::vec3>)cTransform["Orientation"] += (float)(const double&)cRaptorCopter["Speed"] * (float)dt * (glm::vec3)cRaptorCopter["Axis"];
}
};
+52 -4
View File
@@ -9,6 +9,7 @@
#include "Systems/SpawnerSystem.h"
#include "Rendering/ESetCamera.h"
#include "Core/ConfigFile.h"
#include "Rendering/EAutoAnimationBlend.h"
template <typename ETYPE>
class WeaponBehaviour : public PureSystem
@@ -31,6 +32,21 @@ public:
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt) override
{
EntityWrapper firstPersonWeapon = entity.FirstChildByName("Hands").FirstChildByName("AssaultWeapon");
EntityWrapper thirdPersonWeapon = entity.FirstChildByName("PlayerModel").FirstChildByName("AssaultWeapon");
if (IsClient && (firstPersonWeapon.Valid() || thirdPersonWeapon.Valid())) {
if (m_ActiveWeapons.count(entity) == 0) {
WeaponInfo& wi = m_ActiveWeapons[entity];
wi.Player = entity;
wi.WeaponEntity = entity;
wi.FirstPersonEntity = firstPersonWeapon;
wi.ThirdPersonEntity = thirdPersonWeapon;
OnEquip(cWeapon, wi);
}
}
auto weapon = getActiveWeapon(entity);
if (!weapon) {
return;
@@ -94,6 +110,31 @@ protected:
}
}
void playAnimation(EntityWrapper weaponModelEntity, const std::string& subTreeName, const std::string& animationNodeName)
{
EntityWrapper root = weaponModelEntity.FirstParentWithComponent("Model");
if (!root.Valid()) {
return;
}
EntityWrapper subTree = root.FirstChildByName(subTreeName);
if (!subTree.Valid()) {
return;
}
EntityWrapper animationNode = subTree.FirstChildByName(animationNodeName);
if (!animationNode.Valid()) {
return;
}
Events::AutoAnimationBlend eFireBlend;
eFireBlend.RootNode = root;
eFireBlend.NodeName = animationNodeName;
eFireBlend.Restart = true;
eFireBlend.Start = true;
m_EventBroker->Publish(eFireBlend);
}
void playAnimationAndReturn(EntityWrapper weaponModelEntity, const std::string& subTreeName, const std::string& animationNodeName)
{
EntityWrapper root = weaponModelEntity.FirstParentWithComponent("Model");
@@ -213,6 +254,10 @@ private:
void selectWeapon(ComponentWrapper cWeapon, EntityWrapper player)
{
if (!IsServer) {
return;
}
// Don't reselect weapon if it's already active
if (getActiveWeapon(player)) {
return;
@@ -224,7 +269,8 @@ private:
EntityWrapper thirdPersonAttachment;
for (auto& attachment : weaponAttachments) {
ComponentWrapper cWeaponAttachment = attachment["WeaponAttachment"];
if ((std::string&)cWeaponAttachment["Weapon"] == m_ComponentType) {
Field<std::string> weaponType = cWeaponAttachment["Weapon"];
if (*weaponType == m_ComponentType) {
ComponentWrapper::SubscriptProxy person = cWeaponAttachment["Person"];
if ((ComponentInfo::EnumType)person == person.Enum("FirstPerson")) {
firstPersonAttachment = attachment;
@@ -242,9 +288,11 @@ private:
// Spawn the weapon(s)
EntityWrapper firstPersonWeapon;
EntityWrapper thirdPersonWeapon;
if (firstPersonAttachment.Valid()) {
firstPersonWeapon = SpawnerSystem::Spawn(firstPersonAttachment, firstPersonAttachment);
}
//if (IsClient) {
if (firstPersonAttachment.Valid()) {
firstPersonWeapon = SpawnerSystem::Spawn(firstPersonAttachment, firstPersonAttachment);
}
//}
if (thirdPersonAttachment.Valid()) {
thirdPersonWeapon = SpawnerSystem::Spawn(thirdPersonAttachment, thirdPersonAttachment);
}
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ShieldAbility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ShieldAbility.xsd">
<CoolDownMaxTimer>2.0</CoolDownMaxTimer>
<Active>false</Active>
</ShieldAbility>
@@ -9,8 +9,8 @@
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="CoolDownMaxTimer" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>This is the cooldown on shield</xs:documentation></xs:annotation>
<xs:element name="Active" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>If the shield is active or not</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+30 -5
View File
@@ -4,14 +4,39 @@
<Components>
<c:AABB/>
<c:CapturePoint/>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
</c:Model>
<c:Team/>
<c:Transform/>
<c:Trigger/>
<c:Transform/>
</Components>
<Children/>
<Children>
<Entity name="Red">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Blue">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Spectator">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
+21 -21
View File
@@ -2,36 +2,36 @@
<Entity name="Shield" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Blend>
<Pose1>Deploy</Pose1>
<Pose2>Idle</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Model>
<Resource>Models/Characters/Defender/DefenderShield.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="Shield">
<Entity name="Deploy">
<Components>
<c:Model>
<Resource>Models/Core/UnitPlane.mesh</Resource>
</c:Model>
<c:Shield/>
<c:Transform>
<Scale X="1.11800003" Y="0.0320000015" Z="1.9180001"/>
<Orientation X="-1.57079995" Y="0" Z="0"/>
</c:Transform>
<c:Animation>
<AnimationName>ActivateDeactiveShieldF</AnimationName>
<Time>1</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="VisibleSide">
<Entity name="Idle">
<Components>
<c:Shielded/>
<c:Model>
<Resource>Models/Core/UnitHexagon.mesh</Resource>
<Color A="0" B="1" G="0" R="0"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="0" Z="0.0179871861"/>
<Scale X="1.01900005" Y="0.0120000001" Z="1.91000009"/>
<Orientation X="-1.57079995" Y="0" Z="0"/>
</c:Transform>
<c:Animation>
<AnimationName>ShieldFrontF</AnimationName>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
+2 -2
View File
@@ -15,7 +15,7 @@
</c:Team>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/PlayerAssaultFallbackRed.xml</EntityFile>
<EntityFile>Schema/Entities/PlayerDefenderBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.300000012" Y="0.0270000007" Z="0"/>
@@ -83,7 +83,7 @@
</c:Team>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
<EntityFile>Schema/Entities/PlayerAssaultBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.300000012" Y="0.0270000007" Z="6.67400026"/>
File diff suppressed because it is too large Load Diff
+60 -82
View File
@@ -484,10 +484,12 @@
</Entity>
<Entity name="Hands">
<Components>
<c:BlendAdditive>
<Adder>Run</Adder>
<Receiver>FinalBlend</Receiver>
</c:BlendAdditive>
<c:Blend>
<Pose1>BlendTreeAssaultWeapon</Pose1>
<Pose2>BlendTreeSecondaryWeapon</Pose2>
<Weight>0</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Model>
<Resource>Models/Characters/Defender/FirstPersonDefenderBlue.mesh</Resource>
</c:Model>
@@ -506,8 +508,8 @@
<EntityFile>Schema/Entities/WeaponAssaultBlueView.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.120525226" Y="-0.23723805" Z="-0.18130067"/>
<Orientation X="-0.00823593792" Y="-0.00347058685" Z="0.0434750468"/>
<Position X="0.120430678" Y="-0.228860483" Z="-0.181454629"/>
<Orientation X="0.0104048448" Y="-0.00268179015" Z="0.0428442247"/>
</c:Transform>
</Components>
<Children/>
@@ -524,73 +526,50 @@
<EntityFile>Schema/Entities/SidearmWeaponView.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.120525226" Y="-0.23723805" Z="-0.18130067"/>
<Orientation X="-0.00823593792" Y="-0.00347058685" Z="0.0434750468"/>
<Position X="0.120430678" Y="-0.228860483" Z="-0.181454629"/>
<Orientation X="0.0104048448" Y="-0.00268179015" Z="0.0428442247"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="FinalBlend">
<Entity name="BlendTreeAssaultWeapon">
<Components>
<c:Blend>
<Pose1>BlendTreeAssaultWeapon</Pose1>
<Pose2>BlendTreeSecondaryWeapon</Pose2>
<Pose1>Idle</Pose1>
<Pose2>WeaponAction</Pose2>
<Weight>0</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="BlendTreeAssaultWeapon">
<Entity name="WeaponAction">
<Components>
<c:Blend>
<Pose1>Idle</Pose1>
<Pose2>WeaponAction</Pose2>
<Weight>0</Weight>
<SubTreeRoot>true</SubTreeRoot>
<Pose1>Fire</Pose1>
<Pose2>Reload</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponAction">
<Components>
<c:Blend>
<Pose1>Fire</Pose1>
<Pose2>Reload</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Fire">
<Components>
<c:Animation>
<AnimationName>ShootShotgunF</AnimationName>
<Speed>1</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Reload">
<Components>
<c:Animation>
<AnimationName>ReloadSwitchF</AnimationName>
<Speed>1</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Idle">
<Entity name="Fire">
<Components>
<c:Animation>
<AnimationName>IdleF</AnimationName>
<Time>0.97212039472333345</Time>
<AnimationName>ShootShotgunF</AnimationName>
<Speed>1</Speed>
<Play>true</Play>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Reload">
<Components>
<c:Animation>
<AnimationName>ReloadSwitchF</AnimationName>
<Time>0.58991607886241582</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -600,22 +579,22 @@
</Entity>
</Children>
</Entity>
<Entity name="BlendTreeSecondaryWeapon">
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>IdleF</AnimationName>
<Time>0.14837891922093149</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Run">
<Entity name="BlendTreeSecondaryWeapon">
<Components>
<c:Animation>
<AnimationName>RunF</AnimationName>
<Time>0.51068473950665805</Time>
<Speed>1</Speed>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
@@ -652,7 +631,6 @@
<c:Model>
<Resource>Models/Characters/Assault/AssaultBlue.mesh</Resource>
<Color A="1" B="1" G="0.952941179" R="1"/>
<Visible>false</Visible>
</c:Model>
<c:Transform/>
</Components>
@@ -672,8 +650,8 @@
<EntityFile>Schema/Entities/WeaponAssaultBlueWorld.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.157275528" Y="1.04134643" Z="-0.233016849"/>
<Orientation X="-0.00424382696" Y="-0.0348230973" Z="0.137522101"/>
<Position X="0.156692833" Y="1.04078996" Z="-0.230734348"/>
<Orientation X="-0.00423099846" Y="-0.0376685001" Z="0.137512475"/>
</c:Transform>
</Components>
<Children/>
@@ -693,8 +671,8 @@
<EntityFile>Schema/Entities/SidearmWeaponWorld.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.157275528" Y="1.04134643" Z="-0.233016849"/>
<Orientation X="-0.00424382696" Y="-0.0348230973" Z="0.137522101"/>
<Position X="0.156692833" Y="1.04078996" Z="-0.230734348"/>
<Orientation X="-0.00423099846" Y="-0.0376685001" Z="0.137512475"/>
</c:Transform>
</Components>
<Children/>
@@ -740,12 +718,12 @@
<Components>
<c:BlendOverride>
<Master>ReloadSwitchBlend</Master>
<Slave>MovementBlend</Slave>
<Slave>FinalMovementBlend</Slave>
</c:BlendOverride>
<c:Transform/>
</Components>
<Children>
<Entity name="MovementBlend">
<Entity name="FinalMovementBlend">
<Components>
<c:Blend>
<Pose1>StandCrouchBlend</Pose1>
@@ -801,7 +779,7 @@
<Components>
<c:Animation>
<AnimationName>CrouchStrafeLeftF</AnimationName>
<Time>0.68480018110252416</Time>
<Time>0.86105870560012221</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -813,7 +791,7 @@
<Components>
<c:Animation>
<AnimationName>CrouchStrafeRightF</AnimationName>
<Time>0.61212164305330674</Time>
<Time>0.78838016755090479</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -827,7 +805,7 @@
<Components>
<c:Animation>
<AnimationName>CrouchWalkF</AnimationName>
<Time>0.39049562823070971</Time>
<Time>0.56675415272830776</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -884,7 +862,7 @@
<Components>
<c:Animation>
<AnimationName>WalkF</AnimationName>
<Time>0.89565025764048301</Time>
<Time>0.071908782138081051</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -896,7 +874,7 @@
<Components>
<c:Animation>
<AnimationName>RunF</AnimationName>
<Time>0.1676637616643859</Time>
<Time>0.34392228616198395</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -920,7 +898,7 @@
<Components>
<c:Animation>
<AnimationName>StrafeRightF</AnimationName>
<Time>0.10075840855413531</Time>
<Time>0.27701693305173336</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -932,7 +910,7 @@
<Components>
<c:Animation>
<AnimationName>StrafeLeftF</AnimationName>
<Time>0.077242878674020687</Time>
<Time>0.25350140317161873</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -948,7 +926,7 @@
<Components>
<c:Animation>
<AnimationName>IdleF</AnimationName>
<Time>0.027866837470497785</Time>
<Time>0.07079692416292005</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -1008,7 +986,7 @@
<c:Animation>
<AnimationName>DashForwardF</AnimationName>
<Time>1</Time>
<Speed>1</Speed>
<Speed>2</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
@@ -1020,7 +998,7 @@
<c:Animation>
<AnimationName>DashBackwardF</AnimationName>
<Time>1</Time>
<Speed>1</Speed>
<Speed>2</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
@@ -1044,7 +1022,7 @@
<c:Animation>
<AnimationName>DashLeftF</AnimationName>
<Time>1</Time>
<Speed>1</Speed>
<Speed>2</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
@@ -1056,7 +1034,7 @@
<c:Animation>
<AnimationName>DashRightF</AnimationName>
<Time>1</Time>
<Speed>1</Speed>
<Speed>2</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
@@ -1117,7 +1095,7 @@
<Components>
<c:Animation>
<AnimationName>IdleAssaultRifleU</AnimationName>
<Time>0.31987294268299138</Time>
<Time>1.4961314671805894</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -1129,7 +1107,7 @@
<Components>
<c:Animation>
<AnimationName>IdleSecWepU</AnimationName>
<Time>0.32339798297277866</Time>
<Time>1.4996565074703767</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+228 -106
View File
@@ -1,31 +1,38 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="Player" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Entity name="PlayerDefender" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:AABB>
<Origin X="0" Y="0.772000015" Z="0"/>
<Size X="1" Y="1.60000002" Z="1"/>
</c:AABB>
<c:AssaultWeapon/>
<c:Team>
<Team>
<Blue/>
<Red/>
</Team>
</c:Team>
<c:Collidable/>
<c:DashAbility/>
<c:DefenderWeapon/>
<c:DoubleJump/>
<c:Health/>
<c:DefenderWeapon>
<MagazineAmmo>4</MagazineAmmo>
<Ammo>52</Ammo>
</c:DefenderWeapon>
<c:Listener/>
<c:Health>
<Health>150</Health>
<MaxHealth>150</MaxHealth>
</c:Health>
<c:ShieldAbility/>
<c:Physics>
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
<Velocity X="-1.86527334e-13" Y="0" Z="1.89149233e-13"/>
<IsOnGround>true</IsOnGround>
</c:Physics>
<c:Player>
<MovementSpeed>5</MovementSpeed>
<CurrentWeapon></CurrentWeapon>
</c:Player>
<c:Transform>
<Position X="0" Y="0.0288832188" Z="2.64144421"/>
<Position X="0.67159152" Y="0.0288829375" Z="1.22672582"/>
<Orientation X="0" Y="-0.00174739491" Z="0"/>
</c:Transform>
</Components>
@@ -38,6 +45,7 @@
</c:Camera>
<c:Transform>
<Position X="0" Y="1.27700007" Z="0"/>
<Orientation X="1.11789882" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -213,7 +221,7 @@
<Color A="1" B="1" G="0" R="0"/>
</c:Fill>
<c:Text>
<Content>100/100</Content>
<Content>150/150</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="0.505882382" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
@@ -422,6 +430,7 @@
<c:Text>
<Content></Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="0.800000012" B="1" G="0.200000003" R="0"/>
<Alignment>
<Right/>
</Alignment>
@@ -485,12 +494,10 @@
</Entity>
<Entity name="Hands">
<Components>
<c:Blend>
<Pose1>BlendTreeAssaultWeapon</Pose1>
<Pose2>BlendTreeSecondaryWeapon</Pose2>
<Weight>0</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:BlendAdditive>
<Adder>MovementBlend</Adder>
<Receiver>FinalBlend</Receiver>
</c:BlendAdditive>
<c:Model>
<Resource>Models/Characters/Defender/FirstPersonDefenderBlue.mesh</Resource>
</c:Model>
@@ -501,7 +508,6 @@
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
<InheritScale>true</InheritScale>
</c:BoneAttachment>
<c:WeaponAttachment>
<Weapon>DefenderWeapon</Weapon>
@@ -510,9 +516,8 @@
<EntityFile>Schema/Entities/WeaponDefenderBlueView.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.120430484" Y="-0.233500004" Z="-0.181454703"/>
<Orientation X="0.0104045747" Y="-0.00268182321" Z="0.0428442061"/>
<Scale X="1.00000012" Y="1.00000024" Z="1.00000012"/>
<Position X="0.120748252" Y="-0.228768602" Z="-0.181454718"/>
<Orientation X="0.0104048951" Y="-0.00268237269" Z="0.0428444892"/>
</c:Transform>
</Components>
<Children/>
@@ -529,38 +534,39 @@
<EntityFile>Schema/Entities/SidearmWeaponView.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.120430484" Y="-0.233500004" Z="-0.181454703"/>
<Orientation X="0.0104045747" Y="-0.00268182321" Z="0.0428442061"/>
<Position X="0.120748252" Y="-0.228768602" Z="-0.181454718"/>
<Orientation X="0.0104048951" Y="-0.00268237269" Z="0.0428444892"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="BlendTreeAssaultWeapon">
<Entity name="FinalBlend">
<Components>
<c:Blend>
<Pose1>Idle</Pose1>
<Pose2>WeaponAction</Pose2>
<Pose1>BlendTreeDefenderWeapon</Pose1>
<Pose2>BlendTreeSecondaryWeapon</Pose2>
<Weight>0</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponAction">
<Entity name="BlendTreeDefenderWeapon">
<Components>
<c:Blend>
<Pose1>Fire</Pose1>
<Pose2>Reload</Pose2>
<Weight>1</Weight>
<Pose1>ActionBlend</Pose1>
<Pose2>Shield</Pose2>
<Weight>0</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Fire">
<Entity name="Shield">
<Components>
<c:Animation>
<AnimationName>ShootShotgunF</AnimationName>
<Time>0.5</Time>
<AnimationName>ActivateDeactiveShieldF</AnimationName>
<Time>1</Time>
<Speed>1</Speed>
<Loop>false</Loop>
</c:Animation>
@@ -568,39 +574,112 @@
</Components>
<Children/>
</Entity>
<Entity name="Reload">
<Entity name="ActionBlend">
<Components>
<c:Animation>
<AnimationName>ReloadSwitchF</AnimationName>
<Time>0.080754529576125833</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Blend>
<Pose1>Idle</Pose1>
<Pose2>ActionBlend2</Pose2>
<Weight>0</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children/>
<Children>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>IdleF</AnimationName>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="ActionBlend2">
<Components>
<c:Blend>
<Pose1>Fire</Pose1>
<Pose2>Reload</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Fire">
<Components>
<c:Animation>
<AnimationName>ShootShotgunF</AnimationName>
<Time>0.5</Time>
<Speed>1</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Reload">
<Components>
<c:Animation>
<AnimationName>ShotgunReloadTwoF</AnimationName>
<Time>0.23333333432674408</Time>
<Speed>1</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="Idle">
<Entity name="BlendTreeSecondaryWeapon">
<Components>
<c:Animation>
<AnimationName>IdleF</AnimationName>
<Time>0.63921736993464151</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="BlendTreeSecondaryWeapon">
<Entity name="MovementBlend">
<Components>
<c:Blend>
<Pose1>Idle</Pose1>
<Pose2>Run</Pose2>
<Weight>0</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children/>
<Children>
<Entity name="Run">
<Components>
<c:Animation>
<AnimationName>RunF</AnimationName>
<Time>0.93061516164344571</Time>
<Speed>1</Speed>
<Play>true</Play>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>IdleF</AnimationName>
<Time>0.11396167157691739</Time>
<Speed>1</Speed>
<Play>true</Play>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -632,9 +711,8 @@
<c:Shielded/>
<c:HiddenForLocalPlayer/>
<c:Model>
<Resource>Models/Characters/Assault/AssaultBlue.mesh</Resource>
<Color A="1" B="1" G="0.952941179" R="1"/>
<Visible>false</Visible>
<Resource>Models/Characters/Defender/DefenderBlue.mesh</Resource>
<Color A="1" B="0" G="0" R="1"/>
</c:Model>
<c:Transform/>
</Components>
@@ -651,11 +729,11 @@
</Person>
</c:WeaponAttachment>
<c:Spawner>
<EntityFile>Schema/Entities/WeaponAssaultBlueWorld.xml</EntityFile>
<EntityFile>Schema/Entities/WeaponDefenderBlueWorld.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.167930618" Y="1.0368073" Z="-0.219703838"/>
<Orientation X="-0.00422216719" Y="-0.0830619708" Z="0.137322947"/>
<Position X="0.157449082" Y="1.04085267" Z="-0.234242111"/>
<Orientation X="-0.0042401799" Y="-0.0355410911" Z="0.137519509"/>
</c:Transform>
</Components>
<Children/>
@@ -675,8 +753,8 @@
<EntityFile>Schema/Entities/SidearmWeaponWorld.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.167930618" Y="1.0368073" Z="-0.219703838"/>
<Orientation X="-0.00422216719" Y="-0.0830619708" Z="0.137322947"/>
<Position X="0.157449082" Y="1.04085267" Z="-0.234242111"/>
<Orientation X="-0.0042401799" Y="-0.0355410911" Z="0.137519509"/>
</c:Transform>
</Components>
<Children/>
@@ -779,11 +857,11 @@
<c:Transform/>
</Components>
<Children>
<Entity name="Left">
<Entity name="Right">
<Components>
<c:Animation>
<AnimationName>CrouchStrafeLeftF</AnimationName>
<Time>0.35189715631383223</Time>
<AnimationName>CrouchStrafeRightF</AnimationName>
<Time>0.73997265048741045</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -791,11 +869,11 @@
</Components>
<Children/>
</Entity>
<Entity name="Right">
<Entity name="Left">
<Components>
<c:Animation>
<AnimationName>CrouchStrafeRightF</AnimationName>
<Time>0.2792186182646148</Time>
<AnimationName>CrouchStrafeLeftF</AnimationName>
<Time>0.81265118853662788</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -809,7 +887,7 @@
<Components>
<c:Animation>
<AnimationName>CrouchWalkF</AnimationName>
<Time>0.057592603442017776</Time>
<Time>0.51834663566481343</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -852,42 +930,6 @@
<c:Transform/>
</Components>
<Children>
<Entity name="RunWalkBlend">
<Components>
<c:Blend>
<Pose1>Walk</Pose1>
<Pose2>Run</Pose2>
<Weight>1.2938206818383024e-24</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Walk">
<Components>
<c:Animation>
<AnimationName>WalkF</AnimationName>
<Time>0.56274723285179107</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Run">
<Components>
<c:Animation>
<AnimationName>RunF</AnimationName>
<Time>0.83476073687569396</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="StrafeLRBlend">
<Components>
<c:Blend>
@@ -902,7 +944,7 @@
<Components>
<c:Animation>
<AnimationName>StrafeRightF</AnimationName>
<Time>0.76785538376544338</Time>
<Time>0.22860941598823903</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -914,7 +956,43 @@
<Components>
<c:Animation>
<AnimationName>StrafeLeftF</AnimationName>
<Time>0.74433985388532875</Time>
<Time>0.2050938861081244</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="RunWalkBlend">
<Components>
<c:Blend>
<Pose1>Walk</Pose1>
<Pose2>Run</Pose2>
<Weight>1.2938206818383024e-24</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Walk">
<Components>
<c:Animation>
<AnimationName>WalkF</AnimationName>
<Time>0.023501265074586719</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Run">
<Components>
<c:Animation>
<AnimationName>RunF</AnimationName>
<Time>0.29551476909848962</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -930,7 +1008,7 @@
<Components>
<c:Animation>
<AnimationName>IdleF</AnimationName>
<Time>0.67830193028129315</Time>
<Time>0.038981432856261655</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -1099,7 +1177,7 @@
<Components>
<c:Animation>
<AnimationName>IdleAssaultRifleU</AnimationName>
<Time>1.9869699178942994</Time>
<Time>0.44772395011709509</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -1111,7 +1189,7 @@
<Components>
<c:Animation>
<AnimationName>IdleSecWepU</AnimationName>
<Time>1.9904949581840867</Time>
<Time>0.45124899040688238</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
@@ -1159,6 +1237,50 @@
</Entity>
</Children>
</Entity>
<Entity name="ShieldSpawner">
<Components>
<c:Transform>
<Position X="0" Y="0.854167223" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="Shield">
<Components>
<c:Blend>
<Pose1>Deploy</Pose1>
<Pose2>Idle</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Model>
<Resource>Models/Characters/Defender/DefenderShield.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="Deploy">
<Components>
<c:Animation>
<AnimationName>ActivateDeactiveShieldF</AnimationName>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>ShieldFrontF</AnimationName>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="AABBStanding">
@@ -1191,7 +1313,7 @@
<Entity name="PlayerName">
<Components>
<c:Text>
<Content>Insert name here</Content>
<Content></Content>
<Resource>Fonts/DroidSans.ttf,100</Resource>
<Color A="1" B="0" G="1" R="0"/>
</c:Text>
+195 -161
View File
@@ -31,116 +31,6 @@
</Components>
<Children/>
</Entity>
<Entity name="HealthHUD">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="HealthBar">
<Components>
<c:Fill>
<Percentage>1</Percentage>
<Color A="0.301960796" B="1" G="0" R="0"/>
</c:Fill>
<c:HealthHUD/>
<c:Sprite>
<DiffuseTexture>Textures/HUD/HealthHudTriMain.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="-0.263000011" Y="-0.185000002" Z="0"/>
<Orientation X="5.87300014" Y="0" Z="4.71200037"/>
<Scale X="0.0799999982" Y="0.333000004" Z="0.150000006"/>
</c:Transform>
</Components>
<Children>
<Entity name="BoostIcons">
<Components>
<c:BoostIconsHUD/>
<c:Transform/>
</Components>
<Children>
<Entity name="Sniper">
<Components>
<c:Fill>
<Color A="1" B="0.345098048" G="0" R="1"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
<Color A="0.588235319" B="0.121568628" G="0" R="0.443137258"/>
</c:Sprite>
<c:Transform>
<Position X="0.225000009" Y="0.38500002" Z="0"/>
<Scale X="0.27700001" Y="0.100000001" Z="0.200000003"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Assault">
<Components>
<c:Fill>
<Color A="1" B="0.533333361" G="1" R="0.329411775"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
<Color A="0.588235319" B="0.0392156877" G="0.184313729" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="0.225000009" Y="0.168000013" Z="0"/>
<Scale X="0.27700001" Y="0.100000001" Z="0.200000003"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Defender">
<Components>
<c:Fill>
<Color A="1" B="1" G="0.58431375" R="0.105882354"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
<Color A="0.588235319" B="0.34117648" G="0.192156866" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="0.224999994" Y="0.27700001" Z="0"/>
<Scale X="0.27700001" Y="0.100000001" Z="0.200000003"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="HealthText">
<Components>
<c:Fill>
<Percentage>1</Percentage>
<Color A="1" B="1" G="0" R="0"/>
</c:Fill>
<c:Text>
<Content>100/100</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="0.505882382" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:HealthHUD/>
<c:Transform>
<Position X="-0.372000009" Y="-0.212000012" Z="0.0560000017"/>
<Orientation X="0" Y="0.410000026" Z="0"/>
<Scale X="0.0189999994" Y="0.0250000004" Z="0.0350000001"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="CapturePointHUD">
<Components>
<c:Transform>
@@ -154,40 +44,7 @@
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0.919596612" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:CapturePointHUD>
<CapturePointNumber>2</CapturePointNumber>
</c:CapturePointHUD>
<c:Fill>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
<Orientation X="0" Y="0" Z="1.57079637"/>
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="BackgroundHexagon">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
<Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite>
<c:Transform>
@@ -197,15 +54,16 @@
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:CapturePointHUD>
<CapturePointNumber>3</CapturePointNumber>
</c:CapturePointHUD>
<c:Fill>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill>
<c:CapturePointHUD>
<CapturePointNumber>3</CapturePointNumber>
</c:CapturePointHUD>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
@@ -222,6 +80,7 @@
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Sprite>
<c:Transform>
@@ -231,16 +90,17 @@
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:CapturePointHUD>
<CapturePointNumber>4</CapturePointNumber>
</c:CapturePointHUD>
<c:Fill>
<Percentage>1</Percentage>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill>
<c:CapturePointHUD>
<CapturePointNumber>4</CapturePointNumber>
</c:CapturePointHUD>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
@@ -257,6 +117,43 @@
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
<Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0.919596612" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:Fill>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill>
<c:CapturePointHUD>
<CapturePointNumber>2</CapturePointNumber>
</c:CapturePointHUD>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
<Orientation X="0" Y="0" Z="1.57079637"/>
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="BackgroundHexagon">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
<Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite>
<c:Transform>
@@ -266,15 +163,16 @@
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:CapturePointHUD>
<CapturePointNumber>1</CapturePointNumber>
</c:CapturePointHUD>
<c:Fill>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill>
<c:CapturePointHUD>
<CapturePointNumber>1</CapturePointNumber>
</c:CapturePointHUD>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
@@ -291,6 +189,7 @@
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
<Color A="0.699999988" B="0" G="0" R="1"/>
</c:Sprite>
<c:Transform>
@@ -300,14 +199,15 @@
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:CapturePointHUD/>
<c:Fill>
<Percentage>1</Percentage>
<Color A="0.699999988" B="0" G="0" R="1"/>
</c:Fill>
<c:CapturePointHUD/>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
@@ -377,23 +277,157 @@
</Entity>
<Entity name="CapturePointArrow">
<Components>
<c:CapturePointArrowHUD/>
<c:Model>
<Resource>Models/Widgets/Arrows/Arrow5.mesh</Resource>
</c:Model>
<c:Team>
<Team>
<Blue/>
</Team>
</c:Team>
<c:CapturePointArrowHUD/>
<c:Model>
<Resource>Models/Widgets/Arrows/Arrow5.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="0.714000046" Z="-1.30000007"/>
<Orientation X="0.405680239" Y="0.369605929" Z="0"/>
<Scale X="0.200000003" Y="0.200000003" Z="0.200000003"/>
<Position X="0" Y="0.198665127" Z="0"/>
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="HealthHUDAssault">
<Components>
<c:Transform>
<Position X="-0.263000011" Y="-0.185000002" Z="0"/>
<Orientation X="5.83699989" Y="0" Z="4.71199989"/>
</c:Transform>
</Components>
<Children>
<Entity name="HealthText">
<Components>
<c:Fill>
<Percentage>1</Percentage>
<Color A="1" B="1" G="0" R="0"/>
</c:Fill>
<c:Text>
<Content>100/100</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="0.505882382" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:HealthHUD/>
<c:Transform>
<Position X="0.0200000014" Y="-0.101000004" Z="0.00300000003"/>
<Orientation X="0" Y="0" Z="1.57070696"/>
<Scale X="0.0350000001" Y="0.0350000001" Z="0.0350000001"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="HealthBar">
<Components>
<c:Fill>
<Percentage>1</Percentage>
<Color A="0.301960796" B="1" G="0" R="0"/>
</c:Fill>
<c:HealthHUD/>
<c:Sprite>
<DiffuseTexture>Textures/HealthHUD3.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
<Scale X="0.106000006" Y="0.333000004" Z="0.150000006"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="BoostIcons">
<Components>
<c:BoostIconsHUD/>
<c:Transform>
<Position X="0" Y="0.00500000035" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="Assault">
<Components>
<c:Fill>
<Color A="1" B="0.533333361" G="1" R="0.329411775"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Icons/Boosts/Assault-01.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
<Color A="0" B="0.0392156877" G="0.184313729" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="0.0250000004" Y="0.0700000003" Z="0"/>
<Orientation X="0" Y="0" Z="3.14199996"/>
<Scale X="0.0399999991" Y="0.0399999991" Z="0.5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Defender">
<Components>
<c:Fill>
<Color A="1" B="1" G="0.58431375" R="0.105882354"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Icons/Boosts/Defender-01.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
<Color A="0" B="0.34117648" G="0.192156866" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="0.0270000007" Y="0.110000007" Z="0"/>
<Orientation X="0" Y="0" Z="3.14199996"/>
<Scale X="0.0399999991" Y="0.0400000028" Z="0.165000007"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Sniper">
<Components>
<c:Fill>
<Color A="1" B="0.345098048" G="0" R="1"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Icons/Boosts/Sniper-01.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
<Color A="0" B="0.121568628" G="0" R="0.443137258"/>
</c:Sprite>
<c:Transform>
<Position X="0.0250000004" Y="0.145000011" Z="0"/>
<Orientation X="0" Y="0" Z="3.14199996"/>
<Scale X="0.0400000028" Y="0.0400000028" Z="0.165000007"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="ShiftAbility">
<Components>
<c:AbilityCooldownHUD/>
<c:Fill>
<Color A="1" B="0.392156869" G="0.392156869" R="0.392156869"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Icons/Abilities/Superman-01.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
<Color A="1" B="0.206628323" G="0.78039217" R="0.192802757"/>
</c:Sprite>
<c:Transform>
<Position X="0.0250000004" Y="0.0100000007" Z="0"/>
<Orientation X="0" Y="0" Z="3.14159203"/>
<Scale X="0.0800000057" Y="0.0700000003" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
+542
View File
@@ -0,0 +1,542 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="PlayerModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BlendAdditive>
<Adder>BlendTreeAim</Adder>
<Receiver>BlendTreeAssault</Receiver>
</c:BlendAdditive>
<c:Shielded/>
<c:HiddenForLocalPlayer/>
<c:Model>
<Resource>Models/Characters/Assault/AssaultBlue.mesh</Resource>
<Color A="1" B="1" G="0.25" R="0"/>
<Visible>false</Visible>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="PrimaryAttachment">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:WeaponAttachment>
<Weapon>AssaultWeapon</Weapon>
<Person>
<ThirdPerson/>
</Person>
</c:WeaponAttachment>
<c:Spawner>
<EntityFile>Schema/Entities/WeaponAssaultBlueWorld.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.165396646" Y="1.14537966" Z="-0.206537575"/>
<Orientation X="0.484640986" Y="-0.00695174001" Z="0.0685098693"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="SecondaryAttachment">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:WeaponAttachment>
<Weapon>SidearmWeapon</Weapon>
<Person>
<ThirdPerson/>
</Person>
</c:WeaponAttachment>
<c:Spawner>
<EntityFile>Schema/Entities/SidearmWeaponWorld.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.165396646" Y="1.14537966" Z="-0.206537575"/>
<Orientation X="0.484640986" Y="-0.00695174001" Z="0.0685098693"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="BlendTreeAim">
<Components>
<c:Blend>
<Pose1>AimPrimary</Pose1>
<Pose2>AimSecondary</Pose2>
<Weight>0</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="AimSecondary">
<Components>
<c:Animation>
<AnimationName>AimSecWepA</AnimationName>
<Time>0.71143966913223267</Time>
<Loop>false</Loop>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="AimPrimary">
<Components>
<c:Animation>
<AnimationName>AimRifleA</AnimationName>
<Time>0.71143966913223267</Time>
<Loop>false</Loop>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="BlendTreeAssault">
<Components>
<c:BlendOverride>
<Master>ReloadSwitchBlend</Master>
<Slave>FinalMovementBlend</Slave>
</c:BlendOverride>
<c:Transform/>
</Components>
<Children>
<Entity name="FinalMovementBlend">
<Components>
<c:Blend>
<Pose1>StandCrouchBlend</Pose1>
<Pose2>JumpDashBlend</Pose2>
<Weight>2.5146881298480398e-63</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="StandCrouchBlend">
<Components>
<c:Blend>
<Pose1>StandMovement</Pose1>
<Pose2>CrouchMovement</Pose2>
<Weight>0</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="CrouchMovement">
<Components>
<c:Blend>
<Pose1>MovementBlend</Pose1>
<Pose2>Idle</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="MovementBlend">
<Components>
<c:Blend>
<Pose1>Walk</Pose1>
<Pose2>StrafeLRBlend</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="StrafeLRBlend">
<Components>
<c:Blend>
<Pose1>Left</Pose1>
<Pose2>Right</Pose2>
<Weight>0.033793529385008014</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Left">
<Components>
<c:Animation>
<AnimationName>CrouchStrafeLeftF</AnimationName>
<Time>0.93215091236880454</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Right">
<Components>
<c:Animation>
<AnimationName>CrouchStrafeRightF</AnimationName>
<Time>0.85947237431958712</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Walk">
<Components>
<c:Animation>
<AnimationName>CrouchWalkF</AnimationName>
<Time>0.63784635949699009</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>CrouchF</AnimationName>
<Time>0.99862473341677438</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="StandMovement">
<Components>
<c:Blend>
<Pose1>MovementBlend</Pose1>
<Pose2>Idle</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="MovementBlend">
<Components>
<c:Blend>
<Pose1>RunWalkBlend</Pose1>
<Pose2>StrafeLRBlend</Pose2>
<Weight>2.4565650245976452e-16</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="RunWalkBlend">
<Components>
<c:Blend>
<Pose1>Walk</Pose1>
<Pose2>Run</Pose2>
<Weight>1.2938206818383024e-24</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Walk">
<Components>
<c:Animation>
<AnimationName>WalkF</AnimationName>
<Time>0.14300098890676338</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Run">
<Components>
<c:Animation>
<AnimationName>RunF</AnimationName>
<Time>0.41501449293066628</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="StrafeLRBlend">
<Components>
<c:Blend>
<Pose1>Left</Pose1>
<Pose2>Right</Pose2>
<Weight>0.033793529385008014</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Left">
<Components>
<c:Animation>
<AnimationName>StrafeLeftF</AnimationName>
<Time>0.32459360994030106</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Right">
<Components>
<c:Animation>
<AnimationName>StrafeRightF</AnimationName>
<Time>0.34810913982041569</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>IdleF</AnimationName>
<Time>1.2585556863362655</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="JumpDashBlend">
<Components>
<c:Blend>
<Pose1>Jump</Pose1>
<Pose2>DashBlend</Pose2>
<Weight>1</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Jump">
<Components>
<c:Animation>
<AnimationName>JumpF</AnimationName>
<Time>0.5</Time>
<Speed>1</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="DashBlend">
<Components>
<c:Blend>
<Pose1>DashFBBlend</Pose1>
<Pose2>DashLRBlend</Pose2>
<Weight>0.014621149736541383</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="DashFBBlend">
<Components>
<c:Blend>
<Pose1>DashForward</Pose1>
<Pose2>DashBackward</Pose2>
<Weight>0.014363533804961248</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="DashForward">
<Components>
<c:Animation>
<AnimationName>DashForwardF</AnimationName>
<Time>1</Time>
<Speed>2</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="DashBackward">
<Components>
<c:Animation>
<AnimationName>DashBackwardF</AnimationName>
<Time>1</Time>
<Speed>2</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="DashLRBlend">
<Components>
<c:Blend>
<Pose1>DashLeft</Pose1>
<Pose2>DashRight</Pose2>
<Weight>4.3244885367500671e-16</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="DashLeft">
<Components>
<c:Animation>
<AnimationName>DashLeftF</AnimationName>
<Time>1</Time>
<Speed>2</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="DashRight">
<Components>
<c:Animation>
<AnimationName>DashRightF</AnimationName>
<Time>1</Time>
<Speed>2</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="ReloadSwitchBlend">
<Components>
<c:Blend>
<Pose1>ReloadSwitch</Pose1>
<Pose2>WeaponActionBlend</Pose2>
<Weight>1</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="ReloadSwitch">
<Components>
<c:Animation>
<AnimationName>ReloadSwitchU</AnimationName>
<Time>0.00030848838797092881</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="WeaponActionBlend">
<Components>
<c:Blend>
<Pose1>IdleBlend</Pose1>
<Pose2>ShootBlend</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="IdleBlend">
<Components>
<c:Blend>
<Pose1>IdlePrimary</Pose1>
<Pose2>IdleSecondary</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="IdlePrimary">
<Components>
<c:Animation>
<AnimationName>IdleAssaultRifleU</AnimationName>
<Time>0.56722367394927176</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="IdleSecondary">
<Components>
<c:Animation>
<AnimationName>IdleSecWepU</AnimationName>
<Time>0.57074871423905904</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="ShootBlend">
<Components>
<c:Blend>
<Pose1>ShootPrimary</Pose1>
<Pose2>ShootSecondary</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="ShootPrimary">
<Components>
<c:Animation>
<AnimationName>ShootFastRifleU</AnimationName>
<Time>0.12914212153428517</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="ShootSecondary">
<Components>
<c:Animation>
<AnimationName>ShootSecWepFastU</AnimationName>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -21,11 +21,11 @@
<Entity name="ScoreBoard_Spectators">
<Components>
<c:ScoreScreen>
<Offset X="0" Y="-1" Z="0"/>
<Offset X="0" Y="-2" Z="0"/>
</c:ScoreScreen>
<c:Team/>
<c:Transform>
<Position X="0" Y="-14" Z="1.5"/>
<Position X="0" Y="-15.7886772" Z="1.5"/>
</c:Transform>
</Components>
<Children/>
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="AssaultWeapon" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Model>
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayRed.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00800000038" Y="0.0920000076" Z="-0.416000009"/>
<Orientation X="6.2760005" Y="0.00500000035" Z="0.00600000005"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="FirstPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectView.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionHUD">
<Components>
<c:Transform>
<Position X="-0.0440000035" Y="0.136000007" Z="-0.119000003"/>
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
</c:Transform>
</Components>
<Children>
<Entity name="AmmunitionHUDBackground">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.00200000009"/>
<Scale X="0.119999997" Y="0.119999997" Z="0.119999997"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionText">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="MagazineAmmo">
<Components>
<c:Text>
<Content>32</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:TextFieldReader>
<ParentEntityName>Player</ParentEntityName>
<ComponentType>AssaultWeapon</ComponentType>
<Field>MagazineAmmo</Field>
</c:TextFieldReader>
<c:Transform>
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Ammo">
<Components>
<c:Text>
<Content>320</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:TextFieldReader>
<ParentEntityName>Player</ParentEntityName>
<ComponentType>AssaultWeapon</ComponentType>
<Field>Ammo</Field>
</c:TextFieldReader>
<c:Transform>
<Position X="5.2833886e-05" Y="-0.0407950208" Z="0"/>
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="ReloadEffect">
<Components>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="AssaultWeapon" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Model>
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayRed.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00644115033" Y="0.096679531" Z="-0.436609417"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ThirdPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
@@ -3,11 +3,9 @@
<Components>
<c:Model>
<Resource>Models/Weapons/Blue/DefenderGunBlue.mesh</Resource>
<Resource>Models/Weapons/Blue/DefenderWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="0.0350000001" Z="-0.295000017"/>
</c:Transform>
<c:Transform/>
</Components>
<Children>
@@ -34,7 +32,7 @@
<Entity name="AmmunitionHUD">
<Components>
<c:Transform>
<Position X="-0.0490000024" Y="0.0520000011" Z="-0.063000001"/>
<Position X="-0.0460000038" Y="0.119000003" Z="-0.162"/>
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
</c:Transform>
</Components>
@@ -2,17 +2,10 @@
<Entity name="ThirdPersonWeaponModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
<PositionOffset X="0" Y="0.0320000015" Z="-0.165000007"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/DefenderGunBlue.mesh</Resource>
<Resource>Models/Weapons/Blue/DefenderWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.162026152" Y="1.05794585" Z="-0.380744517"/>
<Orientation X="-0.0628969446" Y="-0.0509683639" Z="0.118739031"/>
</c:Transform>
<c:Transform/>
</Components>
<Children>
+22 -18
View File
@@ -92,15 +92,15 @@
</Entity>
<Entity>
<Components>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children>
@@ -143,15 +143,15 @@
</Entity>
<Entity>
<Components>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Team>
<Team>
<Blue/>
</Team>
</c:Team>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children>
@@ -209,24 +209,26 @@
<Components>
<c:AABB/>
<c:CapturePoint>
<CaptureTimer>-15</CaptureTimer>
<HomePointForTeam>
<Blue/>
</HomePointForTeam>
</c:CapturePoint>
<c:Model>
<Resource>Models\Core\UnitCube.mesh</Resource>
<Color A="1" B="1" G="0.200000003" R="0"/>
</c:Model>
<c:Team>
<Team>
<Blue/>
</Team>
</c:Team>
<c:Trigger/>
<c:Model>
<Resource>Models\Core\UnitCube.mesh</Resource>
<Color A="0.300000012" B="1" G="0" R="0"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="0.773066521" Z="-18.975975"/>
<Scale X="4.9000001" Y="0.600000024" Z="3.50000024"/>
</c:Transform>
<c:Trigger/>
</Components>
<Children/>
</Entity>
@@ -234,25 +236,27 @@
<Components>
<c:AABB/>
<c:CapturePoint>
<CaptureTimer>15</CaptureTimer>
<HomePointForTeam>
<Red/>
</HomePointForTeam>
<CapturePointNumber>1</CapturePointNumber>
</c:CapturePoint>
<c:Model>
<Resource>Models\Core\UnitCube.mesh</Resource>
<Color A="1" B="1" G="1" R="0"/>
</c:Model>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:Trigger/>
<c:Model>
<Resource>Models\Core\UnitCube.mesh</Resource>
<Color A="0.300000012" B="0" G="0" R="1"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="0.452868998" Z="18.5607414"/>
<Scale X="4.60000038" Y="0.900000036" Z="4.10000038"/>
</c:Transform>
<c:Trigger/>
</Components>
<Children/>
</Entity>
@@ -0,0 +1,336 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="0.980392158" G="1" R="1"/>
</c:Model>
<c:Transform>
<Position X="-0.100000001" Y="0" Z="0"/>
<Scale X="50" Y="1" Z="51.1000023"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="0" G="0" R="1"/>
</c:Model>
<c:Transform>
<Position X="-14.500001" Y="1.50000012" Z="16.9222012"/>
<Scale X="14.4000006" Y="5.30000019" Z="4.5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:DirectionalLight/>
<c:Transform>
<Orientation X="4.38500023" Y="0" Z="0.458000034"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="1" G="0" R="0"/>
</c:Model>
<c:Transform>
<Position X="-14.500001" Y="1.50000012" Z="-17.6888409"/>
<Scale X="14.4000006" Y="5.30000019" Z="4.5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="0" G="0" R="1"/>
</c:Model>
<c:Transform>
<Position X="12.1000004" Y="1.50000012" Z="16.9222012"/>
<Scale X="14.4000006" Y="5.30000019" Z="4.5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:AABB/>
<c:Collidable/>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="1" G="0" R="0"/>
</c:Model>
<c:Transform>
<Position X="12.1228638" Y="1.50000012" Z="-17.9642811"/>
<Scale X="14.4000006" Y="5.30000019" Z="4.5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform>
<Position X="-20.6000004" Y="1" Z="21.7150002"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:PlayerSpawn/>
<c:Transform>
<Position X="-12.2000008" Y="1" Z="21.5000019"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Transform>
<Position X="15.4000006" Y="1" Z="21.6000004"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform>
<Position X="10.500001" Y="0" Z="21.9000015"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity>
<Components>
<c:Team>
<Team>
<Blue/>
</Team>
</c:Team>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform>
<Position X="-9.70000076" Y="1" Z="-23.4000015"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform>
<Position X="-18.8000011" Y="1" Z="-22.3000011"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform>
<Position X="8.10000038" Y="1" Z="-23.2000008"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform>
<Position X="16.2000008" Y="1" Z="-23.2000008"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity>
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="39.2156868" G="0" R="3.13725495"/>
</c:Model>
<c:Transform>
<Scale X="-70" Y="-70" Z="-70"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="-">
<Components>
<c:AABB/>
<c:CapturePoint>
<CaptureTimer>15</CaptureTimer>
<HomePointForTeam>
<Red/>
</HomePointForTeam>
</c:CapturePoint>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:Trigger/>
<c:Transform>
<Position X="0" Y="0" Z="-4.10000038"/>
</c:Transform>
</Components>
<Children>
<Entity name="Red">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform>
<Scale X="2.70000005" Y="3.4000001" Z="4.60000038"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Blue">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform>
<Scale X="3.4000001" Y="4.70000029" Z="0.700000048"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Spectator">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform>
<Scale X="1" Y="5.70000029" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity>
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="-">
<Components>
<c:AABB/>
<c:CapturePoint>
<CaptureTimer>-15</CaptureTimer>
<HomePointForTeam>
<Blue/>
</HomePointForTeam>
<CapturePointNumber>1</CapturePointNumber>
</c:CapturePoint>
<c:Team>
<Team>
<Blue/>
</Team>
</c:Team>
<c:Trigger/>
<c:Transform>
<Position X="0" Y="0" Z="4"/>
</c:Transform>
</Components>
<Children>
<Entity name="Red">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform>
<Scale X="4.4000001" Y="2" Z="3.70000029"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Blue">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform>
<Orientation X="0" Y="2.95000005" Z="0"/>
<Scale X="4.70000029" Y="3.60000014" Z="3.60000014"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Spectator">
<Components>
<c:Model>
<Resource>models/core/unitcube.mesh</Resource>
</c:Model>
<c:Transform>
<Scale X="5.50000048" Y="2.5" Z="3.80000019"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
+1 -1
View File
@@ -171,7 +171,7 @@ void main()
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
float specularResult = (specularTexel.r + specularTexel.g + specularTexel.b)/3.0;
vec4 reflectionTotal = reflectionColor * (1-specularTexel.a) * color_result.a;
vec4 reflectionTotal = reflectionColor * (1-specularTexel.a) * color_result.a * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
color_result = color_result * clamp(1/specularTexel.a, 0, 1) + reflectionTotal;
//vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color;
@@ -178,7 +178,7 @@ void main()
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
float specularResult = (specularTexel.r + specularTexel.g + specularTexel.b)/3.0;
vec4 reflectionTotal = reflectionColor * (1-specularTexel.a) * color_result.a;
vec4 reflectionTotal = reflectionColor * (1-specularTexel.a) * color_result.a * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
color_result = color_result * clamp(1/specularTexel.a, 0, 1) + reflectionTotal;
//vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color;
+3 -3
View File
@@ -619,9 +619,9 @@ boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity, bool takeM
AABB modelSpaceBox;
if (entity.HasComponent("AABB") && !takeModelBox) {
ComponentWrapper& cAABB = entity["AABB"];
modelSpaceBox = EntityAABB::FromOriginSize((glm::vec3)cAABB["Origin"], (glm::vec3)cAABB["Size"]);
modelSpaceBox = EntityAABB::FromOriginSize((const glm::vec3&)cAABB["Origin"], (const glm::vec3&)cAABB["Size"]);
} else if (entity.HasComponent("Model")) {
std::string res = entity["Model"]["Resource"];
const std::string& res = entity["Model"]["Resource"];
if (res.empty()) {
return boost::none;
}
@@ -667,7 +667,7 @@ boost::optional<EntityAABB> AbsoluteAABBExplosionEffect(EntityWrapper& entity)
if (!modelBox) {
return boost::none;
}
bool isRandom = (bool)entity["ExplosionEffect"]["Randomness"];
Field<bool> isRandom = entity["ExplosionEffect"]["Randomness"];
float random = isRandom ? (float)(double)entity["ExplosionEffect"]["RandomnessScalar"] : 0;
glm::vec3 origin = (glm::vec3)entity["ExplosionEffect"]["ExplosionOrigin"];
glm::vec3 randomVel = (glm::vec3)entity["ExplosionEffect"]["Velocity"];
+6 -6
View File
@@ -54,12 +54,12 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
//TODO: Perhaps this should be done slightly more properly.
glm::vec3 newOriginPos = ray.Origin() + (dist - 0.707107f*diameter) * ray.Direction();
glm::vec3 resolve = newOriginPos - boxA.Origin();
(glm::vec3&)cTransform["Position"] += resolve;
(Field<glm::vec3>)cTransform["Position"] += resolve;
boxA = *Collision::EntityAbsoluteAABB(entity);
if (resolve.y > 0) {
everHitTheGround = true;
(bool)cPhysics["IsOnGround"] = true;
((glm::vec3&)cPhysics["Velocity"]).y = 0.f;
cPhysics["IsOnGround"] = true;
((Field<glm::vec3>)cPhysics["Velocity"]).y(0.f);
}
break;
}
@@ -93,7 +93,7 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
float verticalStepHeight = (float)(double)cPhysics["VerticalStepHeight"];
if (Collision::AABBvsTriangles(boxA, model->Vertices(), model->m_Indices, modelMatrix, inOutVelocity, verticalStepHeight, isOnGround, resolutionVector)) {
//Move the position to previous position if it is not moving in the xz-plane, else resolve with the resolution vector.
(glm::vec3&)cTransform["Position"] += notMovingxz ? prevPosIt->second - boxA.Origin() : resolutionVector;
(Field<glm::vec3>)cTransform["Position"] += notMovingxz ? prevPosIt->second - boxA.Origin() : resolutionVector;
boxA = *Collision::EntityAbsoluteAABB(entity);
cPhysics["Velocity"] = inOutVelocity;
if (isOnGround) {
@@ -103,12 +103,12 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
}
} else if (Collision::AABBVsAABB(boxA, boxB, resolutionVector)) {
//Enter here if boxB has no Model.
(glm::vec3&)cTransform["Position"] += resolutionVector;
(Field<glm::vec3>)cTransform["Position"] += resolutionVector;
boxA = *Collision::EntityAbsoluteAABB(entity);
if (resolutionVector.y > 0) {
everHitTheGround = true;
(bool)cPhysics["IsOnGround"] = true;
((glm::vec3&)cPhysics["Velocity"]).y = 0.f;
((Field<glm::vec3>)cPhysics["Velocity"]).y(0.f);
}
}
}
+19 -8
View File
@@ -1,9 +1,17 @@
#include "Core/ComponentPool.h"
ComponentPoolForwardIterator::ComponentPoolForwardIterator(ComponentPool* pool, const MemoryPool<char>::iterator begin, const MemoryPool<char>::iterator end)
: m_ComponentPool(pool)
, m_ComponentInfo(pool->m_ComponentInfo)
, m_MemoryPoolIterator(begin)
, m_MemoryPoolEnd(end)
{ }
ComponentWrapper ComponentPoolForwardIterator::operator*() const
{
char* data = &(*m_MemoryPoolIterator);
ComponentWrapper wrapper(m_ComponentInfo, data);
EntityID entity = *reinterpret_cast<EntityID*>(data);
ComponentWrapper wrapper(m_ComponentInfo, data, &m_ComponentPool->m_DirtySet[entity]);
return wrapper;
}
@@ -44,7 +52,7 @@ ComponentPool::ComponentPool(const ComponentPool& other)
// Duplicate strings
for (auto& name : m_ComponentInfo.StringFields) {
for (auto& c : *this) {
std::string& val = c[name];
Field<std::string> val = c[name];
ComponentWrapper::SolidifyStrings(c);
}
}
@@ -71,7 +79,7 @@ ComponentWrapper ComponentPool::Allocate(EntityID entity)
memcpy(data, &entity, sizeof(EntityID));
m_EntityToComponent[entity] = data;
ComponentWrapper component(m_ComponentInfo, data);
ComponentWrapper component(m_ComponentInfo, data, &m_DirtySet[entity]);
// Copy defaults
memcpy(component.Data, m_ComponentInfo.Defaults.get(), m_ComponentInfo.Stride);
@@ -82,7 +90,9 @@ ComponentWrapper ComponentPool::Allocate(EntityID entity)
ComponentWrapper ComponentPool::GetByEntity(EntityID ent)
{
return ComponentWrapper(m_ComponentInfo, m_EntityToComponent.at(ent));
auto data = m_EntityToComponent.at(ent);
auto bitField = &m_DirtySet[ent];
return ComponentWrapper(m_ComponentInfo, data, bitField);
}
bool ComponentPool::KnowsEntity(EntityID ent)
@@ -95,16 +105,17 @@ void ComponentPool::Delete(ComponentWrapper& wrapper)
ComponentWrapper::Destroy(wrapper.Info, wrapper.Data);
m_EntityToComponent.erase(wrapper.EntityID);
m_Pool.Free(wrapper.Data - sizeof(EntityID));
m_DirtySet.erase(wrapper.EntityID);
}
ComponentPool::iterator ComponentPool::begin() const
ComponentPool::iterator ComponentPool::begin()
{
return iterator(m_ComponentInfo, m_Pool.begin(), m_Pool.end());
return iterator(this, m_Pool.begin(), m_Pool.end());
}
ComponentPool::iterator ComponentPool::end() const
ComponentPool::iterator ComponentPool::end()
{
return iterator(m_ComponentInfo, m_Pool.end(), m_Pool.end());
return iterator(this, m_Pool.end(), m_Pool.end());
}
size_t ComponentPool::size() const
@@ -125,6 +125,7 @@ void EntityXMLFilePreprocessor::parseComponentInfo()
auto modelGroup = modelGroupParticle->getModelGroupTerm();
// <xs:element...
unsigned char fieldIndex = 0;
unsigned int fieldOffset = 0;
auto particles = modelGroup->getParticles();
for (unsigned int i = 0; i < particles->size(); ++i) {
@@ -182,12 +183,14 @@ void EntityXMLFilePreprocessor::parseComponentInfo()
auto& field = compInfo.Fields[name];
field.Name = name;
field.Type = effectiveType;
field.Index = fieldIndex;
field.Offset = fieldOffset;
field.Stride = stride;
compInfo.FieldsInOrder.push_back(name);
if (field.Type == "string") {
compInfo.StringFields.push_back(name);
}
fieldIndex += 1;
fieldOffset += stride;
}
+3 -3
View File
@@ -5,7 +5,7 @@ glm::mat4 Transform::AbsoluteTransformation(EntityWrapper entity)
glm::mat4 t = glm::mat4(1.f);
while (entity.Valid()) {
t = glm::translate((glm::vec3&)entity["Transform"]["Position"]) * glm::toMat4(glm::quat((glm::vec3&)entity["Transform"]["Orientation"])) * glm::scale((glm::vec3&)entity["Transform"]["Scale"]) * t;
t = glm::translate((const glm::vec3&)entity["Transform"]["Position"]) * glm::toMat4(glm::quat((const glm::vec3&)entity["Transform"]["Orientation"])) * glm::scale((const glm::vec3&)entity["Transform"]["Scale"]) * t;
entity = entity.Parent();
}
@@ -24,7 +24,7 @@ glm::vec3 Transform::AbsolutePosition(World* world, EntityID entity)
while (entity != EntityID_Invalid) {
ComponentWrapper transform = world->GetComponent(entity, "Transform");
EntityID parent = world->GetParent(entity);
position += Transform::AbsoluteOrientation(world, parent) * (glm::vec3)transform["Position"];
position += Transform::AbsoluteOrientation(world, parent) * (const glm::vec3&)transform["Position"];
entity = parent;
}
@@ -37,7 +37,7 @@ glm::vec3 Transform::AbsoluteOrientationEuler(EntityWrapper entity)
while (entity.Valid()) {
ComponentWrapper transform = entity["Transform"];
orientation += (glm::vec3)transform["Orientation"];
orientation += (Field<glm::vec3>)transform["Orientation"];
entity = entity.Parent();
}
+2 -2
View File
@@ -13,8 +13,8 @@ void UniformScaleSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper
return;
}
float distance = glm::length((glm::vec3)entity["Transform"]["Position"] - (glm::vec3&)m_Camera["Transform"]["Position"]);
entity["Transform"]["Scale"] = (glm::vec3&)cUniformScale["Scale"] * distance;
float distance = glm::length((glm::vec3)entity["Transform"]["Position"] - (const glm::vec3&)m_Camera["Transform"]["Position"]);
entity["Transform"]["Scale"] = (const glm::vec3&)cUniformScale["Scale"] * distance;
}
bool UniformScaleSystem::OnSetCamera(const Events::SetCamera& e)
+1 -1
View File
@@ -95,7 +95,7 @@ void World::DeleteComponent(EntityID entity, const std::string& componentType)
}
}
const ComponentPool* World::GetComponents(const std::string& componentType)
ComponentPool* World::GetComponents(const std::string& componentType)
{
auto it = m_ComponentPools.find(componentType);
return (it != m_ComponentPools.end()) ? it->second : nullptr;
+11 -11
View File
@@ -19,7 +19,7 @@ EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame
m_ActualCamera = m_EditorCamera;
m_EditorWorld->AttachComponent(m_EditorCamera.ID, "Transform");
m_EditorWorld->AttachComponent(m_EditorCamera.ID, "Camera");
m_EditorCameraInputController = new EditorCameraInputController<EditorSystem>(m_EventBroker, -1);
m_EditorCameraInputController = new EditorCameraInputController<EditorSystem>(m_EventBroker, -1, EntityWrapper::Invalid);
m_EditorGUI = new EditorGUI(m_World, m_EventBroker);
m_EditorGUI->SetEntitySelectedCallback(std::bind(&EditorSystem::OnEntitySelected, this, std::placeholders::_1));
@@ -71,21 +71,21 @@ void EditorSystem::Update(double dt)
m_EditorStats->Draw(actualDelta);
if (m_CurrentSelection.Valid() && m_Widget.Valid()) {
(glm::vec3&)m_Widget["Transform"]["Position"] = Transform::AbsolutePosition(m_CurrentSelection);
m_Widget["Transform"]["Position"] = Transform::AbsolutePosition(m_CurrentSelection);
if (m_WidgetSpace == EditorGUI::WidgetSpace::Local) {
(glm::vec3&)m_Widget["Transform"]["Orientation"] = Transform::AbsoluteOrientationEuler(m_CurrentSelection);
m_Widget["Transform"]["Orientation"] = Transform::AbsoluteOrientationEuler(m_CurrentSelection);
} else {
(glm::vec3&)m_Widget["Transform"]["Orientation"] = glm::vec3(0, 0, 0);
m_Widget["Transform"]["Orientation"] = glm::vec3(0, 0, 0);
}
}
m_EditorWorldSystemPipeline->Update(actualDelta);
ComponentWrapper& cameraTransform = m_EditorCamera["Transform"];
glm::vec3& ori = cameraTransform["Orientation"];
ori.x = m_EditorCameraInputController->Rotation().x;
ori.y = m_EditorCameraInputController->Rotation().y;
glm::vec3& pos = cameraTransform["Position"];
Field<glm::vec3> ori = cameraTransform["Orientation"];
ori.x(m_EditorCameraInputController->Rotation().x);
ori.y(m_EditorCameraInputController->Rotation().y);
Field<glm::vec3> pos = cameraTransform["Position"];
pos += m_EditorCameraInputController->Movement() * glm::inverse(glm::quat(ori)) * (float)actualDelta;
}
}
@@ -101,7 +101,7 @@ void EditorSystem::Enable()
eSetCamera.CameraEntity = m_EditorCamera;
m_EventBroker->Publish(eSetCamera);
if (m_ActualCamera.Valid()) {
(glm::vec3&)m_EditorCamera["Transform"]["Position"] = Transform::AbsolutePosition(m_ActualCamera);
(Field<glm::vec3>)m_EditorCamera["Transform"]["Position"] = Transform::AbsolutePosition(m_ActualCamera);
}
// Pause the world we're editing
@@ -208,11 +208,11 @@ bool EditorSystem::OnWidgetDelta(const Events::WidgetDelta& e)
if (parent.Valid()) {
parentOrientation = glm::inverse(Transform::AbsoluteOrientation(parent));
}
(glm::vec3&)m_CurrentSelection["Transform"]["Position"] += parentOrientation * e.Translation;
(Field<glm::vec3>)m_CurrentSelection["Transform"]["Position"] += parentOrientation * e.Translation;
} else if (m_WidgetSpace == EditorGUI::WidgetSpace::Local) {
glm::quat selectionOri = glm::quat((glm::vec3)m_CurrentSelection["Transform"]["Orientation"]);
glm::vec3 localTranslation = selectionOri * e.Translation;
(glm::vec3&)m_CurrentSelection["Transform"]["Position"] += localTranslation;
(Field<glm::vec3>)m_CurrentSelection["Transform"]["Position"] += localTranslation;
}
m_EditorGUI->SetDirty(m_CurrentSelection);
}
+16 -16
View File
@@ -49,16 +49,16 @@ void Client::Connect(std::string address, int port)
void Client::Update()
{
m_EventBroker->Process<Client>();
while (m_Unreliable.IsSocketAvailable()) {
// Packet will get real data in receive
Packet packet(MessageType::Invalid);
m_Unreliable.Receive(packet);
if (packet.GetMessageType() == MessageType::Connect) {
parseUDPConnect(packet);
} else {
parseMessageType(packet);
}
}
//while (m_Unreliable.IsSocketAvailable()) {
// // Packet will get real data in receive
// Packet packet(MessageType::Invalid);
// m_Unreliable.Receive(packet);
// if (packet.GetMessageType() == MessageType::Connect) {
// parseUDPConnect(packet);
// } else {
// parseMessageType(packet);
// }
//}
while (m_Reliable.IsSocketAvailable()) {
// Packet will get real data in receive
Packet packet(MessageType::Invalid);
@@ -177,8 +177,8 @@ void Client::parseTCPConnect(Packet& packet)
Packet UnreliablePacket(MessageType::Connect, m_SendPacketID);
// Add player id and other stuff
packet.WritePrimitive(m_PlayerID);
m_Unreliable.Send(packet);
LOG_INFO("Sent UDP Connect Server");
// m_Unreliable.Send(packet);
// LOG_INFO("Sent UDP Connect Server");
}
void Client::parsePlayerConnected(Packet & packet)
@@ -476,7 +476,7 @@ bool Client::OnInputCommand(const Events::InputCommand & e)
if (e.Command == "ConnectToServer") { // Connect for now
if (e.Value > 0) {
m_Reliable.Connect(m_PlayerName, m_Address, m_Port);
m_Unreliable.Connect(m_PlayerName, m_Address, m_Port);
// m_Unreliable.Connect(m_PlayerName, m_Address, m_Port);
}
//LOG_DEBUG("Client::OnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
return true;
@@ -596,8 +596,8 @@ void Client::sendLocalPlayerTransform()
Packet packet(MessageType::PlayerTransform, m_SendPacketID);
ComponentWrapper cTransform = m_LocalPlayer["Transform"];
glm::vec3& position = cTransform["Position"];
glm::vec3& orientation = cTransform["Orientation"];
const glm::vec3& position = cTransform["Position"];
const glm::vec3& orientation = cTransform["Orientation"];
packet.WritePrimitive(position.x);
packet.WritePrimitive(position.y);
packet.WritePrimitive(position.z);
@@ -613,7 +613,7 @@ void Client::sendLocalPlayerTransform()
packet.WritePrimitive((int)cAssaultWeapon["Ammo"]);
}
m_Unreliable.Send(packet);
m_Reliable.Send(packet);
}
void Client::identifyPacketLoss()
+44 -40
View File
@@ -47,19 +47,19 @@ void Server::Update()
}
}
PlayerDefinition pd;
while (m_Unreliable.IsSocketAvailable()) {
// Packet will get real data in receive
Packet packet(MessageType::Invalid);
m_Unreliable.Receive(packet, pd);
m_Address = pd.Endpoint.address();
m_Port = pd.Endpoint.port();
if (packet.GetMessageType() == MessageType::Connect) {
parseUDPConnect(packet);
} else {
parseMessageType(packet);
}
}
//PlayerDefinition pd;
//while (m_Unreliable.IsSocketAvailable()) {
// // Packet will get real data in receive
// Packet packet(MessageType::Invalid);
// m_Unreliable.Receive(packet, pd);
// m_Address = pd.Endpoint.address();
// m_Port = pd.Endpoint.port();
// if (packet.GetMessageType() == MessageType::Connect) {
// parseUDPConnect(packet);
// } else {
// parseMessageType(packet);
// }
//}
while (m_ServerlistRequest.IsSocketAvailable()) {
Packet packet(MessageType::Invalid);
@@ -162,7 +162,7 @@ void Server::unreliableBroadcast(Packet& packet)
{
for (auto& kv : m_ConnectedPlayers) {
packet.ChangePacketID(kv.second.PacketID);
m_Unreliable.Send(packet, kv.second);
// m_Unreliable.Send(packet, kv.second);
}
}
@@ -172,7 +172,7 @@ void Server::sendSnapshot()
Packet packet(MessageType::Snapshot);
addInputCommandsToPacket(packet);
addPlayersToPacket(packet, EntityID_Invalid);
unreliableBroadcast(packet);
reliableBroadcast(packet);
}
void Server::addInputCommandsToPacket(Packet& packet)
@@ -222,7 +222,7 @@ void Server::addPlayersToPacket(Packet & packet, EntityID entityID)
for (auto& componentField : componentWrapper.Info.FieldsInOrder) {
ComponentInfo::Field_t fieldInfo = componentWrapper.Info.Fields.at(componentField);
if (fieldInfo.Type == "string") {
std::string& value = componentWrapper[componentField];
const std::string& value = componentWrapper[componentField];
packet.WriteString(value);
} else {
packet.WriteData(componentWrapper.Data + fieldInfo.Offset, fieldInfo.Stride);
@@ -266,7 +266,7 @@ void Server::addChildrenToPacket(Packet & packet, EntityID entityID)
for (auto& componentField : componentWrapper.Info.FieldsInOrder) {
ComponentInfo::Field_t fieldInfo = componentWrapper.Info.Fields.at(componentField);
if (fieldInfo.Type == "string") {
std::string& value = componentWrapper[componentField];
const std::string& value = componentWrapper[componentField];
packet.WriteString(value);
} else {
packet.WriteData(componentWrapper.Data + fieldInfo.Offset, fieldInfo.Stride);
@@ -320,25 +320,28 @@ void Server::checkForTimeOuts()
}
}
void Server::parseUDPConnect(Packet & packet)
{
// Pop size of message int
packet.ReadPrimitive<int>();
int messageType = packet.ReadPrimitive<int>();
// Read packet ID
m_PreviousPacketID = m_PacketID; // Set previous packet id
m_PacketID = packet.ReadPrimitive<int>(); //Read new packet id
// parse player id and other stuff
PlayerID playerID = packet.ReadPrimitive<int>();
// Do something here?
boost::asio::ip::udp::endpoint endpoint(m_Address, m_Port);
m_ConnectedPlayers.at(playerID).Endpoint = endpoint;
LOG_INFO("parseUDPConnect: Spectator \"%s\" connected on IP: %s", m_ConnectedPlayers.at(playerID).Name.c_str(), m_ConnectedPlayers.at(playerID).Endpoint.address().to_string().c_str());
// Send a message to the player that connected
Packet connnectPacket(MessageType::Connect, m_ConnectedPlayers.at(playerID).PacketID);
m_Unreliable.Send(connnectPacket);
LOG_INFO("UDP Connect sent to client");
}
//void Server::parseUDPConnect(Packet & packet)
//{
// // Pop size of message int
// packet.ReadPrimitive<int>();
// int messageType = packet.ReadPrimitive<int>();
// // Read packet ID
// m_PreviousPacketID = m_PacketID; // Set previous packet id
// m_PacketID = packet.ReadPrimitive<int>(); //Read new packet id
// // parse player id and other stuff
// PlayerID playerID = packet.ReadPrimitive<int>();
// if (!EntityWrapper(m_World, playerID).Valid()) {
//
// }
// // Do something here?
// boost::asio::ip::udp::endpoint endpoint(m_Address, m_Port);
// m_ConnectedPlayers.at(playerID).Endpoint = endpoint;
// LOG_INFO("parseUDPConnect: Spectator \"%s\" connected on IP: %s", m_ConnectedPlayers.at(playerID).Name.c_str(), m_ConnectedPlayers.at(playerID).Endpoint.address().to_string().c_str());
// // Send a message to the player that connected
// Packet connnectPacket(MessageType::Connect, m_ConnectedPlayers.at(playerID).PacketID);
// m_Unreliable.Send(connnectPacket);
// LOG_INFO("UDP Connect sent to client");
//}
void Server::parseTCPConnect(Packet & packet)
{
@@ -646,13 +649,14 @@ bool Server::shouldSendToClient(EntityWrapper childEntity)
return true;
}
}
return childEntity.HasComponent("Player")
return childEntity.HasComponent("Player")
|| childEntity.FirstParentWithComponent("Player").Valid()
|| childEntity.HasComponent("CapturePoint")
|| childEntity.HasComponent("CapturePoint")
|| childEntity.HasComponent("HealthPickup")
|| childEntity.HasComponent("AmmoPickup")
|| childEntity.HasComponent("ScoreScreen")
|| childEntity.FirstParentWithComponent("ScoreScreen").Valid();
|| childEntity.FirstParentWithComponent("ScoreScreen").Valid()
|| childEntity.FirstParentWithComponent("CapturePoint").Valid();
}
PlayerID Server::getPlayerIDFromEndpoint()
@@ -671,7 +675,7 @@ PlayerID Server::getPlayerIDFromEndpoint()
PlayerID Server::getPlayerIDFromEntityID(EntityID entityID)
{
for(auto& kv : m_ConnectedPlayers) {
for (auto& kv : m_ConnectedPlayers) {
if (entityID == kv.second.EntityID) {
return kv.first;
}
+8 -3
View File
@@ -21,33 +21,38 @@ void UDPServer::Send(Packet& packet, PlayerDefinition & playerDefinition)
boost::asio::buffer(packet.Data(), packet.Size()),
playerDefinition.Endpoint,
0);
LOG_INFO("Size of packet is %i", bytesSent);
} catch (const boost::system::system_error& e) {
LOG_INFO(e.what());
// TODO: Clean up invalid endpoints out of m_ConnectedPlayers later
playerDefinition.Endpoint = boost::asio::ip::udp::endpoint();
}
}
// Send back to endpoint of received packet
void UDPServer::Send(Packet & packet)
{
packet.UpdateSize();
m_Socket->send_to(
size_t bytesSent = m_Socket->send_to(
boost::asio::buffer(
packet.Data(),
packet.Size()),
m_ReceiverEndpoint,
0);
LOG_INFO("Size of packet is %i", bytesSent);
}
// Broadcasting respond specific logic
void UDPServer::Send(Packet & packet, boost::asio::ip::udp::endpoint endpoint)
{
packet.UpdateSize();
m_Socket->send_to(
size_t bytesSent = m_Socket->send_to(
boost::asio::buffer(
packet.Data(),
packet.Size()),
endpoint,
0);
LOG_INFO("Size of packet is %i", bytesSent);
}
// Broadcasting
@@ -55,7 +60,7 @@ void UDPServer::Broadcast(Packet & packet, int port)
{
packet.UpdateSize();
m_Socket->set_option(boost::asio::socket_base::broadcast(true));
m_Socket->send_to(
size_t bytesSent = m_Socket->send_to(
boost::asio::buffer(
packet.Data(),
packet.Size()),
+14 -13
View File
@@ -71,7 +71,8 @@ void AnimationSystem::UpdateAnimations(double dt)
Model* model;
try {
model = ResourceManager::Load<::Model, true>(modelEntity["Model"]["Resource"]);
Field<std::string> res = modelEntity["Model"]["Resource"];
model = ResourceManager::Load<::Model, true>(res);
} catch (const std::exception&) {
return;
}
@@ -87,23 +88,23 @@ void AnimationSystem::UpdateAnimations(double dt)
continue;;
}
double animationSpeed = (double)animationC["Speed"];
double animationSpeed = (const double&)animationC["Speed"];
if((bool)animationC["Reverse"]) {
if((const bool&)animationC["Reverse"]) {
animationSpeed *= -1;
}
if ((bool)animationC["Play"]) {
if ((const bool&)animationC["Play"]) {
double nextTime = (double)animationC["Time"] + animationSpeed * dt;
if (!(bool)animationC["Loop"]) {
double nextTime = (Field<double>)animationC["Time"] + animationSpeed * dt;
if (!(Field<bool>)animationC["Loop"]) {
if (nextTime > animation->Duration) {
nextTime = animation->Duration;
(bool&)animationC["Play"] = false;
(Field<bool>)animationC["Play"] = false;
} else if (nextTime < 0) {
nextTime = 0;
(bool&)animationC["Play"] = false;
(Field<bool>)animationC["Play"] = false;
}
} else {
if (nextTime > animation->Duration) {
@@ -117,7 +118,7 @@ void AnimationSystem::UpdateAnimations(double dt)
}
}
}
(double&)animationC["Time"] = nextTime;
(Field<double>)animationC["Time"] = nextTime;
}
}
}
@@ -196,21 +197,21 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
abj.BlendInfo.progress = 0.0;
abj.BlendInfo.Start = e.Start;
abj.BlendInfo.SingleBlend = e.SingleLevelBlend;
abj.BlendInfo.Weight = e.Weight;
EntityWrapper nodeEntity = subTreeRoot.FirstChildByName(e.NodeName); // more than one
if (nodeEntity.Valid()) {
if (nodeEntity.HasComponent("Animation")) {
const Skeleton::Animation* animation = skeleton->GetAnimation(nodeEntity["Animation"]["AnimationName"]);
(bool&)nodeEntity["Animation"]["Reverse"] = e.Reverse;
(Field<bool>)nodeEntity["Animation"]["Reverse"] = e.Reverse;
if (e.Restart) {
if (animation != nullptr) {
if (e.Restart) {
if (e.Reverse) {
(double&)nodeEntity["Animation"]["Time"] = animation->Duration;
(Field<double>)nodeEntity["Animation"]["Time"] = animation->Duration;
} else {
(double&)nodeEntity["Animation"]["Time"] = 0.0;
(Field<double>)nodeEntity["Animation"]["Time"] = 0.0;
}
}
}
+27 -11
View File
@@ -16,7 +16,7 @@ BlendTree::BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton)
m_Root = new Node();
m_Root->Entity = ModelEntity;
m_Root->Name = ModelEntity.Name();
m_Root->Pose = m_Skeleton->GetFrameBones(animation, (double)ModelEntity["Animation"]["Time"], (bool)ModelEntity["Animation"]["Additive"]);
m_Root->Pose = m_Skeleton->GetFrameBones(animation, (const double&)ModelEntity["Animation"]["Time"], (const bool&)ModelEntity["Animation"]["Additive"]);
m_Root->Parent = nullptr;
m_Root->Type = NodeType::Animation;
@@ -26,9 +26,9 @@ BlendTree::BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton)
m_Root->Name = ModelEntity.Name();
m_Root->Parent = nullptr;
m_Root->Type = NodeType::Blend;
m_Root->Weight = (double)ModelEntity["Blend"]["Weight"];
m_Root->SubTreeRoot = (bool)ModelEntity["Blend"]["SubTreeRoot"];
(double&)ModelEntity["Blend"]["Weight"] = glm::clamp((double)ModelEntity["Blend"]["Weight"], 0.0, 1.0);
m_Root->Weight = (const double&)ModelEntity["Blend"]["Weight"];
m_Root->SubTreeRoot = (const bool&)ModelEntity["Blend"]["SubTreeRoot"];
ModelEntity["Blend"]["Weight"] = glm::clamp((const double&)ModelEntity["Blend"]["Weight"], 0.0, 1.0);
m_Root->Child[0] = FillTreeByName(m_Root, (std::string)ModelEntity["Blend"]["Pose1"], ModelEntity);
m_Root->Child[1] = FillTreeByName(m_Root, (std::string)ModelEntity["Blend"]["Pose2"], ModelEntity);
@@ -120,7 +120,7 @@ BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, E
Node* node = new Node();
node->Entity = childEntity;
node->Name = childEntity.Name();
node->Pose = m_Skeleton->GetFrameBones(animation, (double)childEntity["Animation"]["Time"], (bool)childEntity["Animation"]["Additive"]);
node->Pose = m_Skeleton->GetFrameBones(animation, (const double&)childEntity["Animation"]["Time"], (const bool&)childEntity["Animation"]["Additive"]);
node->Parent = parentNode;
node->Type = NodeType::Animation;
return node;
@@ -131,9 +131,9 @@ BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, E
node->Name = childEntity.Name();
node->Parent = parentNode;
node->Type = NodeType::Blend;
(double&)childEntity["Blend"]["Weight"] = glm::clamp((double)childEntity["Blend"]["Weight"], 0.0, 1.0);
node->Weight = (double)childEntity["Blend"]["Weight"];
node->SubTreeRoot = (bool)childEntity["Blend"]["SubTreeRoot"];
childEntity["Blend"]["Weight"] = glm::clamp((const double&)childEntity["Blend"]["Weight"], 0.0, 1.0);
node->Weight = (const double&)childEntity["Blend"]["Weight"];
node->SubTreeRoot = (const bool&)childEntity["Blend"]["SubTreeRoot"];
//if (node->Weight < 1.f && node->Weight > 0.f) {
node->Child[0] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose1"], childEntity);
node->Child[1] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose2"], childEntity);
@@ -207,13 +207,29 @@ BlendTree::AutoBlendInfo BlendTree::AutoBlendStep(AutoBlendInfo blendInfo)
{
std::vector<Node*> goalNodes = FindNodesByName(blendInfo.NodeName);
if(blendInfo.Weight >= 0 && blendInfo.Weight <= 1.0) {
for (auto it = goalNodes.begin(); it != goalNodes.end(); it++) {
EntityWrapper entity = (*it)->Entity;
if (entity.Valid()) {
if (entity.HasComponent("Blend")) {
entity["Blend"]["Weight"] = blendInfo.Weight;
}
}
}
return blendInfo;
}
if (blendInfo.Start) {
for (auto it = goalNodes.begin(); it != goalNodes.end(); it++) {
EntityWrapper entity = (*it)->Entity;
if (entity.Valid()) {
if (entity.HasComponent("Animation")) {
(bool&)entity["Animation"]["Play"] = true;
entity["Animation"]["Play"] = true;
}
}
}
@@ -247,7 +263,7 @@ BlendTree::AutoBlendInfo BlendTree::AutoBlendStep(AutoBlendInfo blendInfo)
}
double weight = ((goalWeight - startWeight) * blendInfo.progress) + startWeight;
(double&)currentNode->Entity["Blend"]["Weight"] = weight;
currentNode->Entity["Blend"]["Weight"] = weight;
currentNode->Weight = weight;
lastNode = currentNode;
@@ -310,7 +326,7 @@ BlendTree::AutoBlendInfo BlendTree::AutoBlendStep(AutoBlendInfo blendInfo)
}
double weight = ((goalWeight - startWeight) * blendInfo.progress) + startWeight;
(double&)currentNode->Entity["Blend"]["Weight"] = weight;
currentNode->Entity["Blend"]["Weight"] = weight;
currentNode->Weight = weight;
lastNode = currentNode;
@@ -53,13 +53,13 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp
glm::vec3 angles = glm::vec3(-glm::pitch(rotation), -glm::yaw(rotation), -glm::roll(rotation));
if ((bool)entity["BoneAttachment"]["InheritPosition"]) {
(glm::vec3&)entity["Transform"]["Position"] = translation + (glm::vec3)entity["BoneAttachment"]["PositionOffset"];
entity["Transform"]["Position"] = translation + (glm::vec3)entity["BoneAttachment"]["PositionOffset"];
}
if ((bool)entity["BoneAttachment"]["InheritOrientation"]) {
(glm::vec3&)entity["Transform"]["Orientation"] = angles + (glm::vec3)entity["BoneAttachment"]["OrientationOffset"];
entity["Transform"]["Orientation"] = angles + (glm::vec3)entity["BoneAttachment"]["OrientationOffset"];
}
if ((bool)entity["BoneAttachment"]["InheritScale"]) {
(glm::vec3&)entity["Transform"]["Scale"] = scale * (glm::vec3)entity["BoneAttachment"]["ScaleOffset"];
entity["Transform"]["Scale"] = scale * (glm::vec3)entity["BoneAttachment"]["ScaleOffset"];
}
}
+11 -11
View File
@@ -123,8 +123,8 @@ void SoundManager::updateEmitters(double dt)
setSoundProperties(it->second, &emitter);
// Path changed
if (it->second->SoundResource->Path() != (std::string)emitter["FilePath"]) {
it->second->SoundResource = ResourceManager::Load<Sound>((std::string)emitter["FilePath"]);
if (it->second->SoundResource->Path() != (const std::string&)emitter["FilePath"]) {
it->second->SoundResource = ResourceManager::Load<Sound>((const std::string&)emitter["FilePath"]);
if (it->second->SoundResource->Buffer() != 0) {
playSound(it->second);
}
@@ -205,14 +205,14 @@ bool SoundManager::OnPlaySoundOnPosition(const Events::PlaySoundOnPosition & e)
Source* source = createSource(e.FilePath);
auto emitterID = m_World->CreateEntity();
auto transform = m_World->AttachComponent(emitterID, "Transform");
(glm::vec3&)transform["Position"] = e.Position;
transform["Position"] = e.Position;
auto emitter = m_World->AttachComponent(emitterID, "SoundEmitter");
(float&)(double)emitter["Gain"] = e.Gain;
(float&)(double)emitter["Pitch"] = e.Pitch;
(bool&)emitter["Loop"] = e.Loop;
(float&)(double)emitter["MaxDistance"] = e.MaxDistance;
(float&)(double)emitter["RollOffFactor"] = e.RollOffFactor;
(float&)(double)emitter["ReferenceDistance"] = e.ReferenceDistance;
emitter["Gain"] = e.Gain;
emitter["Pitch"] = e.Pitch;
emitter["Loop"] = e.Loop;
emitter["MaxDistance"] = e.MaxDistance;
emitter["RollOffFactor"] = e.RollOffFactor;
emitter["ReferenceDistance"] = e.ReferenceDistance;
source->Type = SoundType::SFX;
m_Sources[emitterID] = source;
playSound(source);
@@ -246,8 +246,8 @@ bool SoundManager::OnPlayBackgroundMusic(const Events::PlayBackgroundMusic & e)
}
auto emitterChild = m_World->CreateEntity((*it).EntityID);
auto emitter = m_World->AttachComponent(emitterChild, "SoundEmitter");
(bool&)emitter["Loop"] = true;
(std::string&)emitter["FilePath"] = e.FilePath;
emitter["Loop"] = true;
emitter["FilePath"] = e.FilePath;
m_World->AttachComponent(emitterChild, "Transform");
Source* source = createSource(e.FilePath);
source->Type = SoundType::BGM;
-7
View File
@@ -137,20 +137,13 @@ Game::Game(int argc, char* argv[])
m_SystemPipeline->AddSystem<LifetimeSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<CapturePointSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<CapturePointHUDSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<PickupSpawnSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<AmmoPickupSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<DamageIndicatorSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<TextFieldReader>(updateOrderLevel);
m_SystemPipeline->AddSystem<AbilityCooldownHUDSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<CapturePointArrowHUDSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<KillFeedSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<CapturePointSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<CapturePointHUDSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<PickupSpawnSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<AmmoPickupSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<DamageIndicatorSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<TextFieldReader>(updateOrderLevel);
m_SystemPipeline->AddSystem<KillFeedSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<BoostSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<ButtonSystem>(updateOrderLevel, m_Renderer);
m_SystemPipeline->AddSystem<MainMenuSystem>(updateOrderLevel, m_Renderer);
+59 -10
View File
@@ -11,23 +11,72 @@ void AbilityCooldownHUDSystem::Update(double dt)
for (auto& abilityHUDC : *abilityHUDs) {
EntityWrapper entity = EntityWrapper(m_World, abilityHUDC.EntityID);
EntityWrapper abilityEntity = entity.FirstParentWithComponent("DashAbility");
if (!abilityEntity.Valid())
return;
EntityWrapper cooldownTextEntity = entity.FirstChildByName("Cooldown");
std::string abilityName = "";
double maxAbilityCD = (double)abilityEntity["DashAbility"]["CoolDownMaxTimer"];
double currentAbilityCD = (double)abilityEntity["DashAbility"]["CoolDownTimer"];
if (!abilityEntity.Valid()) {
//If we dont have a dash ability on player, we check for Sprint ability
abilityEntity = entity.FirstParentWithComponent("SprintAbility");
currentAbilityCD = currentAbilityCD >= 0.0 ? currentAbilityCD : 0.0;
if (!abilityEntity.Valid()) {
//If we dont have a sprint ability on player, we check for shield ability
abilityEntity = entity.FirstParentWithComponent("ShieldAbility");
if(cooldownTextEntity.Valid()) {
if(cooldownTextEntity.HasComponent("Text"))
{
std::string t = (std::string&)cooldownTextEntity["Text"]["Content"] = std::to_string(currentAbilityCD).substr(0, 3);
if (!abilityEntity.Valid()) {
//If we dont have a shield ability, we return, since we cannot do anything.
return;
} else {
//If we have a shield ability, we set the right icon
abilityName = "ShieldAbility";
if (entity.HasComponent("Sprite")) {
entity["Sprite"]["DiffuseTexture"] = "Textures\\Icons\\Abilities\\SheildDots-01.png";
}
}
} else {
//If we do have a sprint ability, we change the icon
abilityName = "SprintAbility";
if (entity.HasComponent("Sprite")) {
entity["Sprite"]["DiffuseTexture"] = "Textures\\Icons\\Abilities\\Dash-01.png";
}
}
} else {
//If we have a dash ability, we set the icon to the correct one.
abilityName = "DashAbility";
if (entity.HasComponent("Sprite")) {
entity["Sprite"]["DiffuseTexture"] = "Textures\\Icons\\Abilities\\Superman-01.png";
}
}
EntityWrapper cooldownTextEntity = entity.FirstChildByName("Cooldown");
//TODO: Fix so this track correctly for shield and sprint depending on how they work.
double maxAbilityCD, currentAbilityCD;
if (abilityName == "DashAbility") {
maxAbilityCD = (double)abilityEntity[abilityName]["CoolDownMaxTimer"];
currentAbilityCD = (double)abilityEntity[abilityName]["CoolDownTimer"];
currentAbilityCD = currentAbilityCD >= 0.0 ? currentAbilityCD : 0.0;
if (cooldownTextEntity.Valid()) {
if (cooldownTextEntity.HasComponent("Text")) {
cooldownTextEntity["Text"]["Content"] = std::to_string(currentAbilityCD).substr(0, 3);
}
}
}
if (abilityName == "ShieldAbility") {
maxAbilityCD = 0.0;
currentAbilityCD = 1 - (bool)abilityEntity[abilityName]["Active"];
}
if (abilityName == "SprintAbility") {
maxAbilityCD = 0.0;
currentAbilityCD = 1 - (bool)abilityEntity[abilityName]["Active"];
}
if (entity.HasComponent("Fill")) {
entity["Fill"]["Percentage"] = currentAbilityCD/maxAbilityCD;
}
}
}
+5 -4
View File
@@ -96,6 +96,7 @@ bool AmmoPickupSystem::OnAmmoPickup(Events::AmmoPickup & e)
}
currentAmmo = std::min(currentAmmo + e.AmmoGain, maxWeaponAmmo);
return false;
}
@@ -114,8 +115,11 @@ bool AmmoPickupSystem::OnTriggerLeave(Events::TriggerLeave& e) {
}
void AmmoPickupSystem::DoPickup(EntityWrapper &player, EntityWrapper &trigger) {
//trigger should be valid but if it isnt we just return (to avoid crash)
if (!trigger.Valid()) {
return;
}
int maxWeaponAmmo = (int)player["AssaultWeapon"]["MaxAmmo"];
int& currentAmmo = (int)player["AssaultWeapon"]["Ammo"];
int ammoGiven = 0.01*(double)trigger["AmmoPickup"]["AmmoGain"] * maxWeaponAmmo;
Events::AmmoPickup ePlayerAmmoPickup;
@@ -123,9 +127,6 @@ void AmmoPickupSystem::DoPickup(EntityWrapper &player, EntityWrapper &trigger) {
ePlayerAmmoPickup.Player = player;
m_EventBroker->Publish(ePlayerAmmoPickup);
//immediately give the player the ammo (on server)
currentAmmo = std::min(currentAmmo + ammoGiven, maxWeaponAmmo);
//copy position, ammogain, respawntimer (twice since one of the values will be counted down to 0, the other will be set in the new object)
//we need to copy all values since each value can be different for each ammoPickup
m_ETriggerTouchVector.push_back({ (glm::vec3)trigger["Transform"]["Position"], trigger["AmmoPickup"]["AmmoGain"],
+6 -6
View File
@@ -10,9 +10,9 @@ void BoostIconsHUDSystem::UpdateComponent(EntityWrapper& entity, ComponentWrappe
if (assaultEntity.HasComponent("Fill")) {
EntityWrapper parentWithAssaultBoost = assaultEntity.FirstParentWithComponent("BoostAssault");
if (parentWithAssaultBoost.Valid()) {
(double&)assaultEntity["Fill"]["Percentage"] = 1.0;
assaultEntity["Fill"]["Percentage"] = 1.0;
} else {
(double&)assaultEntity["Fill"]["Percentage"] = 0.0;
assaultEntity["Fill"]["Percentage"] = 0.0;
}
}
}
@@ -21,9 +21,9 @@ void BoostIconsHUDSystem::UpdateComponent(EntityWrapper& entity, ComponentWrappe
if (defenderEntity.HasComponent("Fill")) {
EntityWrapper parentWithAssaultBoost = defenderEntity.FirstParentWithComponent("BoostDefender");
if (parentWithAssaultBoost.Valid()) {
(double&)defenderEntity["Fill"]["Percentage"] = 1.0;
defenderEntity["Fill"]["Percentage"] = 1.0;
} else {
(double&)defenderEntity["Fill"]["Percentage"] = 0.0;
defenderEntity["Fill"]["Percentage"] = 0.0;
}
}
}
@@ -32,9 +32,9 @@ void BoostIconsHUDSystem::UpdateComponent(EntityWrapper& entity, ComponentWrappe
if (sniperEntity.HasComponent("Fill")) {
EntityWrapper parentWithAssaultBoost = sniperEntity.FirstParentWithComponent("BoostSniper");
if (parentWithAssaultBoost.Valid()) {
(double&)sniperEntity["Fill"]["Percentage"] = 1.0;
sniperEntity["Fill"]["Percentage"] = 1.0;
} else {
(double&)sniperEntity["Fill"]["Percentage"] = 0.0;
sniperEntity["Fill"]["Percentage"] = 0.0;
}
}
}
@@ -155,13 +155,13 @@ void CapturePointArrowHUDSystem::Update(double dt)
pos = m_BlueTeamCurrentTarget;
}
glm::vec3& arrowOri = arrowEntity["Transform"]["Orientation"];
Field<glm::vec3> arrowOri = arrowEntity["Transform"]["Orientation"];
glm::vec3 lookVector = glm::normalize(Transform::AbsolutePosition(arrowEntity) - pos); //Maybe should be player instead
float pitch = std::asin(-lookVector.y);
float yaw = std::atan2(lookVector.x, lookVector.z);
arrowOri.x = pitch;
arrowOri.y = yaw;
arrowOri.z = 0.f;
arrowOri.x(pitch);
arrowOri.y(yaw);
arrowOri.z(0.f);
EntityWrapper parent = arrowEntity.Parent();
if (parent.Valid()) {
arrowOri -= Transform::AbsoluteOrientationEuler(parent);
+2 -1
View File
@@ -49,7 +49,8 @@ void CapturePointHUDSystem::Update(double dt)
double currentCaptureTime = (double)entityCP["CapturePoint"]["CaptureTimer"];
double progress = glm::abs(currentCaptureTime)/15.0;
int currentCapturingTeam = currentCaptureTime > 0 ? redTeam : currentCaptureTime < 0 ? blueTeam : spectatorTeam;
((glm::vec3&)entityHUD["Transform"]["Orientation"]).z = currentCapturingTeam == redTeam ? glm::half_pi<float>()+glm::pi<float>() : glm::half_pi<float>();
Field<glm::vec3> orientation = entityHUD["Transform"]["Orientation"];
orientation.z(currentCapturingTeam == redTeam ? glm::half_pi<float>()+glm::pi<float>() : glm::half_pi<float>());
glm::vec4 fillColor = currentCapturingTeam == redTeam ? glm::vec4(1, 0.f, 0, 0.7f) : glm::vec4(0, 0.2f, 1, 0.7f);
entityHUD["Fill"]["Color"] = fillColor;
entityHUD["Fill"]["Percentage"] = progress;
+12
View File
@@ -69,6 +69,7 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
int ownedBy = teamComponent["Team"];
int redTeamPlayersStandingInside = 0;
int blueTeamPlayersStandingInside = 0;
//note: old color system
if (capturePointEntity.HasComponent("Model")) {
//Now sets team color to the capturepoint, or white if it is uncaptured.
capturePointEntity["Model"]["Color"] = ownedBy == blueTeam ? glm::vec4(0, 0.0f, 1, 0.3) : ownedBy == redTeam ? glm::vec4(1, 0.0f, 0, 0.3) : glm::vec4(1, 1, 1, 0.3);
@@ -102,7 +103,18 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
nextPossibleCapturePoint["Blue"] = i - 1;
}
}
if (m_RecentlyCapturedNeedNextCapturePointNow) {
//change what model is displaying (change all in case 2 capturepoints has been captured on the same frame)
for (int i = 0; i < m_NumberOfCapturePoints; i++) {
auto owner = (int)m_CapturePointNumberToEntityMap[i]["Team"]["Team"];
if (m_CapturePointNumberToEntityMap[i].FirstChildByName("Red").ID != EntityID_Invalid) {
m_CapturePointNumberToEntityMap[i].FirstChildByName("Red")["Model"]["Visible"] = owner == redTeam ? true : false;
m_CapturePointNumberToEntityMap[i].FirstChildByName("Blue")["Model"]["Visible"] = owner == blueTeam ? true : false;
m_CapturePointNumberToEntityMap[i].FirstChildByName("Spectator")["Model"]["Visible"] = owner == spectatorTeam ? true : false;
}
}
//save the next cap points and publish the captured event
m_CapturedEvent.BlueTeamNextCapturePoint = m_CapturePointNumberToEntityMap[nextPossibleCapturePoint["Blue"]];
m_CapturedEvent.RedTeamNextCapturePoint = m_CapturePointNumberToEntityMap[nextPossibleCapturePoint["Red"]];
m_EventBroker->Publish(m_CapturedEvent);
+4 -3
View File
@@ -2,10 +2,11 @@
void ExplosionEffectSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt)
{
if ((double)component["TimeSinceDeath"] > (double)component["ExplosionDuration"]) {
(double)component["TimeSinceDeath"] = 0.f;
Field<double> timeSinceDeath = component["TimeSinceDeath"];
if (timeSinceDeath > (double)component["ExplosionDuration"]) {
timeSinceDeath = 0.f;
}
(double&)component["TimeSinceDeath"] += dt;
timeSinceDeath += dt;
//if ((bool)Component["Gravity"] == true) {
// (bool)Component["ExponentialAccelaration"] = false;
+11 -7
View File
@@ -22,19 +22,23 @@ void HealthHUDSystem::Update(double dt)
if (entityIDParent.HasComponent("Health")) {
if (entity.HasComponent("Text")) {
Field<double> health = entityIDParent["Health"]["Health"];
Field<double> maxHealth = entityIDParent["Health"]["Health"];
std::string s = "";
s = s + std::to_string((int)(double)entityIDParent["Health"]["Health"]);
s = s + std::to_string((int)health);
s = s + "/";
s = s + std::to_string((int)(double)entityIDParent["Health"]["MaxHealth"]);
float healthPercentage = (double)entityIDParent["Health"]["Health"]/(double)entityIDParent["Health"]["MaxHealth"];
//(glm::vec4&)entity["Text"]["Color"] = glm::vec4(1.0 - healthPercentage, 0.f, healthPercentage, glm::vec4(entity["Text"]["Color"]).a);
s = s + std::to_string((int)maxHealth);
float healthPercentage = health/maxHealth;
//(Field<glm::vec4>)entity["Text"]["Color"] = glm::vec4(1.0 - healthPercentage, 0.f, healthPercentage, glm::vec4(entity["Text"]["Color"]).a);
entity["Text"]["Content"] = s;
}
if(entity.HasComponent("Fill")) {
float healthPercentage = (double)entityIDParent["Health"]["Health"]/(double)entityIDParent["Health"]["MaxHealth"];
(glm::vec4&)entity["Fill"]["Color"] = glm::vec4(1.0 - healthPercentage, 0.f, healthPercentage, glm::vec4(entity["Fill"]["Color"]).a);
(double&)entity["Fill"]["Percentage"] = healthPercentage;
Field<double> health = entityIDParent["Health"]["Health"];
Field<double> maxHealth = entityIDParent["Health"]["Health"];
float healthPercentage = health/maxHealth;
entity["Fill"]["Color"] = glm::vec4(1.0 - healthPercentage, 0.f, healthPercentage, glm::vec4(entity["Fill"]["Color"]).a);
entity["Fill"]["Percentage"] = (double)healthPercentage;
}
}
+3 -3
View File
@@ -21,7 +21,7 @@ bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e)
}
ComponentWrapper cHealth = e.Victim["Health"];
double& health = cHealth["Health"];
Field<double> health = cHealth["Health"];
//if player has the boost from a defender, subtract the damage taken by StrengthOfEffect amount
auto playerBoostDefenderEntity = e.Victim.FirstChildByName("BoostDefender");
if (playerBoostDefenderEntity.Valid()) {
@@ -56,9 +56,9 @@ bool HealthSystem::OnInputCommand(Events::InputCommand& e)
bool HealthSystem::OnPlayerHealthPickup(Events::PlayerHealthPickup& e)
{
ComponentWrapper cHealth = e.Player["Health"];
double& health = cHealth["Health"];
Field<double> health = cHealth["Health"];
health += e.HealthAmount;
health = std::min(health, (double)cHealth["MaxHealth"]);
health = std::min((double)health, (double)cHealth["MaxHealth"]);
return true;
}
+5 -5
View File
@@ -17,7 +17,7 @@ void InterpolationSystem::Update(double dt)
continue;
}
auto& iPosition = kv.second;
glm::vec3& position = iPosition.Component[iPosition.Field];
Field<glm::tvec3<float, glm::highp>> position = iPosition.Component[iPosition.Field];
iPosition.Alpha += dt;
float alpha = glm::min(iPosition.Alpha / m_SnapshotInterval, 1.0);
@@ -31,7 +31,7 @@ void InterpolationSystem::Update(double dt)
continue;
}
auto& iOrientation = kv.second;
glm::vec3& orientation = iOrientation.Component[iOrientation.Field];
Field<glm::vec3> orientation = iOrientation.Component[iOrientation.Field];
iOrientation.Alpha += dt / m_SnapshotInterval;
iOrientation.Alpha = glm::min(iOrientation.Alpha, 1.0);
@@ -45,7 +45,7 @@ void InterpolationSystem::Update(double dt)
continue;
}
auto& iVelocity = kv.second;
glm::vec3& position = iVelocity.Component[iVelocity.Field];
Field<glm::vec3> position = iVelocity.Component[iVelocity.Field];
iVelocity.Alpha += dt;
float alpha = glm::min(iVelocity.Alpha / m_SnapshotInterval, 1.0);
@@ -72,8 +72,8 @@ bool InterpolationSystem::OnInterpolate(Events::Interpolate& e)
Interpolation<glm::quat> iOrientation(
cTransform,
"Orientation",
glm::quat((glm::vec3&)cTransform["Orientation"]),
glm::quat((glm::vec3&)e.Component["Orientation"])
glm::quat((Field<glm::vec3>)cTransform["Orientation"]),
glm::quat((Field<glm::vec3>)e.Component["Orientation"])
);
m_InterpolateOrientation.erase(e.Entity);
m_InterpolateOrientation.insert(std::make_pair(e.Entity, iOrientation));
+5 -5
View File
@@ -13,7 +13,7 @@ void KillFeedSystem::Update(double dt)
for (int i = 1; i <= 3; i++) {
EntityWrapper child = entity.FirstChildByName("KillFeed" + std::to_string(i));
if (child.HasComponent("Text")) {
(std::string&)child["Text"]["Content"] = "";
(Field<std::string>)child["Text"]["Content"] = "";
}
}
@@ -27,14 +27,14 @@ void KillFeedSystem::Update(double dt)
EntityWrapper child = entity.FirstChildByName("KillFeed" + std::to_string(feedIndex));
if (child.HasComponent("Text")) {
(std::string&)child["Text"]["Content"] = (*it).Content;
(glm::vec4&)child["Text"]["Color"] = (*it).Color;
(Field<std::string>)child["Text"]["Content"] = (*it).Content;
(Field<glm::vec4>)child["Text"]["Color"] = (*it).Color;
(*it).TimeToLive -= dt;
if ((*it).TimeToLive <= 0.f) {
(std::string&)child["Text"]["Content"] = "";
(glm::vec4&)child["Text"]["Color"] = (*it).Color;
(Field<std::string>)child["Text"]["Content"] = "";
(Field<glm::vec4>)child["Text"]["Color"] = (*it).Color;
remove = true;
}
}
+1 -1
View File
@@ -18,7 +18,7 @@ void LifetimeSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cL
return;
}
double& lifetime = cLifetime["Lifetime"];
Field<double> lifetime = cLifetime["Lifetime"];
lifetime -= dt;
if (lifetime <= 0.0) {
+4
View File
@@ -83,6 +83,10 @@ bool PickupSpawnSystem::OnTriggerLeave(Events::TriggerLeave& e)
}
void PickupSpawnSystem::DoPickup(EntityWrapper &player, EntityWrapper &trigger)
{
//trigger should be valid but if it isnt we just return (to avoid crash)
if (!trigger.Valid()) {
return;
}
double healthGiven = 0.01*(double)trigger["HealthPickup"]["HealthGain"] * (double)player["Health"]["MaxHealth"];
//only the server will increase the players hp and set it in the next delta
-4
View File
@@ -45,10 +45,6 @@ void PlayerDeathSystem::createDeathEffect(EntityWrapper player)
//copy the data from player to explosioneffectmodel
playerEntityModel.Copy(deathEffectEW["Model"]);
playerEntityAnimation.Copy(deathEffectEW["Animation"]);
//freeze the animation
deathEffectEW["Animation"]["Speed1"] = 0.0;
deathEffectEW["Animation"]["Speed2"] = 0.0;
deathEffectEW["Animation"]["Speed3"] = 0.0;
//copy the models position,orientation
deathEffectEW["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"];
+214 -34
View File
@@ -29,7 +29,7 @@ void PlayerMovementSystem::Update(double dt)
return;
}
m_SprintEffectTimer = 0.f;
const ComponentPool* pool = m_World->GetComponents("SprintAbility");
auto pool = m_World->GetComponents("SprintAbility");
if (pool == nullptr) {
return;
}
@@ -54,7 +54,7 @@ void PlayerMovementSystem::Update(double dt)
playerEntityModel.Copy(sprintEffect["Model"]);
playerEntityAnimation.Copy(sprintEffect["Animation"]);
sprintEffect["ExplosionEffect"]["EndColor"] = (glm::vec4)playerEntityModel["Color"];
((glm::vec4&)sprintEffect["ExplosionEffect"]["EndColor"]).w = 0.f;
((Field<glm::vec4>)sprintEffect["ExplosionEffect"]["EndColor"]).w(0.f);
sprintEffect["Animation"]["Speed1"] = 0.0;
sprintEffect["Animation"]["Speed2"] = 0.0;
sprintEffect["Animation"]["Speed3"] = 0.0;
@@ -77,27 +77,41 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
// Aim pitch
EntityWrapper cameraEntity = player.FirstChildByName("Camera");
if (cameraEntity.Valid()) {
glm::vec3& cameraOrientation = cameraEntity["Transform"]["Orientation"];
cameraOrientation.x += controller->Rotation().x;
Field<glm::vec3> cameraOrientation = cameraEntity["Transform"]["Orientation"];
cameraOrientation.x(cameraOrientation.x() + controller->Rotation().x);
// Limit camera pitch so we don't break our necks
cameraOrientation.x = glm::clamp(cameraOrientation.x, -glm::half_pi<float>(), glm::half_pi<float>());
cameraOrientation.x(glm::clamp(cameraOrientation.x(), -glm::half_pi<float>(), glm::half_pi<float>()));
// Set third person model aim pitch
EntityWrapper playerModel = player.FirstChildByName("PlayerModel");
//Third-person aim
if (playerModel.Valid()) {
//ComponentWrapper cAnimationOffset = playerModel["AnimationOffset"];
//float pitch = cameraOrientation.x + 0.2f;
//double time = (pitch + glm::half_pi<float>()) / glm::pi<float>();
//cAnimationOffset["Time"] = time;
EntityWrapper aimPrimaryEntity = playerModel.FirstChildByName("AimPrimary");
if(aimPrimaryEntity.Valid()){
if(aimPrimaryEntity.HasComponent("Animation")) {
float pitch = cameraOrientation.x() + 0.2f;
double time = (pitch + glm::half_pi<float>()) / glm::pi<float>();
(Field<double>)aimPrimaryEntity["Animation"]["Time"] = time;
}
}
EntityWrapper aimSecondaryEntity = playerModel.FirstChildByName("AimSecondary");
if (aimSecondaryEntity.Valid()) {
if (aimSecondaryEntity.HasComponent("Animation")) {
float pitch = cameraOrientation.x() + 0.2f;
double time = (pitch + glm::half_pi<float>()) / glm::pi<float>();
(Field<double>)aimSecondaryEntity["Animation"]["Time"] = time;
}
}
}
}
ComponentWrapper& cTransform = player["Transform"];
glm::vec3& ori = cTransform["Orientation"];
ori.y += controller->Rotation().y;
Field<glm::vec3> ori = cTransform["Orientation"];
ori.y(ori.y() + controller->Rotation().y);
float playerMovementSpeed = player["Player"]["MovementSpeed"];
float playerCrouchSpeed = player["Player"]["CrouchSpeed"];
glm::vec3& wishDirection = player["Player"]["CurrentWishDirection"];
Field<glm::vec3> wishDirection = player["Player"]["CurrentWishDirection"];
auto playerBoostAssaultEntity = player.FirstChildByName("BoostAssault");
if (playerBoostAssaultEntity.Valid()) {
playerMovementSpeed *= (double)playerBoostAssaultEntity["BoostAssault"]["StrengthOfEffect"];
@@ -117,7 +131,8 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
ComponentWrapper cPhysics = player["Physics"];
//Assault Dash Check
if (player.HasComponent("DashAbility")) {
controller->AssaultDashCheck(dt, ((glm::vec3)cPhysics["Velocity"]).y != 0.0f, player["DashAbility"]["CoolDownMaxTimer"], player["DashAbility"]["CoolDownTimer"], player.ID);
Field<double> coolDownTimer = player["DashAbility"]["CoolDownTimer"];
controller->AssaultDashCheck(dt, ((glm::vec3)cPhysics["Velocity"]).y != 0.0f, player["DashAbility"]["CoolDownMaxTimer"], coolDownTimer, player.ID);
}
wishDirection = controller->Movement() * glm::inverse(glm::quat(ori));
//this makes sure you can only dash in the 4 directions: forw,backw,left,right
@@ -131,21 +146,21 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
wishSpeed = playerMovementSpeed;
}
if (player.ID == m_LocalPlayer.ID) {
if (glm::length(wishDirection) == 0) {
if (glm::length((glm::vec3)wishDirection) == 0) {
// If no key is pressed, reset the distance moved since last step.
m_DistanceMoved = 0;
}
}
glm::vec3& velocity = cPhysics["Velocity"];
Field<glm::vec3> velocity = cPhysics["Velocity"];
bool isOnGround = (bool)cPhysics["IsOnGround"];
//ImGui::Text(isOnGround ? "On ground" : "In air");
//ImGui::Text("velocity: (%f, %f, %f) |%f|", velocity.x, velocity.y, velocity.z, glm::length(velocity));
glm::vec3 groundVelocity(0.f, 0.f, 0.f);
groundVelocity.x = velocity.x;
groundVelocity.z = velocity.z;
groundVelocity.x = velocity.x();
groundVelocity.z = velocity.z();
//ImGui::Text("groundVelocity: (%f, %f, %f) |%f|", groundVelocity.x, groundVelocity.y, groundVelocity.z, glm::length(groundVelocity));
//ImGui::Text("wishDirection: (%f, %f, %f) |%f|", wishDirection.x, wishDirection.y, wishDirection.z, glm::length(wishDirection));
float currentSpeedProj = glm::dot(groundVelocity, wishDirection);
float currentSpeedProj = glm::dot(groundVelocity, (glm::vec3)wishDirection);
float addSpeed = wishSpeed - currentSpeedProj;
//ImGui::Text("currentSpeedProj: %f", currentSpeedProj);
//ImGui::Text("wishSpeed: %f", wishSpeed);
@@ -170,8 +185,8 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
if (sniperSprinting) {
accelerationSpeed *= (double)player["SprintAbility"]["StrengthOfEffect"];
}
velocity += accelerationSpeed * wishDirection;
ImGui::Text("velocity: (%f, %f, %f) |%f|", velocity.x, velocity.y, velocity.z, glm::length(velocity));
velocity += accelerationSpeed * (glm::vec3)wishDirection;
ImGui::Text("velocity: (%f, %f, %f) |%f|", velocity.x(), velocity.y(), velocity.z(), glm::length((glm::vec3)velocity));
}
if (isOnGround) {
@@ -181,11 +196,65 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
if (controller->Jumping() && !controller->Crouching()) {
if (isOnGround) {
(bool)cPhysics["IsOnGround"] = false;
velocity.y = player["Player"]["JumpSpeed"];
velocity.y(player["Player"]["JumpSpeed"]);
if (player.Valid()) {
EntityWrapper playerModel = player.FirstChildByName("PlayerModel");
if (playerModel.Valid()) {
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.15;
aeb.NodeName = "Jump";
aeb.RootNode = playerModel;
aeb.Start = true;
aeb.Restart = true;
m_EventBroker->Publish(aeb);
}
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.25;
aeb.NodeName = "StandCrouchBlend";
aeb.RootNode = playerModel;
aeb.Start = true;
aeb.Restart = false;
aeb.AnimationEntity = playerModel.FirstChildByName("Jump");
m_EventBroker->Publish(aeb);
}
}
}
} else if (player.HasComponent("DoubleJump") && !controller->DoubleJumping()) {
//Enter here if player can double jump and is doing so.
(bool)cPhysics["IsOnGround"] = false;
velocity.y = player["DoubleJump"]["DoubleJumpSpeed"];
velocity.y(player["DoubleJump"]["DoubleJumpSpeed"]);
if (player.Valid()) {
EntityWrapper playerModel = player.FirstChildByName("PlayerModel");
if (playerModel.Valid()) {
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.15;
aeb.NodeName = "Jump";
aeb.RootNode = playerModel;
aeb.Start = true;
aeb.Restart = true;
m_EventBroker->Publish(aeb);
}
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.25;
aeb.NodeName = "StandCrouchBlend";
aeb.RootNode = playerModel;
aeb.Start = true;
aeb.Restart = false;
aeb.AnimationEntity = playerModel.FirstChildByName("Jump");
m_EventBroker->Publish(aeb);
}
}
}
// If IsServer and network is off this will not work
if (IsClient) {
//put a hexagon at the players feet
@@ -200,7 +269,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
}
if (player.HasComponent("AABB")) {
glm::vec3& size = player["AABB"]["Size"];
Field<glm::vec3> size = player["AABB"]["Size"];
if (controller->Crouching()) {
size = glm::vec3(1.f, 1.f, 1.f);
} else {
@@ -222,11 +291,11 @@ void PlayerMovementSystem::updateVelocity(EntityWrapper player, double dt)
// Only apply velocity to local player
ComponentWrapper& cTransform = player["Transform"];
ComponentWrapper& cPhysics = player["Physics"];
glm::vec3& velocity = cPhysics["Velocity"];
Field<glm::vec3> velocity = cPhysics["Velocity"];
bool isOnGround = (bool)cPhysics["IsOnGround"];
// Ground friction
float speed = glm::length(velocity);
float speed = glm::length((glm::vec3)velocity);
static float groundFriction = 7.f;
ImGui::InputFloat("groundFriction", &groundFriction);
static float airFriction = 2.f;
@@ -236,16 +305,16 @@ void PlayerMovementSystem::updateVelocity(EntityWrapper player, double dt)
if (speed > 0) {
float drop = speed * friction * (float)dt;
float multiplier = glm::max(speed - drop, 0.f) / speed;
velocity.x *= multiplier;
velocity.z *= multiplier;
velocity.x(velocity.x() * multiplier);
velocity.z(velocity.z() * multiplier);
}
// Gravity
if (cPhysics["Gravity"]) {
velocity.y -= 9.82f * (float)dt;
velocity.y(velocity.y() - (9.82f * (float)dt));
}
glm::vec3& position = cTransform["Position"];
Field<glm::vec3> position = cTransform["Position"];
position += velocity * (float)dt;
}
@@ -276,7 +345,7 @@ void PlayerMovementSystem::playerStep(double dt)
bool PlayerMovementSystem::OnPlayerSpawned(Events::PlayerSpawned& e)
{
// When a player spawns, create an input controller for them
m_PlayerInputControllers[e.Player] = new FirstPersonInputController<PlayerMovementSystem>(m_EventBroker, e.PlayerID);
m_PlayerInputControllers[e.Player] = new FirstPersonInputController<PlayerMovementSystem>(m_EventBroker, e.PlayerID, e.Player);
if (e.PlayerID == -1) {
// Keep track of the local player
m_LocalPlayer = e.Player;
@@ -309,18 +378,129 @@ void PlayerMovementSystem::spawnHexagon(EntityWrapper target)
bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e)
{
EntityWrapper player(m_World, e.Player);
if (!player.Valid() || !IsClient || player.ID == LocalPlayer.ID) {
if (!player.Valid() || !IsClient){// || player.ID == LocalPlayer.ID) {
return false;
}
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/DashEffect.xml");
EntityWrapper dashEffect = entityFile->MergeInto(m_World);
auto playerModel = player.FirstChildByName("PlayerModel");
auto playerEntityModel = playerModel["Model"];
EntityWrapper playerModel = player.FirstChildByName("PlayerModel");
for (auto& kv : m_PlayerInputControllers) {
EntityWrapper player = kv.first;
auto& controller = kv.second;
if (!player.Valid()) {
continue;
}
if (player.Valid()) {
EntityWrapper playerModel = player.FirstChildByName("PlayerModel");
if (playerModel.Valid()) {
if (glm::abs(controller->Movement().x) > glm::abs(controller->Movement().z)) {
if (controller->Movement().x > 0) {
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.NodeName = "DashRight";
aeb.RootNode = playerModel;
aeb.Restart = true;
aeb.Start = true;
m_EventBroker->Publish(aeb);
}
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.NodeName = "StandCrouchBlend";
aeb.RootNode = playerModel;
aeb.Delay = -0.3;
aeb.Start = true;
aeb.Restart = false;
aeb.AnimationEntity = playerModel.FirstChildByName("DashForward");
m_EventBroker->Publish(aeb);
}
} else {
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.NodeName = "DashLeft";
aeb.RootNode = playerModel;
aeb.Restart = true;
aeb.Start = true;
m_EventBroker->Publish(aeb);
}
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.NodeName = "StandCrouchBlend";
aeb.RootNode = playerModel;
aeb.Delay = -0.3;
aeb.Start = true;
aeb.Restart = false;
aeb.AnimationEntity = playerModel.FirstChildByName("DashForward");
m_EventBroker->Publish(aeb);
}
}
} else {
if (controller->Movement().z < 0) {
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.NodeName = "DashForward";
aeb.RootNode = playerModel;
aeb.Restart = true;
aeb.Start = true;
m_EventBroker->Publish(aeb);
}
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.NodeName = "StandCrouchBlend";
aeb.RootNode = playerModel;
aeb.Delay = -0.3;
aeb.Start = true;
aeb.Restart = false;
aeb.AnimationEntity = playerModel.FirstChildByName("DashForward");
m_EventBroker->Publish(aeb);
}
} else {
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.NodeName = "DashBackward";
aeb.RootNode = playerModel;
aeb.Restart = true;
aeb.Start = true;
m_EventBroker->Publish(aeb);
}
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.NodeName = "StandCrouchBlend";
aeb.RootNode = playerModel;
aeb.Delay = -0.3;
aeb.Start = true;
aeb.Restart = false;
aeb.AnimationEntity = playerModel.FirstChildByName("DashForward");
m_EventBroker->Publish(aeb);
}
}
}
}
}
}
/*
auto playerEntityAnimation = playerModel["Animation"];
playerEntityModel.Copy(dashEffect["Model"]);
playerEntityAnimation.Copy(dashEffect["Animation"]);
dashEffect["ExplosionEffect"]["EndColor"] = (glm::vec4)playerEntityModel["Color"];
((glm::vec4&)dashEffect["ExplosionEffect"]["EndColor"]).w = 0.f;
((Field<glm::vec4>)dashEffect["ExplosionEffect"]["EndColor"]).w = 0.f;
*/
return true;
}
+2 -2
View File
@@ -24,10 +24,10 @@ void PlayerSpawnSystem::Update(double dt)
// Take the first CapturePointGameMode component found.
ComponentWrapper& modeComponent = *pool->begin();
// Increase timer.
double& timer = (double&)modeComponent["RespawnTime"];
Field<double> timer = modeComponent["RespawnTime"];
timer += dt;
if (m_DbgConfigForceRespawn) {
(double&)modeComponent["MaxRespawnTime"] = m_ForcedRespawnTime;
(Field<double>)modeComponent["MaxRespawnTime"] = m_ForcedRespawnTime;
}
double maxRespawnTime = (double)modeComponent["MaxRespawnTime"];
EntityWrapper spectatorCam = m_World->GetFirstEntityByName("SpectatorCamera");
+11 -11
View File
@@ -40,13 +40,13 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper&
if (it->first == ID) {
if (it->second.Team != currentTeam) {
m_World->DeleteEntity(child.ID);
(int&)entity["ScoreScreen"]["TotalIdentities"] -= 1;
(Field<int>)entity["ScoreScreen"]["TotalIdentities"] -= 1;
break;
}
for (auto it2 = m_DisconnectedIdentities.begin(); it2 != m_DisconnectedIdentities.end(); ++it2) {
if (ID == *it2) {
m_World->DeleteEntity(child.ID);
(int&)entity["ScoreScreen"]["TotalIdentities"] -= 1;
(Field<int>)entity["ScoreScreen"]["TotalIdentities"] -= 1;
it2 = m_DisconnectedIdentities.erase(it2);
it = m_PlayerIdentities.erase(it);
@@ -59,17 +59,17 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper&
break;
}
//Update Deaths for child
(int&)child["ScoreIdentity"]["Kills"] = it->second.Kills;
(Field<int>)child["ScoreIdentity"]["Kills"] = it->second.Kills;
//Update Kills for child
(int&)child["ScoreIdentity"]["Deaths"] = it->second.Deaths;
(Field<int>)child["ScoreIdentity"]["Deaths"] = it->second.Deaths;
//KD is not updated at the moment.
if (it->second.Deaths != 0) {
(double&)child["ScoreIdentity"]["KD"] = it->second.Kills/it->second.Deaths;
(Field<double>)child["ScoreIdentity"]["KD"] = it->second.Kills/it->second.Deaths;
}
//Update position for child
glm::vec3 offset = (glm::vec3)entity["ScoreScreen"]["Offset"];
(glm::vec3&) child["Transform"]["Position"] = offset * position;
(Field<glm::vec3>) child["Transform"]["Position"] = offset * position;
position += 1.f;
break;
@@ -78,7 +78,7 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper&
if (it == m_PlayerIdentities.end()) {
break;
}
}
if(found == false) {
if(it->second.Team != currentTeam) {
@@ -90,16 +90,16 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper&
EntityWrapper scoreIdentity = entityFile->MergeInto(m_World);
glm::vec3 offset = (glm::vec3)entity["ScoreScreen"]["Offset"];
int newPosition = (int)entity["ScoreScreen"]["TotalIdentities"];
(glm::vec3&) scoreIdentity["Transform"]["Position"] = offset * (float)newPosition;
(Field<glm::vec3>) scoreIdentity["Transform"]["Position"] = offset * (float)newPosition;
auto cScoreIdentity = scoreIdentity["ScoreIdentity"];
auto data = it->second;
(std::string&)cScoreIdentity["Name"] = data.Name;
(int&)cScoreIdentity["ID"] = data.ID;
(Field<std::string>)cScoreIdentity["Name"] = data.Name;
(Field<int>)cScoreIdentity["ID"] = data.ID;
m_World->SetParent(scoreIdentity.ID, entity.ID);
(int&)entity["ScoreScreen"]["TotalIdentities"] += 1;
(Field<int>)entity["ScoreScreen"]["TotalIdentities"] += 1;
}
}
+1 -1
View File
@@ -86,7 +86,7 @@ bool SpawnerSystem::spawnedEntityIsColliding(EntityWrapper spawnedEntity, Entity
transformEntityToSpawnPoint(spawnedEntity, spawnPoint);
//Check if the spawned entity collides with anything, and if so, continue to the next spawnpoint.
EntityAABB spawnedBox = *Collision::EntityAbsoluteAABB(spawnedEntity);
const ComponentPool* otherSpawnedEntities = spawnPoint.World->GetComponents(dontCollideComponent);
auto otherSpawnedEntities = spawnPoint.World->GetComponents(dontCollideComponent);
for (const auto& obj : *otherSpawnedEntities) {
if (spawnedEntity.ID == obj.EntityID) {
continue;
+1 -1
View File
@@ -30,7 +30,7 @@ void TextFieldReader::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
}
const ComponentInfo::Field_t& field = component.Info.Fields.at(fieldName);
std::string& text = entity["Text"]["Content"];
Field<std::string> text = entity["Text"]["Content"];
if (field.Type == "int") {
text = boost::lexical_cast<std::string>((const int&)component[fieldName]);
@@ -2,7 +2,7 @@
void AssaultWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt)
{
double& fireCooldown = cWeapon["FireCooldown"];
Field<double> fireCooldown = cWeapon["FireCooldown"];
fireCooldown = glm::max(0.0, fireCooldown - dt);
WeaponBehaviour::UpdateComponent(entity, cWeapon, dt);
@@ -11,65 +11,70 @@ void AssaultWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWra
void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt)
{
// Start reloading automatically if at 0 mag ammo
int& magAmmo = cWeapon["MagazineAmmo"];
Field<int> magAmmo = cWeapon["MagazineAmmo"];
if (m_ConfigAutoReload && magAmmo <= 0) {
OnReload(cWeapon, wi);
}
// Only start reloading once we're done firing
bool& reloadQueued = cWeapon["ReloadQueued"];
double& fireCooldown = cWeapon["FireCooldown"];
bool& isReloading = cWeapon["IsReloading"];
Field<bool> reloadQueued = cWeapon["ReloadQueued"];
Field<double> fireCooldown = cWeapon["FireCooldown"];
Field<bool> isReloading = cWeapon["IsReloading"];
if (reloadQueued && fireCooldown <= 0) {
reloadQueued = fireCooldown;
isReloading = true;
}
// Decrement reload timer
double& reloadTimer = cWeapon["ReloadTimer"];
Field<double> reloadTimer = cWeapon["ReloadTimer"];
if (isReloading) {
reloadTimer = glm::max(0.0, reloadTimer - dt);
}
// Handle reloading
if (isReloading && reloadTimer <= 0.0) {
int& magSize = cWeapon["MagazineSize"];
int& ammo = cWeapon["Ammo"];
Field<int> magSize = cWeapon["MagazineSize"];
Field<int> ammo = cWeapon["Ammo"];
ammo = glm::max(0, ammo - (magSize - magAmmo));
magAmmo = glm::min(magSize, ammo);
magAmmo = glm::min(*magSize, *ammo);
isReloading = false;
if (wi.FirstPersonEntity.Valid()) {
wi.FirstPersonEntity["Model"]["Visible"] = true;
}
if (wi.ThirdPersonEntity.Valid()) {
wi.ThirdPersonEntity["Model"]["Visible"] = true;
}
}
// Restore view angle
if (IsClient) {
float& currentTravel = cWeapon["CurrentTravel"];
float& returnSpeed = cWeapon["ViewReturnSpeed"];
Field<float> currentTravel = cWeapon["CurrentTravel"];
Field<float> returnSpeed = cWeapon["ViewReturnSpeed"];
if (currentTravel > 0) {
float change = returnSpeed * dt;
currentTravel = glm::max(0.f, currentTravel - change);
EntityWrapper camera = wi.Player.FirstChildByName("Camera");
if (camera.Valid()) {
glm::vec3& cameraOrientation = camera["Transform"]["Orientation"];
cameraOrientation.x -= change;
Field<glm::vec3> cameraOrientation = camera["Transform"]["Orientation"];
cameraOrientation.x(cameraOrientation.x() - change);
}
}
}
// Update first person run animation
/*ComponentWrapper cPlayer = wi.Player["Player"];
ComponentWrapper cPlayer = wi.Player["Player"];
ComponentWrapper cPhysics = wi.Player["Physics"];
const float& movementSpeed = cPlayer["MovementSpeed"];
float speed = glm::length((const glm::vec3&)cPhysics["Velocity"]);
float animationSpeed = glm::max(speed, movementSpeed) / movementSpeed;
float animationWeight = glm::min(speed, movementSpeed) / movementSpeed;
EntityWrapper rootNode = wi.FirstPersonEntity.FirstParentWithComponent("Model");
if (rootNode.Valid()) {
EntityWrapper animationNode = rootNode.FirstChildByName("Run");
if (animationNode.Valid()) {
(bool&)animationNode["Animation"]["Play"] = animationSpeed > 0;
(double&)animationNode["Animation"]["Speed"] = animationSpeed;
EntityWrapper blend = rootNode.FirstChildByName("MovementBlend");
if (blend.Valid()) {
(Field<double>)blend["Blend"]["Weight"] = animationWeight;
}
}*/
}
// Fire if we're able to fire
if (canFire(cWeapon, wi)) {
@@ -92,24 +97,24 @@ void AssaultWeaponBehaviour::OnCeasePrimaryFire(ComponentWrapper cWeapon, Weapon
void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi)
{
bool& reloadQueued = cWeapon["ReloadQueued"];
bool& isReloading = cWeapon["IsReloading"];
Field<bool> reloadQueued = cWeapon["ReloadQueued"];
Field<bool> isReloading = cWeapon["IsReloading"];
if (reloadQueued || isReloading) {
return;
}
int& magAmmo = cWeapon["MagazineAmmo"];
int& magSize = cWeapon["MagazineSize"];
Field<int> magAmmo = cWeapon["MagazineAmmo"];
Field<int> magSize = cWeapon["MagazineSize"];
if (magAmmo >= magSize) {
return;
}
int& ammo = cWeapon["Ammo"];
Field<int> ammo = cWeapon["Ammo"];
if (ammo <= 0) {
return;
}
double reloadTime = cWeapon["ReloadTime"];
double& reloadTimer = cWeapon["ReloadTimer"];
Field<double> reloadTime = cWeapon["ReloadTime"];
Field<double> reloadTimer = cWeapon["ReloadTimer"];
// Start reload
reloadQueued = true;
@@ -117,12 +122,25 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi)
// Play animation
playAnimationAndReturn(wi.FirstPersonEntity, "BlendTreeAssaultWeapon", "Reload");
// Spawn explosion effect
EntityWrapper reloadEffectSpawner = wi.FirstPersonEntity.FirstChildByName("FirstPersonReloadSpawner");
if (reloadEffectSpawner.Valid()) {
SpawnerSystem::Spawn(reloadEffectSpawner, reloadEffectSpawner);
if (IsClient) {
// Spawn explosion effect
EntityWrapper reloadEffectSpawner = wi.FirstPersonEntity.FirstChildByName("FirstPersonReloadSpawner");
if (reloadEffectSpawner.Valid()) {
SpawnerSystem::Spawn(reloadEffectSpawner, reloadEffectSpawner);
}
if (wi.FirstPersonEntity.Valid()) {
wi.FirstPersonEntity["Model"]["Visible"] = false;
}
if (wi.ThirdPersonEntity.Valid()) {
wi.ThirdPersonEntity["Model"]["Visible"] = false;
}
}
// Sound
Events::PlaySoundOnEntity e;
e.EmitterID = wi.Player.ID;
e.FilePath = "Audio/weapon/Assault/AssaultWeaponReload.wav";
m_EventBroker->Publish(e);
}
void AssaultWeaponBehaviour::OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi)
@@ -145,7 +163,7 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi
cWeapon["FireCooldown"] = 60.0 / (double)cWeapon["RPM"];
// Ammo
int& magAmmo = cWeapon["MagazineAmmo"];
Field<int> magAmmo = cWeapon["MagazineAmmo"];
if (magAmmo <= 0) {
return;
} else {
@@ -156,16 +174,16 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi
if (IsClient) {
EntityWrapper camera = wi.Player.FirstChildByName("Camera");
if (camera.Valid()) {
glm::vec3& cameraOrientation = camera["Transform"]["Orientation"];
Field<glm::vec3> cameraOrientation = camera["Transform"]["Orientation"];
float viewPunch = cWeapon["ViewPunch"];
float maxTravelAngle = cWeapon["MaxTravelAngle"];
float& currentTravel = cWeapon["CurrentTravel"];
Field<float> currentTravel = cWeapon["CurrentTravel"];
if (currentTravel < maxTravelAngle) {
float change = viewPunch;
if (currentTravel + change > maxTravelAngle) {
change = maxTravelAngle - currentTravel;
}
cameraOrientation.x += change;
cameraOrientation.x(cameraOrientation.x() + change);
currentTravel += change;
}
}
@@ -185,7 +203,7 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi
float distance = traceRayDistance(origin, direction);
EntityWrapper ray = SpawnerSystem::Spawn(tracerSpawner);
if (ray.Valid()) {
((glm::vec3&)ray["Transform"]["Scale"]).z = distance;
((Field<glm::vec3>)ray["Transform"]["Scale"]).z(distance);
}
}
@@ -204,6 +222,12 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi
// Play animation
playAnimationAndReturn(wi.FirstPersonEntity, "BlendTreeAssaultWeapon", "Fire");
// Sound
Events::PlaySoundOnEntity e;
e.EmitterID = wi.Player.ID;
e.FilePath = "Audio/weapon/Assault/AssaultWeaponFire.wav";
m_EventBroker->Publish(e);
}
bool AssaultWeaponBehaviour::canFire(ComponentWrapper cWeapon, WeaponInfo& wi)
@@ -2,7 +2,7 @@
void DefenderWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt)
{
double& fireCooldown = cWeapon["FireCooldown"];
Field<double> fireCooldown = cWeapon["FireCooldown"];
fireCooldown = glm::max(0.0, fireCooldown - dt);
WeaponBehaviour::UpdateComponent(entity, cWeapon, dt);
@@ -11,21 +11,21 @@ void DefenderWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWr
void DefenderWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt)
{
// Decrement reload timer
double& reloadTimer = cWeapon["ReloadTimer"];
Field<double> reloadTimer = cWeapon["ReloadTimer"];
reloadTimer = glm::max(0.0, reloadTimer - dt);
// Start reloading automatically if at 0 mag ammo
int& magAmmo = cWeapon["MagazineAmmo"];
Field<int> magAmmo = cWeapon["MagazineAmmo"];
if (m_ConfigAutoReload && magAmmo <= 0) {
OnReload(cWeapon, wi);
}
// Handle reloading
bool& isReloading = cWeapon["IsReloading"];
Field<bool> isReloading = cWeapon["IsReloading"];
if (isReloading && reloadTimer <= 0.0) {
double reloadTime = cWeapon["ReloadTime"];
int& magSize = cWeapon["MagazineSize"];
int& ammo = cWeapon["Ammo"];
Field<int> magSize = cWeapon["MagazineSize"];
Field<int> ammo = cWeapon["Ammo"];
if (magAmmo < magSize && ammo > 0) {
ammo -= 1;
magAmmo += 1;
@@ -36,20 +36,21 @@ void DefenderWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo&
m_EventBroker->Publish(e);
} else {
isReloading = false;
playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "Idle");
}
}
// Restore view angle
if (IsClient) {
float& currentTravel = cWeapon["CurrentTravel"];
float& returnSpeed = cWeapon["ViewReturnSpeed"];
Field<float> currentTravel = cWeapon["CurrentTravel"];
Field<float> returnSpeed = cWeapon["ViewReturnSpeed"];
if (currentTravel > 0) {
float change = returnSpeed * dt;
currentTravel = glm::max(0.f, currentTravel - change);
EntityWrapper camera = wi.Player.FirstChildByName("Camera");
if (camera.Valid()) {
glm::vec3& cameraOrientation = camera["Transform"]["Orientation"];
cameraOrientation.x -= change;
Field<glm::vec3> cameraOrientation = camera["Transform"]["Orientation"];
cameraOrientation.x(cameraOrientation.x() - change);
}
}
}
@@ -75,27 +76,30 @@ void DefenderWeaponBehaviour::OnCeasePrimaryFire(ComponentWrapper cWeapon, Weapo
void DefenderWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi)
{
bool& isReloading = cWeapon["IsReloading"];
Field<bool> isReloading = cWeapon["IsReloading"];
if (isReloading) {
return;
}
int& magAmmo = cWeapon["MagazineAmmo"];
int& magSize = cWeapon["MagazineSize"];
Field<int> magAmmo = cWeapon["MagazineAmmo"];
Field<int> magSize = cWeapon["MagazineSize"];
if (magAmmo >= magSize) {
return;
}
int& ammo = cWeapon["Ammo"];
Field<int> ammo = cWeapon["Ammo"];
if (ammo <= 0) {
return;
}
double reloadTime = cWeapon["ReloadTime"];
double& reloadTimer = cWeapon["ReloadTimer"];
Field<double> reloadTimer = cWeapon["ReloadTimer"];
// Start reload
isReloading = true;
reloadTimer = reloadTime;
// Play animation
playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "Reload");
}
void DefenderWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi)
@@ -115,8 +119,40 @@ bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInf
if (attachment.Valid()) {
if (e.Value > 0) {
SpawnerSystem::Spawn(attachment, attachment);
EntityWrapper root = wi.FirstPersonEntity.FirstParentWithComponent("Model");
if (root.Valid()) {
EntityWrapper subTree = root.FirstChildByName("FinalBlend");
if (subTree.Valid()) {
EntityWrapper animationNode = subTree.FirstChildByName("Shield");
if (animationNode.Valid()) {
Events::AutoAnimationBlend eFireBlend;
eFireBlend.RootNode = root;
eFireBlend.NodeName = "Shield";
eFireBlend.Restart = true;
eFireBlend.Start = true;
m_EventBroker->Publish(eFireBlend);
}
}
}
} else {
attachment.DeleteChildren();
EntityWrapper root = wi.FirstPersonEntity.FirstParentWithComponent("Model");
if (root.Valid()) {
EntityWrapper subTree = root.FirstChildByName("FinalBlend");
if (subTree.Valid()) {
EntityWrapper animationNode = subTree.FirstChildByName("ActionBlend");
if (animationNode.Valid()) {
Events::AutoAnimationBlend eFireBlend;
eFireBlend.RootNode = root;
eFireBlend.NodeName = "ActionBlend";
eFireBlend.Restart = true;
eFireBlend.Start = true;
m_EventBroker->Publish(eFireBlend);
}
}
}
}
}
}
@@ -129,11 +165,11 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi
cWeapon["FireCooldown"] = 60.0 / (double)cWeapon["RPM"];
// Stop reloading
bool& isReloading = cWeapon["IsReloading"];
Field<bool> isReloading = cWeapon["IsReloading"];
isReloading = false;
// Ammo
int& magAmmo = cWeapon["MagazineAmmo"];
Field<int> magAmmo = cWeapon["MagazineAmmo"];
if (magAmmo <= 0) {
return;
} else {
@@ -158,16 +194,16 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi
if (IsClient) {
EntityWrapper camera = wi.Player.FirstChildByName("Camera");
if (camera.Valid()) {
glm::vec3& cameraOrientation = camera["Transform"]["Orientation"];
Field<glm::vec3> cameraOrientation = camera["Transform"]["Orientation"];
float viewPunch = cWeapon["ViewPunch"];
float maxTravelAngle = cWeapon["MaxTravelAngle"];
float& currentTravel = cWeapon["CurrentTravel"];
Field<float> currentTravel = cWeapon["CurrentTravel"];
if (currentTravel < maxTravelAngle) {
float change = viewPunch;
if (currentTravel + change > maxTravelAngle) {
change = maxTravelAngle - currentTravel;
}
cameraOrientation.x += change;
cameraOrientation.x(cameraOrientation.x() + change);
currentTravel += change;
}
}
@@ -186,15 +222,18 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi
glm::vec3 direction = Transform::AbsoluteOrientation(spawner) * glm::quat(glm::vec3(angles, 0.f)) * glm::vec3(0, 0, -1);
float distance = traceRayDistance(Transform::AbsolutePosition(spawner), direction);
EntityWrapper ray = SpawnerSystem::Spawn(spawner);
((glm::vec3&)ray["Transform"]["Scale"]).z = (distance / 100.f);
glm::vec3& orientation = ray["Transform"]["Orientation"];
orientation.x += angles.x;
orientation.y += angles.y;
((Field<glm::vec3>)ray["Transform"]["Scale"]).z(distance / 100.f);
Field<glm::vec3> orientation = ray["Transform"]["Orientation"];
orientation.x(orientation.x() + angles.x);
orientation.y(orientation.y() + angles.y);
glm::vec3 trajectory = direction * distance;
dealDamage(cWeapon, wi, direction, pelletDamage);
}
}
// Play animation
playAnimationAndReturn(wi.FirstPersonEntity, "BlendTreeDefenderWeapon", "Fire");
// Sound
Events::PlaySoundOnEntity e;
e.EmitterID = wi.Player.ID;
@@ -2,7 +2,7 @@
void SidearmWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt)
{
double& cooldown = cWeapon["FireCooldown"];
Field<double> cooldown = cWeapon["FireCooldown"];
if (cooldown > 0) {
cooldown -= dt;
if (cooldown < 0) {
@@ -64,14 +64,14 @@ void SidearmWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi
glm::vec3 direction = Transform::AbsoluteOrientation(tracerSpawner) * glm::vec3(0, 0, -1);
float distance = traceRayDistance(origin, direction);
EntityWrapper ray = SpawnerSystem::Spawn(tracerSpawner);
((glm::vec3&)ray["Transform"]["Scale"]).z = (distance / 100.f);
((Field<glm::vec3>)ray["Transform"]["Scale"]).z(distance / 100.f);
}
}
bool SidearmWeaponBehaviour::canFire(ComponentWrapper cWeapon)
{
bool triggerHeld = cWeapon["TriggerHeld"];
double& cooldown = cWeapon["FireCooldown"];
Field<double> cooldown = cWeapon["FireCooldown"];
// TODO: Ammo checks
return triggerHeld && cooldown <= 0.0;
}
+9 -9
View File
@@ -30,14 +30,14 @@ BOOST_AUTO_TEST_CASE(WorldTestSingleAllocation, * boost::unit_test::tolerance(0.
BOOST_TEST(vec3.z == 3.f);
// Change values
((int&)c["TestInteger"]) += 1;
((Field<int>)c["TestInteger"]) += 1;
BOOST_TEST((int)c["TestInteger"] == 1338);
((double&)c["TestDouble"]) += 1.11;
((Field<double>)c["TestDouble"]) += 1.11;
std::cout << (double)c["TestDouble"] << std::endl;
BOOST_TEST((double)c["TestDouble"] == 14.48);
c["TestString"] = "Siesta";
BOOST_TEST((std::string)c["TestString"] == "Siesta");
((glm::vec3&)c["TestVec3"]).y += 1.f;
((Field<glm::vec3>)c["TestVec3"]).y += 1.f;
BOOST_TEST(((glm::vec3)c["TestVec3"]).y == 3.f);
}
@@ -100,16 +100,16 @@ BOOST_AUTO_TEST_CASE(WorldCopy, *utf::tolerance(0.00001))
// Check that built-in types are copied but don't reside in the same memory
BOOST_CHECK((int)w1_c1["TestInteger"] == (int)w2_c1["TestInteger"]);
BOOST_CHECK(&(int&)w1_c1["TestInteger"] != &(int&)w2_c1["TestInteger"]);
BOOST_CHECK(&(Field<int>)w1_c1["TestInteger"] != &(Field<int>)w2_c1["TestInteger"]);
BOOST_CHECK((double)w1_c1["TestDouble"] == (double)w2_c1["TestDouble"]);
BOOST_CHECK(&(int&)w1_c1["TestDouble"] != &(int&)w2_c1["TestDouble"]);
BOOST_CHECK(&(Field<int>)w1_c1["TestDouble"] != &(Field<int>)w2_c1["TestDouble"]);
BOOST_CHECK((int)w1_c2["TestInteger"] == (int)w2_c2["TestInteger"]);
BOOST_CHECK(&(int&)w1_c2["TestInteger"] != &(int&)w2_c2["TestInteger"]);
BOOST_CHECK(&(Field<int>)w1_c2["TestInteger"] != &(Field<int>)w2_c2["TestInteger"]);
BOOST_CHECK((double)w1_c2["TestDouble"] == (double)w2_c2["TestDouble"]);
BOOST_CHECK(&(int&)w1_c2["TestDouble"] != &(int&)w2_c2["TestDouble"]);
BOOST_CHECK(&(Field<int>)w1_c2["TestDouble"] != &(Field<int>)w2_c2["TestDouble"]);
// Check that specially handled strings are fine
BOOST_CHECK((std::string)w1_c1["TestString"] == (std::string)w2_c1["TestString"]);
BOOST_CHECK(&(std::string&)w1_c1["TestString"] != &(std::string&)w2_c1["TestString"]);
BOOST_CHECK(&(Field<std::string>)w1_c1["TestString"] != &(Field<std::string>)w2_c1["TestString"]);
BOOST_CHECK((std::string)w1_c2["TestString"] == (std::string)w2_c2["TestString"]);
BOOST_CHECK(&(std::string&)w1_c2["TestString"] != &(std::string&)w2_c2["TestString"]);
BOOST_CHECK(&(Field<std::string>)w1_c2["TestString"] != &(Field<std::string>)w2_c2["TestString"]);
}