Esempio n. 1
0
 private void SwimmingBehaviour()
 {
     // trigger swim behaviour only if the water level matches the player height + offset
     if (tpInput.cc._capsuleCollider.bounds.center.y + heightOffset < waterHeightLevel)
     {
         if (tpInput.cc.currentHealth > 0)
         {
             if (!triggerSwimState)
             {
                 EnterSwimState();                                   // call once the swim behaviour
             }
             SwimUpOrDownInput();                                    // input to swin up or down
             tpInput.SetStrafeLocomotion(false);                     // limit the player to not go on strafe mode
             tpInput.MoveInput();                                    // update the input
             tpInput.cc.SetAnimatorMoveSpeed(tpInput.cc.freeSpeed);  // update the animator input magnitude
         }
         else
         {
             ExitSwimState();                                        // use the trigger around the edges to exit by playing an animation
         }
     }
     else
     {
         ExitSwimState();
     }
 }
Esempio n. 2
0
    public virtual void HandleBuild()
    {
        if (!inBuildMode || !currentBuild)
        {
            return;
        }
        if (!string.IsNullOrEmpty(currentBuild.customCameraState))
        {
            tpInput.ChangeCameraState(currentBuild.customCameraState, true);
        }

        tpInput.MoveInput();

        currentBuild.HandleBuild(this);
        HandleBuildRotation();
    }