Defender early alpha

This commit is contained in:
viktorljung
2016-03-11 19:16:34 +01:00
parent 266aca467e
commit e0a6b09d36
10 changed files with 839 additions and 440 deletions
+1 -1
Submodule assets updated: 298641b1af...69ddae179a
@@ -22,6 +22,8 @@ public:
void OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) override;
void OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) override;
bool OnInputCommand(ComponentWrapper cWeapon, WeaponInfo& wi, const Events::InputCommand& e) override;
void OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi) override;
private:
std::random_device m_RandomDevice;
+10 -9
View File
@@ -2,9 +2,7 @@
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Transform>
<Position X="1.70262027" Y="0.261695802" Z="-3.26634645"/>
</c:Transform>
<c:Transform/>
</Components>
<Children>
@@ -32,8 +30,8 @@
<Entity name="Deploy">
<Components>
<c:Animation>
<AnimationName>ActivateDeactiveShieldF</AnimationName>
<Play>true</Play>
<AnimationName>ActivateShieldU</AnimationName>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
@@ -42,7 +40,8 @@
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>ShieldFrontF</AnimationName>
<AnimationName>ShieldFrontU</AnimationName>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
@@ -67,14 +66,15 @@
<SpecularMap>false</SpecularMap>
<GlowMap>false</GlowMap>
</c:Model>
<c:Shield/>
<c:Transform/>
</Components>
<Children>
<Entity name="Deploy">
<Components>
<c:Animation>
<AnimationName>ActivateDeactiveShieldF</AnimationName>
<Play>true</Play>
<AnimationName>ActivateShieldU</AnimationName>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
@@ -83,7 +83,8 @@
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>ShieldFrontF</AnimationName>
<AnimationName>ShieldFrontU</AnimationName>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
+2 -2
View File
@@ -103,7 +103,7 @@
<Color A="1" B="1" G="0.254901975" R="0"/>
</c:Model>
<c:Transform>
<Position X="0.800000012" Y="0" Z="0"/>
<Position X="-0.600000024" Y="0" Z="0.549540162"/>
</c:Transform>
</Components>
<Children/>
@@ -116,7 +116,7 @@
<Color A="1" B="1" G="0.254901975" R="0"/>
</c:Model>
<c:Transform>
<Position X="-0.600000024" Y="0" Z="0.549540162"/>
<Position X="0.800000012" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="SidearmWeapon" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Model>
<Resource>Models/Weapons/Blue/SecondaryWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.0123999491" Y="0.102453232" Z="-0.273824364"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
@@ -27,7 +27,7 @@
<Entity name="Shield">
<Components>
<c:Animation>
<AnimationName>ActivateDeactivateShieldF</AnimationName>
<AnimationName>ActivateShieldF</AnimationName>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
@@ -156,7 +156,7 @@
</c:Model>
<c:Transform>
<Position X="0.120748043" Y="-0.228436321" Z="-0.151475549"/>
<Orientation X="0.0104044285" Y="-0.00268185162" Z="0.0428444184"/>
<Orientation X="0.0102800643" Y="-0.00312487315" Z="0.0428144038"/>
</c:Transform>
</Components>
<Children>
@@ -190,16 +190,17 @@
</c:BoneAttachment>
<c:Transform>
<Position X="0.0540262833" Y="-0.0954347998" Z="-0.225546911"/>
<Orientation X="0.000683821447" Y="0.0774240941" Z="-1.56960988"/>
<Scale X="0.500000179" Y="0.500000179" Z="0.499999911"/>
<Orientation X="0.00124507793" Y="0.077417776" Z="0.00737103401"/>
<Scale X="0.5" Y="0.50000006" Z="0.499999911"/>
</c:Transform>
</Components>
<Children>
<Entity name="Background">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="Hands" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BlendAdditive>
<Adder>MovementBlend</Adder>
<Receiver>ActionBlend</Receiver>
</c:BlendAdditive>
<c:Model>
<Resource>Models/Characters/Defender/FirstPersonDefenderBlue.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="MovementBlend">
<Components>
<c:Blend>
<Pose1>Idle</Pose1>
<Pose2>Run</Pose2>
<Weight>1</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>IdleSecF</AnimationName>
<Play>true</Play>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Run">
<Components>
<c:Animation>
<AnimationName>RunSecF</AnimationName>
<Play>true</Play>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="ViewModel">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/SecondaryWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.18578662" Y="-0.216220587" Z="-0.382728696"/>
<Orientation X="0.010279973" Y="-0.00312555139" Z="0.0428142436"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00191565475" Y="0.0324025005" Z="-0.2021029"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectView.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="AmmoHUD">
<Components>
<c:BoneAttachment>
<BoneName>R_Ammo_Joint</BoneName>
<InheritScale>true</InheritScale>
</c:BoneAttachment>
<c:Transform>
<Position X="0.109812573" Y="-0.0832190216" Z="-0.373473197"/>
<Orientation X="0.00118373742" Y="0.077411525" Z="0.00458352407"/>
<Scale X="0.500000119" Y="0.5" Z="0.500000119"/>
</c:Transform>
</Components>
<Children>
<Entity name="Background">
<Components>
<c:Sprite>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<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="Text">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="Ammo">
<Components>
<c:Text>
<Content>38</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:TextFieldReader>
<ParentEntityName></ParentEntityName>
<ComponentType>Sidearm</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>
<Entity name="MagazineAmmo">
<Components>
<c:Text>
<Content>5</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:TextFieldReader>
<ParentEntityName></ParentEntityName>
<ComponentType>Sidearm</ComponentType>
<Field>MagazineAmmo</Field>
</c:TextFieldReader>
<c:Transform>
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="ActionBlend">
<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>ShootSecF</AnimationName>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Reload">
<Components>
<c:Animation>
<AnimationName>ReloadSwitchSecF</AnimationName>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -37,6 +37,16 @@ void DefenderWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo&
} else {
isReloading = false;
playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "ReloadEnd");
if (wi.ThirdPersonPlayerModel.Valid()) {
Events::AutoAnimationBlend eFireIdle;
eFireIdle.Duration = 0.2;
eFireIdle.RootNode = wi.ThirdPersonPlayerModel;
eFireIdle.NodeName = "Fire";
eFireIdle.Start = false;
m_EventBroker->Publish(eFireIdle);
}
}
}
@@ -114,6 +124,16 @@ void DefenderWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi)
eBlendLoop.AnimationEntity = wi.FirstPersonEntity.FirstChildByName("ReloadStart");
m_EventBroker->Publish(eBlendLoop);
}
if(wi.ThirdPersonPlayerModel.Valid()) {
Events::AutoAnimationBlend eReload;
eReload.Duration = 0.2;
eReload.RootNode = wi.ThirdPersonPlayerModel;
eReload.NodeName = "Reload";
eReload.Restart = true;
eReload.Start = true;
m_EventBroker->Publish(eReload);
}
}
void DefenderWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi)
@@ -136,17 +156,58 @@ bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInf
SpawnerSystem::Spawn(attachment, attachment);
}
EntityWrapper backAttachment = attachment.FirstChildByName("Back");
if (backAttachment.Valid()) {
Events::AutoAnimationBlend eDeployShieldAttachement;
eDeployShieldAttachement.RootNode = backAttachment;
eDeployShieldAttachement.NodeName = "Deploy";
eDeployShieldAttachement.Restart = true;
eDeployShieldAttachement.Start = true;
m_EventBroker->Publish(eDeployShieldAttachement);
}
EntityWrapper frontAttachment = attachment.FirstChildByName("Front");
if (frontAttachment.Valid()) {
Events::AutoAnimationBlend eDeployShieldAttachement;
eDeployShieldAttachement.RootNode = frontAttachment;
eDeployShieldAttachement.NodeName = "Deploy";
eDeployShieldAttachement.Restart = true;
eDeployShieldAttachement.Start = true;
m_EventBroker->Publish(eDeployShieldAttachement);
}
if (IsClient) {
EntityWrapper root = wi.FirstPersonEntity;
if (root.Valid()) {
EntityWrapper animationNode = root.FirstChildByName("Shield");
if (animationNode.Valid()) {
Events::AutoAnimationBlend eFireBlend;
eFireBlend.RootNode = root;
eFireBlend.NodeName = "Shield";
eFireBlend.Restart = true;
eFireBlend.Start = true;
m_EventBroker->Publish(eFireBlend);
Events::AutoAnimationBlend eShieldBlend;
eShieldBlend.RootNode = root;
eShieldBlend.NodeName = "Shield";
eShieldBlend.Restart = true;
eShieldBlend.Start = true;
m_EventBroker->Publish(eShieldBlend);
}
}
} else { // server only
EntityWrapper root = wi.ThirdPersonPlayerModel;
if (root.Valid()) {
Events::AutoAnimationBlend eShieldActivateBlend;
eShieldActivateBlend.RootNode = root;
eShieldActivateBlend.NodeName = "ActivateShield";
eShieldActivateBlend.Restart = true;
eShieldActivateBlend.Start = true;
m_EventBroker->Publish(eShieldActivateBlend);
EntityWrapper animationNode = root.FirstChildByName("ActivateShield");
if (animationNode.Valid()) {
Events::AutoAnimationBlend eShieldIdleBlend;
eShieldIdleBlend.RootNode = root;
eShieldIdleBlend.NodeName = "ShieldFront";
eShieldIdleBlend.Restart = true;
eShieldIdleBlend.Start = true;
eShieldIdleBlend.AnimationEntity = animationNode;
m_EventBroker->Publish(eShieldIdleBlend);
}
}
}
@@ -166,6 +227,26 @@ bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInf
m_EventBroker->Publish(eFireBlend);
}
}
} else { // server only
EntityWrapper root = wi.ThirdPersonPlayerModel;
if (root.Valid()) {
Events::AutoAnimationBlend eShieldDeactivateBlend;
eShieldDeactivateBlend.RootNode = root;
eShieldDeactivateBlend.NodeName = "ActivateShield";
eShieldDeactivateBlend.Restart = true;
eShieldDeactivateBlend.Start = true;
eShieldDeactivateBlend.Reverse = true;
m_EventBroker->Publish(eShieldDeactivateBlend);
EntityWrapper animationNode = root.FirstChildByName("ActivateShield");
if (animationNode.Valid()) {
Events::AutoAnimationBlend eActionBlend;
eActionBlend.RootNode = root;
eActionBlend.NodeName = "ActionBlend";
eActionBlend.AnimationEntity = animationNode;
m_EventBroker->Publish(eActionBlend);
}
}
}
}
}
@@ -174,6 +255,18 @@ bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInf
return false;
}
void DefenderWeaponBehaviour::OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi)
{
if (wi.ThirdPersonPlayerModel.Valid()) {
Events::AutoAnimationBlend b1;
b1.RootNode = wi.ThirdPersonPlayerModel;
b1.NodeName = "DefenderWeapon";
b1.SingleLevelBlend = true;
m_EventBroker->Publish(b1);
}
}
void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi)
{
cWeapon["FireCooldown"] = 60.0 / (double)cWeapon["RPM"];
@@ -237,6 +330,7 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi
// Play animation
playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "Fire");
playAnimationAndReturn(wi.ThirdPersonPlayerModel, "FinalBlend", "Fire");
// Sound
Events::PlaySoundOnEntity e;
@@ -35,6 +35,14 @@ void SidearmWeaponBehaviour::OnCeasePrimaryFire(ComponentWrapper cWeapon, Weapon
void SidearmWeaponBehaviour::OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi)
{
cWeapon["FireCooldown"] = (double)cWeapon["EquipTime"];
if(wi.ThirdPersonPlayerModel.Valid()) {
Events::AutoAnimationBlend b1;
b1.RootNode = wi.ThirdPersonPlayerModel;
b1.NodeName = "SidearmWeapon";
b1.SingleLevelBlend = true;
m_EventBroker->Publish(b1);
}
}
void SidearmWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi)
@@ -64,7 +72,23 @@ 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);
if (ray.Valid()) {
((glm::vec3&)ray["Transform"]["Scale"]).z = (distance / 100.f);
}
}
// Play animation
playAnimationAndReturn(wi.FirstPersonEntity, "ActionBlend", "Fire");
// Third person anim
if (wi.ThirdPersonPlayerModel.Valid()) {
Events::AutoAnimationBlend b1;
b1.RootNode = wi.ThirdPersonPlayerModel;
b1.NodeName = "Fire";
b1.Restart = true;
b1.Start = true;
m_EventBroker->Publish(b1);
}
}