Ejemplo n.º 1
0
        public override void Update()
        {
            base.Update();
            if (!hand)
            {
                return;
            }
            whooshEffect.SetSpeed(Mathf.InverseLerp(3, 12, dagger.rb.velocity.magnitude));
            Vector3    position;
            Quaternion rotation;

            if (hand.playerHand.controlHand.usePressed)
            {
                var fistIndex = (hand.side == Side.Right) ? index : (2 - index);
                position = hand.Palm() + hand.ThumbDir() * 0.15f + hand.ThumbDir() * (0.4f * (fistIndex + 0.3f * hand.Velocity().magnitude));
                rotation = Quaternion.LookRotation(hand.ThumbDir(), -hand.PalmDir());
            }
            else
            {
                var     angleTarget = Mathf.Clamp(60 - hand.Velocity().magnitude * 15, 15, 60);
                var     angle       = index * angleTarget - angleTarget;
                Vector3 offset      = Quaternion.AngleAxis(angle, -Vector3.right)
                                      * (Vector3.forward * (0.2f + 0.3f * hand.Velocity().magnitude / 2))
                                      + (-Vector3.right - Vector3.forward) * 0.3f * hand.Velocity().magnitude / 2;
                position = hand.transform.TransformPoint(offset);
                rotation = Quaternion.LookRotation(hand.PointDir(), -hand.PalmDir());
            }
            dagger.UpdateJoint(position, rotation, 10);
            dagger.item.Throw(1, Item.FlyDetection.Forced);
            dagger.item.IgnoreRagdollCollision(Player.currentCreature.ragdoll);
        }
Ejemplo n.º 2
0
 public override void Update()
 {
     base.Update();
     if (hand == null)
     {
         return;
     }
     if (dagger.item.mainHandler != null)
     {
         dagger.IntoState <DefaultState>();
     }
     dagger.item.transform.position = Vector3.Lerp(dagger.item.transform.position, hand.PosAboveBackOfHand(), Time.deltaTime * 10);
     dagger.item.PointItemFlyRefAtTarget(hand.PointDir(), Time.deltaTime * 10, -hand.PalmDir());
 }