First attempt at AssaultWeapon animations!
This commit is contained in:
@@ -99,6 +99,29 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi)
|
||||
// Start reload
|
||||
reloadQueued = true;
|
||||
reloadTimer = reloadTime;
|
||||
|
||||
// Play animation
|
||||
EntityWrapper modelEntity = wi.FirstPersonEntity.Parent().Parent();
|
||||
if (modelEntity.Valid()) {
|
||||
EntityWrapper blendTree = modelEntity.FirstChildByName("PrimaryBlendTree");
|
||||
EntityWrapper reloadBlend = blendTree.FirstChildByName("Reload");
|
||||
|
||||
Events::AutoAnimationBlend eFireBlend;
|
||||
eFireBlend.RootNode = modelEntity;
|
||||
eFireBlend.NodeName = "Reload";
|
||||
eFireBlend.Restart = true;
|
||||
eFireBlend.Start = true;
|
||||
eFireBlend.Duration = 0.0001;
|
||||
m_EventBroker->Publish(eFireBlend);
|
||||
|
||||
Events::AutoAnimationBlend eIdleBlend;
|
||||
eIdleBlend.RootNode = modelEntity;
|
||||
eIdleBlend.NodeName = "Idle";
|
||||
eIdleBlend.AnimationEntity = reloadBlend;
|
||||
eIdleBlend.Delay = -0.2;
|
||||
eIdleBlend.Duration = 0.2;
|
||||
m_EventBroker->Publish(eIdleBlend);
|
||||
}
|
||||
}
|
||||
|
||||
void AssaultWeaponBehaviour::OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi)
|
||||
@@ -177,6 +200,29 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi
|
||||
m_EventBroker->Publish(e);
|
||||
}
|
||||
}
|
||||
|
||||
// Play animation
|
||||
EntityWrapper modelEntity = wi.FirstPersonEntity.Parent().Parent();
|
||||
if (modelEntity.Valid()) {
|
||||
EntityWrapper blendTree = modelEntity.FirstChildByName("PrimaryBlendTree");
|
||||
EntityWrapper fireBlend = blendTree.FirstChildByName("Fire");
|
||||
|
||||
Events::AutoAnimationBlend eFireBlend;
|
||||
eFireBlend.RootNode = modelEntity;
|
||||
eFireBlend.NodeName = "Fire";
|
||||
eFireBlend.Restart = true;
|
||||
eFireBlend.Start = true;
|
||||
eFireBlend.Duration = 0.0001;
|
||||
m_EventBroker->Publish(eFireBlend);
|
||||
|
||||
Events::AutoAnimationBlend eIdleBlend;
|
||||
eIdleBlend.RootNode = modelEntity;
|
||||
eIdleBlend.NodeName = "Idle";
|
||||
eIdleBlend.AnimationEntity = fireBlend;
|
||||
eIdleBlend.Delay = -0.2;
|
||||
eIdleBlend.Duration = 0.2;
|
||||
m_EventBroker->Publish(eIdleBlend);
|
||||
}
|
||||
}
|
||||
|
||||
bool AssaultWeaponBehaviour::canFire(ComponentWrapper cWeapon, WeaponInfo& wi)
|
||||
|
||||
Reference in New Issue
Block a user