public void AnimateTo(Skill.ActiveAnimationTypes animType) { if (WeaponAnim == null || Animating || animType == Skill.ActiveAnimationTypes.None) { return; } WeaponAnim.Stop(); Animating = true; switch (animType) { case Skill.ActiveAnimationTypes.Meele: Anims.SetSequence("HandAttack"); break; case Skill.ActiveAnimationTypes.Casting: Anims.SetSequence("Cast"); break; case Skill.ActiveAnimationTypes.Ranged: Anims.SetSequence("RangedAttack"); break; } if (animType != Skill.ActiveAnimationTypes.Casting) { WeaponAnim.Play(); } }
/// <summary> /// in addition to spawning the projectile in the base class, /// plays a fire animation on the weapon and applies recoil /// to the weapon spring. also regulates tap fire /// </summary> protected override void Fire() { m_LastFireTime = Time.time; // play fire animation if (AnimationFire != null) { if (WeaponAnimation[AnimationFire.name] == null) { Debug.LogError("Error (" + this + ") No animation named '" + AnimationFire.name + "' is listed in this prefab. Make sure the prefab has an 'Animation' component which references all the clips you wish to play on the weapon."); } else { WeaponAnimation[AnimationFire.name].time = 0.0f; WeaponAnimation.Sample(); WeaponAnimation.Play(AnimationFire.name); } } // apply recoil if (MotionRecoilDelay == 0.0f) { ApplyRecoil(); } else { vp_Timer.In(MotionRecoilDelay, ApplyRecoil); } base.Fire(); }