RTS/Third person shooter influenced by the game 'Hidden & Dangerous'


// Fill out your copyright notice in the Description page of Project Settings.

#include "HDRemake_V4.h"
#include "ExtendedCharacterMovement.h"




float UExtendedCharacterMovement::GetMaxSpeed() const
{
    switch (MovementMode)
    {
    case MOVE_Walking:
    case MOVE_NavWalking:
        if (IsTransitioning)
        {
            //If the character is in a transition, we don't want them to move. Return a 0.0 speed.
            return 0.0f;
        }
        else if (IsProne)
        {
            return MaxProneSpeed;
        }
        else if (IsCrouching())
        {
            return MaxWalkSpeedCrouched;
        }
        else
        {
            return MaxWalkSpeed;
        }
    case MOVE_Falling:
        return MaxWalkSpeed;
    case MOVE_Swimming:
        return MaxSwimSpeed;
    case MOVE_Flying:
        return MaxFlySpeed;
    case MOVE_Custom:
        return MaxCustomMovementSpeed;
    case MOVE_None:
    default:
        return 0.f;
    }
}




void UExtendedCharacterMovement::Prone()
{
    //TODO: Create a new function that can correctly set the capsule size for both crouch and prone


    //Call the Crouch function to adjust the collision capsule
    Crouch(true);


    IsProne = true;
}


void UExtendedCharacterMovement::UnProne()
{
    //TODO: Create a new function that can correctly set the capsule size for both crouch and prone


    //Call the UnCrouch function to adjust the collision capsule
    UnCrouch(true);


    IsProne = false;
}


void UExtendedCharacterMovement::StartTransition()
{
    IsTransitioning = true;
}


void UExtendedCharacterMovement::EndTransition()
{
    IsTransitioning = false;
}