2019-06-30 02:13:34 +00:00
|
|
|
use super::{
|
|
|
|
super::{Animation, SkeletonAttr},
|
|
|
|
CharacterSkeleton,
|
|
|
|
};
|
2019-07-29 13:44:16 +00:00
|
|
|
use common::comp::item::Tool;
|
2019-06-30 02:13:34 +00:00
|
|
|
use vek::*;
|
|
|
|
|
2019-08-29 02:17:08 +00:00
|
|
|
pub struct WieldAnimation;
|
2019-06-30 02:13:34 +00:00
|
|
|
|
2019-08-29 02:17:08 +00:00
|
|
|
impl Animation for WieldAnimation {
|
2019-06-30 02:13:34 +00:00
|
|
|
type Skeleton = CharacterSkeleton;
|
2019-08-29 02:17:08 +00:00
|
|
|
type Dependency = (f32, f64);
|
2019-06-30 02:13:34 +00:00
|
|
|
|
|
|
|
fn update_skeleton(
|
|
|
|
skeleton: &Self::Skeleton,
|
2019-08-29 02:17:08 +00:00
|
|
|
(_velocity, _global_time): Self::Dependency,
|
2019-06-30 02:13:34 +00:00
|
|
|
anim_time: f64,
|
2019-09-09 19:11:40 +00:00
|
|
|
_rate: &mut f32,
|
2019-06-30 02:13:34 +00:00
|
|
|
skeleton_attr: &SkeletonAttr,
|
|
|
|
) -> Self::Skeleton {
|
|
|
|
let mut next = (*skeleton).clone();
|
2019-07-04 14:58:59 +00:00
|
|
|
|
2019-08-29 02:17:08 +00:00
|
|
|
let wave = (anim_time as f32 * 12.0).sin();
|
2019-06-30 02:13:34 +00:00
|
|
|
|
2019-09-30 18:16:27 +00:00
|
|
|
match Tool::Bow {
|
2019-07-07 23:24:20 +00:00
|
|
|
//TODO: Inventory
|
2019-07-29 13:44:16 +00:00
|
|
|
Tool::Sword => {
|
2019-08-29 02:17:08 +00:00
|
|
|
next.l_hand.offset = Vec3::new(-6.0, 3.75, 0.25);
|
2019-07-07 23:24:20 +00:00
|
|
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
|
|
|
next.l_hand.scale = Vec3::one() * 1.01;
|
2019-08-29 02:17:08 +00:00
|
|
|
next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0);
|
2019-07-07 23:24:20 +00:00
|
|
|
next.r_hand.ori = Quaternion::rotation_x(-0.3);
|
|
|
|
next.r_hand.scale = Vec3::one() * 1.01;
|
|
|
|
next.weapon.offset = Vec3::new(
|
2019-08-29 02:17:08 +00:00
|
|
|
-6.0 + skeleton_attr.weapon_x,
|
2019-07-07 23:24:20 +00:00
|
|
|
4.0 + skeleton_attr.weapon_y,
|
2019-08-29 02:17:08 +00:00
|
|
|
0.0,
|
2019-07-07 23:24:20 +00:00
|
|
|
);
|
|
|
|
next.weapon.ori = Quaternion::rotation_x(-0.3)
|
|
|
|
* Quaternion::rotation_y(0.0)
|
|
|
|
* Quaternion::rotation_z(0.0);
|
|
|
|
next.weapon.scale = Vec3::one();
|
|
|
|
}
|
2019-07-29 13:44:16 +00:00
|
|
|
Tool::Axe => {
|
2019-07-07 23:24:20 +00:00
|
|
|
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
|
|
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
|
|
|
next.l_hand.scale = Vec3::one() * 1.01;
|
|
|
|
next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0);
|
|
|
|
next.r_hand.ori = Quaternion::rotation_x(-0.3);
|
|
|
|
next.r_hand.scale = Vec3::one() * 1.01;
|
|
|
|
next.weapon.offset = Vec3::new(
|
|
|
|
-6.0 + skeleton_attr.weapon_x,
|
|
|
|
4.5 + skeleton_attr.weapon_y,
|
|
|
|
0.0,
|
|
|
|
);
|
|
|
|
next.weapon.ori = Quaternion::rotation_x(-0.3)
|
|
|
|
* Quaternion::rotation_y(0.0)
|
|
|
|
* Quaternion::rotation_z(0.0);
|
|
|
|
next.weapon.scale = Vec3::one();
|
|
|
|
}
|
2019-07-29 13:44:16 +00:00
|
|
|
Tool::Hammer => {
|
2019-10-02 10:05:17 +00:00
|
|
|
next.l_hand.offset = Vec3::new(-7.0, 4.0, 3.0);
|
|
|
|
next.l_hand.ori = Quaternion::rotation_x(1.27 + wave * 0.25)
|
|
|
|
* Quaternion::rotation_y(0.0)
|
|
|
|
* Quaternion::rotation_z(0.0);
|
2019-07-07 23:24:20 +00:00
|
|
|
next.l_hand.scale = Vec3::one() * 1.01;
|
2019-10-02 10:05:17 +00:00
|
|
|
next.r_hand.offset = Vec3::new(7.0, 2.5, -1.25);
|
|
|
|
next.r_hand.ori = Quaternion::rotation_x(1.27 + wave * 0.25)
|
|
|
|
* Quaternion::rotation_y(0.0)
|
|
|
|
* Quaternion::rotation_z(-0.3);
|
2019-07-07 23:24:20 +00:00
|
|
|
next.r_hand.scale = Vec3::one() * 1.01;
|
|
|
|
next.weapon.offset = Vec3::new(
|
|
|
|
5.0 + skeleton_attr.weapon_x,
|
|
|
|
8.75 + skeleton_attr.weapon_y,
|
2019-08-29 02:17:08 +00:00
|
|
|
-2.0,
|
2019-07-07 23:24:20 +00:00
|
|
|
);
|
|
|
|
next.weapon.ori = Quaternion::rotation_x(-0.3)
|
2019-10-02 10:05:17 +00:00
|
|
|
* Quaternion::rotation_y(-1.27)
|
2019-08-29 02:17:08 +00:00
|
|
|
* Quaternion::rotation_z(wave * -0.25);
|
2019-07-07 23:24:20 +00:00
|
|
|
next.weapon.scale = Vec3::one();
|
|
|
|
}
|
2019-07-29 13:44:16 +00:00
|
|
|
Tool::Staff => {
|
2019-08-29 02:17:08 +00:00
|
|
|
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
|
|
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
2019-07-07 23:24:20 +00:00
|
|
|
next.l_hand.scale = Vec3::one() * 1.01;
|
2019-08-29 02:17:08 +00:00
|
|
|
next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0);
|
|
|
|
next.r_hand.ori = Quaternion::rotation_x(-0.3);
|
2019-07-07 23:24:20 +00:00
|
|
|
next.r_hand.scale = Vec3::one() * 1.01;
|
|
|
|
next.weapon.offset = Vec3::new(
|
2019-08-29 02:17:08 +00:00
|
|
|
-6.0 + skeleton_attr.weapon_x,
|
|
|
|
4.5 + skeleton_attr.weapon_y,
|
|
|
|
0.0,
|
2019-07-07 23:24:20 +00:00
|
|
|
);
|
|
|
|
next.weapon.ori = Quaternion::rotation_x(-0.3)
|
2019-08-29 02:17:08 +00:00
|
|
|
* Quaternion::rotation_y(0.0)
|
|
|
|
* Quaternion::rotation_z(0.0);
|
2019-07-07 23:24:20 +00:00
|
|
|
next.weapon.scale = Vec3::one();
|
|
|
|
}
|
2019-10-09 19:28:05 +00:00
|
|
|
Tool::Shield => {
|
2019-07-07 23:24:20 +00:00
|
|
|
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
|
|
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
|
|
|
next.l_hand.scale = Vec3::one() * 1.01;
|
|
|
|
next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0);
|
|
|
|
next.r_hand.ori = Quaternion::rotation_x(-0.3);
|
|
|
|
next.r_hand.scale = Vec3::one() * 1.01;
|
|
|
|
next.weapon.offset = Vec3::new(
|
|
|
|
-6.0 + skeleton_attr.weapon_x,
|
|
|
|
4.5 + skeleton_attr.weapon_y,
|
|
|
|
0.0,
|
|
|
|
);
|
|
|
|
next.weapon.ori = Quaternion::rotation_x(-0.3)
|
|
|
|
* Quaternion::rotation_y(0.0)
|
|
|
|
* Quaternion::rotation_z(0.0);
|
|
|
|
next.weapon.scale = Vec3::one();
|
|
|
|
}
|
2019-07-29 13:44:16 +00:00
|
|
|
Tool::Bow => {
|
2019-09-30 18:16:27 +00:00
|
|
|
next.l_hand.offset = Vec3::new(-4.0, 5.0, 0.0);
|
|
|
|
next.l_hand.ori = Quaternion::rotation_x(0.0)
|
|
|
|
* Quaternion::rotation_y(-1.9)
|
|
|
|
* Quaternion::rotation_z(0.85);
|
2019-07-07 23:24:20 +00:00
|
|
|
next.l_hand.scale = Vec3::one() * 1.01;
|
2019-09-30 18:16:27 +00:00
|
|
|
next.r_hand.offset = Vec3::new(2.0, 8.0, -3.5);
|
|
|
|
next.r_hand.ori = Quaternion::rotation_x(0.0)
|
|
|
|
* Quaternion::rotation_y(-1.7)
|
|
|
|
* Quaternion::rotation_z(0.85);
|
2019-07-07 23:24:20 +00:00
|
|
|
next.r_hand.scale = Vec3::one() * 1.01;
|
|
|
|
next.weapon.offset = Vec3::new(
|
2019-09-30 18:16:27 +00:00
|
|
|
9.0 + skeleton_attr.weapon_x,
|
|
|
|
10.0 + skeleton_attr.weapon_y,
|
|
|
|
-3.0,
|
2019-07-07 23:24:20 +00:00
|
|
|
);
|
2019-09-30 18:16:27 +00:00
|
|
|
next.weapon.ori = Quaternion::rotation_x(0.0)
|
|
|
|
* Quaternion::rotation_y(-1.7)
|
|
|
|
* Quaternion::rotation_z(0.85);
|
2019-07-07 23:24:20 +00:00
|
|
|
next.weapon.scale = Vec3::one();
|
|
|
|
}
|
2019-10-09 19:28:05 +00:00
|
|
|
Tool::Dagger => {
|
2019-07-07 23:24:20 +00:00
|
|
|
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
|
|
|
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
|
|
|
next.l_hand.scale = Vec3::one() * 1.01;
|
|
|
|
next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0);
|
|
|
|
next.r_hand.ori = Quaternion::rotation_x(-0.3);
|
|
|
|
next.r_hand.scale = Vec3::one() * 1.01;
|
|
|
|
next.weapon.offset = Vec3::new(
|
|
|
|
-6.0 + skeleton_attr.weapon_x,
|
|
|
|
4.5 + skeleton_attr.weapon_y,
|
|
|
|
0.0,
|
|
|
|
);
|
|
|
|
next.weapon.ori = Quaternion::rotation_x(-0.3)
|
|
|
|
* Quaternion::rotation_y(0.0)
|
|
|
|
* Quaternion::rotation_z(0.0);
|
|
|
|
next.weapon.scale = Vec3::one();
|
|
|
|
}
|
2019-10-22 20:58:27 +00:00
|
|
|
Tool::Debug(_) => {
|
|
|
|
next.l_hand.offset = Vec3::new(-7.0, 4.0, 3.0);
|
|
|
|
next.l_hand.ori = Quaternion::rotation_x(1.27 + wave * 0.25)
|
|
|
|
* Quaternion::rotation_y(0.0)
|
|
|
|
* Quaternion::rotation_z(0.0);
|
|
|
|
next.l_hand.scale = Vec3::one() * 1.01;
|
|
|
|
next.r_hand.offset = Vec3::new(7.0, 2.5, -1.25);
|
|
|
|
next.r_hand.ori = Quaternion::rotation_x(1.27 + wave * 0.25)
|
|
|
|
* Quaternion::rotation_y(0.0)
|
|
|
|
* Quaternion::rotation_z(-0.3);
|
|
|
|
next.r_hand.scale = Vec3::one() * 1.01;
|
|
|
|
next.weapon.offset = Vec3::new(
|
|
|
|
5.0 + skeleton_attr.weapon_x,
|
|
|
|
8.75 + skeleton_attr.weapon_y,
|
|
|
|
-2.0,
|
|
|
|
);
|
|
|
|
next.weapon.ori = Quaternion::rotation_x(-0.3)
|
|
|
|
* Quaternion::rotation_y(-1.27)
|
|
|
|
* Quaternion::rotation_z(wave * -0.25);
|
|
|
|
next.weapon.scale = Vec3::one();
|
|
|
|
}
|
2019-07-07 22:06:29 +00:00
|
|
|
}
|
2019-07-07 22:04:27 +00:00
|
|
|
|
2019-06-30 02:13:34 +00:00
|
|
|
next
|
|
|
|
}
|
|
|
|
}
|