Added Assault,Defender,Sniper Components,Entities. Added ShieldAbility,Sprintability-Component (not implemented). Changed BoostSystem to use a childed Boost to the player. All friendly fire is 0 damage.
This commit is contained in:
@@ -20,6 +20,6 @@ private:
|
|||||||
EventRelay<BoostSystem, Events::PlayerDamage> m_EPlayerDamage;
|
EventRelay<BoostSystem, Events::PlayerDamage> m_EPlayerDamage;
|
||||||
bool OnPlayerDamage(Events::PlayerDamage& e);
|
bool OnPlayerDamage(Events::PlayerDamage& e);
|
||||||
|
|
||||||
std::string determineClass(EntityWrapper player);
|
std::string DetermineClass(EntityWrapper player);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@@ -35,9 +35,12 @@
|
|||||||
<xs:include schemaLocation="Components/AmmoPickup.xsd"/>
|
<xs:include schemaLocation="Components/AmmoPickup.xsd"/>
|
||||||
<xs:include schemaLocation="Components/AnimationOffset.xsd"/>
|
<xs:include schemaLocation="Components/AnimationOffset.xsd"/>
|
||||||
<xs:include schemaLocation="Components/DashAbility.xsd"/>
|
<xs:include schemaLocation="Components/DashAbility.xsd"/>
|
||||||
|
<xs:include schemaLocation="Components/ShieldAbility.xsd"/>
|
||||||
|
<xs:include schemaLocation="Components/SprintAbility.xsd"/>
|
||||||
<xs:include schemaLocation="Components/AssaultWeapon.xsd"/>
|
<xs:include schemaLocation="Components/AssaultWeapon.xsd"/>
|
||||||
<xs:include schemaLocation="Components/BoostAssault.xsd"/>
|
<xs:include schemaLocation="Components/BoostAssault.xsd"/>
|
||||||
<xs:include schemaLocation="Components/BoostDefender.xsd"/>
|
<xs:include schemaLocation="Components/BoostDefender.xsd"/>
|
||||||
|
<xs:include schemaLocation="Components/BoostSniper.xsd"/>
|
||||||
<xs:include schemaLocation="Components/Shield.xsd"/>
|
<xs:include schemaLocation="Components/Shield.xsd"/>
|
||||||
<xs:include schemaLocation="Components/Sprite.xsd"/>
|
<xs:include schemaLocation="Components/Sprite.xsd"/>
|
||||||
<xs:include schemaLocation="Components/Shielded.xsd"/>
|
<xs:include schemaLocation="Components/Shielded.xsd"/>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
<BoostAssault xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BoostAssault.xsd">
|
<BoostAssault xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BoostAssault.xsd">
|
||||||
<StrengthOfEffect>2</StrengthOfEffect>
|
<StrengthOfEffect>2</StrengthOfEffect>
|
||||||
<LifeTimeOfEffect>5</LifeTimeOfEffect>
|
|
||||||
</BoostAssault>
|
</BoostAssault>
|
||||||
|
|||||||
@@ -12,9 +12,6 @@
|
|||||||
<xs:element name="StrengthOfEffect" type="t:double" minOccurs="0">
|
<xs:element name="StrengthOfEffect" type="t:double" minOccurs="0">
|
||||||
<xs:annotation><xs:documentation>This is the strength of the boost effect</xs:documentation></xs:annotation>
|
<xs:annotation><xs:documentation>This is the strength of the boost effect</xs:documentation></xs:annotation>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:element name="LifeTimeOfEffect" type="t:double" minOccurs="0">
|
|
||||||
<xs:annotation><xs:documentation>How long the effect lasts</xs:documentation></xs:annotation>
|
|
||||||
</xs:element>
|
|
||||||
</xs:all>
|
</xs:all>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
<BoostDefender xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BoostDefender.xsd">
|
<BoostDefender xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BoostDefender.xsd">
|
||||||
<StrengthOfEffect>10</StrengthOfEffect>
|
<StrengthOfEffect>10</StrengthOfEffect>
|
||||||
<LifeTimeOfEffect>5</LifeTimeOfEffect>
|
|
||||||
</BoostDefender>
|
</BoostDefender>
|
||||||
|
|||||||
@@ -12,9 +12,6 @@
|
|||||||
<xs:element name="StrengthOfEffect" type="t:double" minOccurs="0">
|
<xs:element name="StrengthOfEffect" type="t:double" minOccurs="0">
|
||||||
<xs:annotation><xs:documentation>This is the strength of the boost effect</xs:documentation></xs:annotation>
|
<xs:annotation><xs:documentation>This is the strength of the boost effect</xs:documentation></xs:annotation>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:element name="LifeTimeOfEffect" type="t:double" minOccurs="0">
|
|
||||||
<xs:annotation><xs:documentation>How long the effect lasts</xs:documentation></xs:annotation>
|
|
||||||
</xs:element>
|
|
||||||
</xs:all>
|
</xs:all>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<BoostSniper xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BoostSniper.xsd">
|
||||||
|
<StrengthOfEffect>10</StrengthOfEffect>
|
||||||
|
</BoostSniper>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||||
|
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||||
|
|
||||||
|
<xs:element name="BoostSniper">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>This is the defender's class boost component</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:all>
|
||||||
|
<xs:element name="StrengthOfEffect" type="t:double" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>This is the strength of the boost effect</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
</xs:all>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -0,0 +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>
|
||||||
|
</ShieldAbility>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||||
|
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||||
|
|
||||||
|
<xs:element name="ShieldAbility">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>A dash component for one of the classes</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:all>
|
||||||
|
<xs:element name="CoolDownMaxTimer" type="t:double" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>This is the cooldown on dash</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
</xs:all>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<SprintAbility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SprintAbility.xsd">
|
||||||
|
<CoolDownMaxTimer>2.0</CoolDownMaxTimer>
|
||||||
|
</SprintAbility>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||||
|
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||||
|
|
||||||
|
<xs:element name="SprintAbility">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>A dash component for one of the classes</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:all>
|
||||||
|
<xs:element name="CoolDownMaxTimer" type="t:double" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>This is the cooldown on dash</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
</xs:all>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:BoostAssault/>
|
<c:BoostAssault/>
|
||||||
<c:Lifetime>
|
<c:Lifetime>
|
||||||
<Lifetime>55</Lifetime>
|
<Lifetime>10</Lifetime>
|
||||||
</c:Lifetime>
|
</c:Lifetime>
|
||||||
<c:Transform/>
|
<c:Transform/>
|
||||||
</Components>
|
</Components>
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?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:BoostDefender/>
|
||||||
|
<c:Lifetime>
|
||||||
|
<Lifetime>10</Lifetime>
|
||||||
|
</c:Lifetime>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children/>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?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:BoostSniper/>
|
||||||
|
<c:Lifetime>
|
||||||
|
<Lifetime>10</Lifetime>
|
||||||
|
</c:Lifetime>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children/>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -25,35 +25,38 @@ bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//friendly fire
|
auto className = DetermineClass(e.Inflictor);
|
||||||
|
|
||||||
auto className = determineClass(e.Inflictor);
|
|
||||||
if (className == "") {
|
if (className == "") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//"Schema/Entities/BoostAssault.xml"
|
//"Schema/Entities/Boost-.xml"
|
||||||
std::string classXML = "Schema/Entities/" + className + ".xml";
|
std::string classXML = "Schema/Entities/" + className + ".xml";
|
||||||
|
|
||||||
//class
|
//check if player already has the component
|
||||||
|
auto playerBoostAssaultEntity = e.Victim.FirstChildByName(className);
|
||||||
|
if (playerBoostAssaultEntity.Valid()) {
|
||||||
|
m_World->DeleteEntity(playerBoostAssaultEntity.ID);
|
||||||
|
}
|
||||||
//load & set the BoostAssault Component
|
//load & set the BoostAssault Component
|
||||||
auto entityFile = ResourceManager::Load<EntityFile>(classXML);
|
auto entityFile = ResourceManager::Load<EntityFile>(classXML);
|
||||||
EntityFileParser parser(entityFile);
|
EntityFileParser parser(entityFile);
|
||||||
EntityID boostAssaultEntity = parser.MergeEntities(m_World);
|
EntityID boostAssaultEntity = parser.MergeEntities(m_World);
|
||||||
|
m_World->SetName(boostAssaultEntity, className);
|
||||||
m_World->SetParent(boostAssaultEntity, e.Victim.ID);
|
m_World->SetParent(boostAssaultEntity, e.Victim.ID);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BoostSystem::determineClass(EntityWrapper player)
|
std::string BoostSystem::DetermineClass(EntityWrapper inflictorPlayer)
|
||||||
{
|
{
|
||||||
if (m_World->HasComponent(player.ID, "DashAbility")) {
|
//determine the class based on what component the inflictor-player has
|
||||||
|
if (m_World->HasComponent(inflictorPlayer.ID, "DashAbility")) {
|
||||||
return "BoostAssault";
|
return "BoostAssault";
|
||||||
}
|
}
|
||||||
if (m_World->HasComponent(player.ID, "DefenderShield")) {
|
if (m_World->HasComponent(inflictorPlayer.ID, "ShieldAbility")) {
|
||||||
return "BoostDefender";
|
return "BoostDefender";
|
||||||
}
|
}
|
||||||
if (m_World->HasComponent(player.ID, "SniperSprint")) {
|
if (m_World->HasComponent(inflictorPlayer.ID, "SprintAbility")) {
|
||||||
return "BoostSniper";
|
return "BoostSniper";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -30,8 +30,9 @@ bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e)
|
|||||||
|
|
||||||
ComponentWrapper cHealth = e.Victim["Health"];
|
ComponentWrapper cHealth = e.Victim["Health"];
|
||||||
double& health = cHealth["Health"];
|
double& health = cHealth["Health"];
|
||||||
if (e.Victim.HasComponent("BoostDefender")) {
|
auto playerBoostDefenderEntity = e.Victim.FirstChildByName("BoostDefender");
|
||||||
e.Damage -= (double)e.Victim["BoostDefender"]["StrengthOfEffect"];
|
if (playerBoostDefenderEntity.Valid()) {
|
||||||
|
e.Damage -= (double)playerBoostDefenderEntity["BoostDefender"]["StrengthOfEffect"];
|
||||||
}
|
}
|
||||||
health -= e.Damage;
|
health -= e.Damage;
|
||||||
|
|
||||||
|
|||||||
@@ -53,9 +53,10 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
|||||||
float playerMovementSpeed = player["Player"]["MovementSpeed"];
|
float playerMovementSpeed = player["Player"]["MovementSpeed"];
|
||||||
float playerCrouchSpeed = player["Player"]["CrouchSpeed"];
|
float playerCrouchSpeed = player["Player"]["CrouchSpeed"];
|
||||||
glm::vec3& wishDirection = player["Player"]["CurrentWishDirection"];
|
glm::vec3& wishDirection = player["Player"]["CurrentWishDirection"];
|
||||||
if (player.HasComponent("BoostAssault")) {
|
auto playerBoostAssaultEntity = player.FirstChildByName("BoostAssault");
|
||||||
playerMovementSpeed *= (double)player["BoostAssault"]["StrengthOfEffect"];
|
if (playerBoostAssaultEntity.Valid()) {
|
||||||
playerCrouchSpeed *= (double)player["BoostAssault"]["StrengthOfEffect"];
|
playerMovementSpeed *= (double)playerBoostAssaultEntity["BoostAssault"]["StrengthOfEffect"];
|
||||||
|
playerCrouchSpeed *= (double)playerBoostAssaultEntity["BoostAssault"]["StrengthOfEffect"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -110,8 +111,8 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
|||||||
float doubleTapDashBoost = controller->AssaultDashDoubleTapped() ? 40.0f : 1.0f;
|
float doubleTapDashBoost = controller->AssaultDashDoubleTapped() ? 40.0f : 1.0f;
|
||||||
accelerationSpeed = glm::min(doubleTapDashBoost*glm::min(accelerationSpeed, addSpeed), 50.0f);
|
accelerationSpeed = glm::min(doubleTapDashBoost*glm::min(accelerationSpeed, addSpeed), 50.0f);
|
||||||
//if player has Boost from an Assault class, accelerate the player faster
|
//if player has Boost from an Assault class, accelerate the player faster
|
||||||
if (player.HasComponent("BoostAssault")) {
|
if (playerBoostAssaultEntity.Valid()) {
|
||||||
accelerationSpeed *= (double)player["BoostAssault"]["StrengthOfEffect"];
|
accelerationSpeed *= (double)playerBoostAssaultEntity["BoostAssault"]["StrengthOfEffect"];
|
||||||
}
|
}
|
||||||
velocity += accelerationSpeed * wishDirection;
|
velocity += accelerationSpeed * wishDirection;
|
||||||
ImGui::Text("velocity: (%f, %f, %f) |%f|", velocity.x, velocity.y, velocity.z, glm::length(velocity));
|
ImGui::Text("velocity: (%f, %f, %f) |%f|", velocity.x, velocity.y, velocity.z, glm::length(velocity));
|
||||||
|
|||||||
@@ -385,11 +385,10 @@ bool AssaultWeaponBehaviour::shoot(double damage)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Do Not Check for friendly fire
|
// BoostUpdate: If friendly fire - reduce damage to 0
|
||||||
//// Check for friendly fire
|
if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)m_Player["Team"]["Team"]) {
|
||||||
//if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)m_Player["Team"]["Team"]) {
|
damage = 0;
|
||||||
// return false;
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
// Deal damage!
|
// Deal damage!
|
||||||
Events::PlayerDamage ePlayerDamage;
|
Events::PlayerDamage ePlayerDamage;
|
||||||
|
|||||||
Reference in New Issue
Block a user