예제 #1
0
 public void SetSwimming(bool value, float ySpeed = 0.0f)
 {
     swimming = value;
     if (swimming == true)
     {
         timer = 1000;
         weaponManager.SelectWeapon(0);
         enteredWater    = false;
         water_height    = this.transform.position.y;
         swimSlowGravity = ySpeed / 18;
         PlayRandomSound(enterWaterSounds);
     }
     else
     {
         queued       = false;
         underwater   = false;
         enteredWater = false;
         PlayRandomSound(exitWaterSounds);
     }
     SetAnimState("swimming", swimming);
     moveController.enabled = !swimming;
     weaponManager.CanEquipWeapons(!swimming);
     headBobScript.enabled = !swimming;
     this.enabled          = swimming;
 }
예제 #2
0
 public void InWaterState(bool state)
 {
     if (state == true)
     {
         grounded = false;
         wm.DisableAllWeapons();
         PlaySound(swimming.soundSource, swimming.enter);
     }
     else
     {
         PlaySound(swimming.soundSource, swimming.exit);
     }
     if (GetComponentInChildren <HeadBobber>())
     {
         GetComponentInChildren <HeadBobber>().enabled = !state;
     }
     SetLockJump(state);
     wm.CanEquipWeapons(!state);
     wm.EnableHands();
     SetAnimValue(anims.swimming_bool, state);
     isSwimming = state;
     falling    = false;
 }