当前位置: 首页>>代码示例>>C++>>正文


C++ GetCapsuleComponent函数代码示例

本文整理汇总了C++中GetCapsuleComponent函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCapsuleComponent函数的具体用法?C++ GetCapsuleComponent怎么用?C++ GetCapsuleComponent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetCapsuleComponent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetCapsuleComponent

// Called every frame
void ATopDown_HitmanCleanCharacter::Tick( float DeltaTime ){
	Super::Tick( DeltaTime );
	// Handle growing and shrinking based on our "Grow" action
	{
		float CurrentScale = GetCapsuleComponent()->GetComponentScale().X;
		if (bGrowing){
		// Grow to double size over the course of one second
			CurrentScale += DeltaTime;
		} else{
		// Shrink half as fast as we grow
			CurrentScale -= (DeltaTime * 0.5f);
		}
		// Make sure we never drop below our starting size, or increase past double size.
		CurrentScale = FMath::Clamp(CurrentScale, 1.0f, 2.0f);
		GetCapsuleComponent()->SetWorldScale3D(FVector(CurrentScale));
	}

	// Handle movement based on our "MoveX" and "MoveY" axes
	{
		if (!CurrentVelocity.IsZero()){
			FVector NewLocation = GetActorLocation() + (CurrentVelocity * DeltaTime);
			SetActorLocation(NewLocation);
		}
	}
}
开发者ID:esphung,项目名称:hitman-clean_prototype,代码行数:26,代码来源:TopDown_HitmanCleanCharacter.cpp

示例2: GetCapsuleComponent

// Sets default values
APlayerCharacter::APlayerCharacter()
{
	// Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	GetCapsuleComponent()->InitCapsuleSize(42.f, 90.f);

	BaseTurnRate = 60.f;
	BaseLookUpRate = 60.f;

	FirstPersonCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera"));
	FirstPersonCameraComponent->AttachParent = GetCapsuleComponent();
	FirstPersonCameraComponent->RelativeLocation = FVector(0, 0, 64.f);
	FirstPersonCameraComponent->bUsePawnControlRotation = true;

	Mesh1P = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("CharacterMesh1P"));
	Mesh1P->AttachParent = FirstPersonCameraComponent;
	Mesh1P->bCastDynamicShadow = false;
	Mesh1P->CastShadow = false;


	//BOX PICKUP CODE//
	Hand = CreateDefaultSubobject<USceneComponent>(TEXT("Hand"));
	Hand->AttachTo(FirstPersonCameraComponent);
	Hand->RelativeLocation = FVector(100, 0, 0);
	//BOX PICKUP CODE//

	OnActorBeginOverlap.AddDynamic(this, &APlayerCharacter::OnActorOverlap);
	OnActorEndOverlap.AddDynamic(this, &APlayerCharacter::OnActorOverlapEnd);

	PhysicsHandler = CreateDefaultSubobject<UPhysicsHandleComponent>(TEXT("PhysicsHandler"));

}
开发者ID:Snowman5717,项目名称:SymphonyOfShadows,代码行数:34,代码来源:PlayerCharacter.cpp

示例3: GetCapsuleComponent

void ADA2UE4Creature::BeginPlay()
{
	Super::BeginPlay();

	//temp
	CursorToWorld->SetVisibility(false, true);
	CursorToWorld = nullptr;

	if (PawnSensingComp)
	{
		PawnSensingComp->OnSeePawn.AddDynamic(this, &ADA2UE4Creature::OnSeePlayer);
		PawnSensingComp->OnHearNoise.AddDynamic(this, &ADA2UE4Creature::OnHearNoise);
	}

	GetCapsuleComponent()->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block);
	//add over events
	GetCapsuleComponent()->OnClicked.AddDynamic(this, &ADA2UE4Creature::OnClick);
	GetCapsuleComponent()->OnBeginCursorOver.AddDynamic(this, &ADA2UE4Creature::BeginCursorOver);
	GetCapsuleComponent()->OnEndCursorOver.AddDynamic(this, &ADA2UE4Creature::EndCursorOver);

	PrimaryActorTick.AddPrerequisite(MeshHEDComponent, MeshHEDComponent->PrimaryComponentTick);

	//Animation = Cast<UDA2UE4AnimInstance>(MeshHEDComponent->GetAnimInstance());
	//Animation->Montage_Play(Montage);

	SetupCustomMontages();
}
开发者ID:dhk-room101,项目名称:da2ue4,代码行数:27,代码来源:DA2UE4Creature.cpp

示例4: Super

AValorMinionSpawner::AValorMinionSpawner(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
	GetCapsuleComponent()->InitCapsuleSize(40.0f, 92.0f);

#if WITH_EDITORONLY_DATA
	ArrowComponent = CreateEditorOnlyDefaultSubobject<UArrowComponent>(TEXT("Arrow"));

	if (!IsRunningCommandlet())
	{
		// Structure to hold one-time initialization
		struct FConstructorStatics
		{
			ConstructorHelpers::FObjectFinderOptional<UTexture2D> PlayerStartTextureObject;
			FName ID_PlayerStart;
			FText NAME_PlayerStart;
			FName ID_Navigation;
			FText NAME_Navigation;
			FConstructorStatics()
				: PlayerStartTextureObject(TEXT("/Engine/EditorResources/S_Player"))
				, ID_PlayerStart(TEXT("PlayerStart"))
				, NAME_PlayerStart(NSLOCTEXT("SpriteCategory", "PlayerStart", "Player Start"))
				, ID_Navigation(TEXT("Navigation"))
				, NAME_Navigation(NSLOCTEXT("SpriteCategory", "Navigation", "Navigation"))
			{
			}
		};
		static FConstructorStatics ConstructorStatics;

		if (GetGoodSprite())
		{
			GetGoodSprite()->Sprite = ConstructorStatics.PlayerStartTextureObject.Get();
			GetGoodSprite()->RelativeScale3D = FVector(0.5f, 0.5f, 0.5f);
			GetGoodSprite()->SpriteInfo.Category = ConstructorStatics.ID_PlayerStart;
			GetGoodSprite()->SpriteInfo.DisplayName = ConstructorStatics.NAME_PlayerStart;
		}
		if (GetBadSprite())
		{
			GetBadSprite()->SetVisibility(false);
		}

		if (ArrowComponent)
		{
			ArrowComponent->ArrowColor = FColor(150, 200, 255);

			ArrowComponent->ArrowSize = 1.0f;
			ArrowComponent->bTreatAsASprite = true;
			ArrowComponent->SpriteInfo.Category = ConstructorStatics.ID_Navigation;
			ArrowComponent->SpriteInfo.DisplayName = ConstructorStatics.NAME_Navigation;
			ArrowComponent->SetupAttachment(GetCapsuleComponent());
			ArrowComponent->bIsScreenSizeScaled = true;
		}
	}
#endif // WITH_EDITORONLY_DATA

	if (GWorld && GWorld->HasBegunPlay())
	{
		ensure(SpawnTeam != EValorTeam::Invalid);
	}
}
开发者ID:Shirasho,项目名称:ValorGame,代码行数:60,代码来源:ValorMinionSpawner.cpp

示例5: Super

// Sets default values
ASZombieCharacter::ASZombieCharacter(const class FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
	/* Note: We assign the Controller class in the Blueprint extension of this class 
		Because the zombie AIController is a blueprint in content and it's better to avoid content references in code.  */
	/*AIControllerClass = ASZombieAIController::StaticClass();*/

	/* Our sensing component to detect players by visibility and noise checks. */
	PawnSensingComp = CreateDefaultSubobject<UPawnSensingComponent>(TEXT("PawnSensingComp"));
	PawnSensingComp->SetPeripheralVisionAngle(60.0f);
	PawnSensingComp->SightRadius = 2000;
	PawnSensingComp->HearingThreshold = 600;
	PawnSensingComp->LOSHearingThreshold = 1200;

	/* Ignore this channel or it will absorb the trace impacts instead of the skeletal mesh */
	GetCapsuleComponent()->SetCollisionResponseToChannel(COLLISION_WEAPON, ECR_Ignore);
	GetCapsuleComponent()->SetCapsuleHalfHeight(96.0f, false);
	GetCapsuleComponent()->SetCapsuleRadius(42.0f);

	/* These values are matched up to the CapsuleComponent above and are used to find navigation paths */
	GetMovementComponent()->NavAgentProps.AgentRadius = 42;
	GetMovementComponent()->NavAgentProps.AgentHeight = 192;

	Health = 100;
	PunchDamage = 10.0f;

	/* By default we will not let the AI patrol, we can override this value per-instance. */
	BotType = EBotBehaviorType::Passive;
	SenseTimeOut = 2.5f;

	/* Note: Visual Setup is done in the AI/ZombieCharacter Blueprint file */
}
开发者ID:9KGameStudio,项目名称:EpicSurvivalGameSeries,代码行数:33,代码来源:SZombieCharacter.cpp

示例6: GetCapsuleComponent

ALD35Character::ALD35Character()
{
	// Set size for collision capsule
	GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);

	// set our turn rates for input
	BaseTurnRate = 45.f;
	BaseLookUpRate = 45.f;

	// Create a CameraComponent	
	FirstPersonCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera"));
	FirstPersonCameraComponent->AttachParent = GetCapsuleComponent();
	FirstPersonCameraComponent->RelativeLocation = FVector(0, 0, 64.f); // Position the camera
	FirstPersonCameraComponent->bUsePawnControlRotation = true;

	static ConstructorHelpers::FObjectFinder<USoundBase> s1(TEXT("/Game/Sound/SeeWereTiger/SeeSoundCue"));
	SeeWereTigerSound = s1.Object;

	static ConstructorHelpers::FObjectFinder<USoundBase> s2(TEXT("/Game/Sound/SeeEnemy/SeeSoundCue"));
	LetsMoveSound = s2.Object;

	static ConstructorHelpers::FObjectFinder<USoundBase> s3(TEXT("/Game/Sound/Death/DeathSoundCue"));
	DeathSound = s3.Object;

	static ConstructorHelpers::FObjectFinder<USoundBase> s4(TEXT("/Game/Sound/Hit/SoundCue"));
	HitSound = s4.Object;

	static ConstructorHelpers::FObjectFinder<USoundBase> s5(TEXT("/Game/Sound/CrossbowShot/SoundCue"));
	ShootCrossbowSound = s5.Object;

	static ConstructorHelpers::FObjectFinder<USoundBase> s6(TEXT("/Game/Sound/Transform/SoundCue"));
	TransformSound = s6.Object;
}
开发者ID:Quadtree,项目名称:LD35,代码行数:33,代码来源:LD35Character.cpp

示例7: GetMesh

void ACarcinusCharacter::SetHealth(int damage)
{
	Super::SetHealth(damage);

	mEnemyHealth = mEnemyHealth - damage;
	
	if (mEnemyHealth <= 0)
	{
		GetMesh()->SetCollisionProfileName("Ragdoll");
		GetMesh()->SetSimulatePhysics(true);
		
		GetWorld()->GetTimerManager().SetTimer(mDeathTimeHandler, this, &ACarcinusCharacter::DisablePhysics, 10.0f, false);
		
		ACharacter* PlayerRef = UGameplayStatics::GetPlayerCharacter(GetWorld(), 0);

		FString DeathEvent = "Event_CrabDeath";
		AAudioManager::GetInstance()->PlayWwiseEvent(DeathEvent, PlayerRef);
		AAudioManager::GetInstance()->SetFearValue(1.0f);


		ParticleComponent->Activate(true); 

		if (GetCapsuleComponent() != NULL)
		{
			GetCapsuleComponent()->DestroyComponent();
		}

		if (HeadCollider != NULL)
		{
			HeadCollider->DestroyComponent();
		}
	}

	mEnemyHealth = FMath::Clamp(mEnemyHealth, 0, mEnemyMaxHealth);
}
开发者ID:AndreaOsorio,项目名称:PSI,代码行数:35,代码来源:CarcinusCharacter.cpp

示例8: GetCapsuleComponent

AAlphaCog01Character::AAlphaCog01Character()
{
	// Set size for collision capsule
	GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);

	// set our turn rates for input
	BaseTurnRate = 45.f;
	BaseLookUpRate = 45.f;

	// Create a CameraComponent	
	FirstPersonCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera"));
	FirstPersonCameraComponent->AttachParent = GetCapsuleComponent();
	FirstPersonCameraComponent->RelativeLocation = FVector(0, 0, 64.f); // Position the camera
	FirstPersonCameraComponent->bUsePawnControlRotation = true;

	// Default offset from the character location for projectiles to spawn
	GunOffset = FVector(100.0f, 30.0f, 10.0f);

	// Create a mesh component that will be used when being viewed from a '1st person' view (when controlling this pawn)
	Mesh1P = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("CharacterMesh1P"));
	Mesh1P->SetOnlyOwnerSee(true);			// only the owning player will see this mesh
	Mesh1P->AttachParent = FirstPersonCameraComponent;
	Mesh1P->RelativeLocation = FVector(0.f, 0.f, -150.f);
	Mesh1P->bCastDynamicShadow = false;
	Mesh1P->CastShadow = false;

	// Note: The ProjectileClass and the skeletal mesh/anim blueprints for Mesh1P are set in the
	// derived blueprint asset named MyCharacter (to avoid direct content references in C++)
}
开发者ID:mandyRarsh,项目名称:AlphaCog,代码行数:29,代码来源:AlphaCog01Character.cpp

示例9: GetCapsuleComponent

ARTJamCharacter::ARTJamCharacter()
{
	// Set size for collision capsule
	GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);
	GetCapsuleComponent()->OnComponentHit.AddDynamic(this, &ARTJamCharacter::OnHit);

	// Don't rotate when the controller rotates.
	bUseControllerRotationPitch = false;
	bUseControllerRotationYaw = false;
	bUseControllerRotationRoll = false;

	// Configure character movement
	GetCharacterMovement()->bOrientRotationToMovement = true; // Face in the direction we are moving..
	GetCharacterMovement()->RotationRate = FRotator(0.0f, 720.0f, 0.0f); // ...at this rotation rate
	GetCharacterMovement()->GravityScale = 2.f;
	GetCharacterMovement()->AirControl = 0.80f;
	GetCharacterMovement()->JumpZVelocity = 1000.f;
	GetCharacterMovement()->GroundFriction = 3.f;
	GetCharacterMovement()->MaxWalkSpeed = 600.f;
	GetCharacterMovement()->MaxFlySpeed = 600.f;

	// Note: The skeletal mesh and anim blueprint references on the Mesh component (inherited from Character) 
	// are set in the derived blueprint asset named MyCharacter (to avoid direct content references in C++)

	bIsDead = false;

	NormalImpulse = 800.f;
	MaxImpulse = 1000.f;
	ForceLength.Z = NormalImpulse;
}
开发者ID:CHADALAK1,项目名称:RTGameJam2016,代码行数:30,代码来源:RTJamCharacter.cpp

示例10: GetCapsuleComponent

ABETCharacter::ABETCharacter()
{
	// Set size for collision capsule
	GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);

	// set our turn rates for input
	BaseTurnRate = 45.f;
	BaseLookUpRate = 45.f;

	// Create a CameraComponent	
	FirstPersonCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera"));
	FirstPersonCameraComponent->AttachParent = GetCapsuleComponent();
	FirstPersonCameraComponent->RelativeLocation = FVector(0, 0, 64.f); // Position the camera
	FirstPersonCameraComponent->bUsePawnControlRotation = true;

	// Create a mesh component that will be used when being viewed from a '1st person' view (when controlling this pawn)
	Mesh1P = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("CharacterMesh1P"));
	Mesh1P->SetOnlyOwnerSee(true);
	Mesh1P->AttachParent = FirstPersonCameraComponent;
	Mesh1P->bCastDynamicShadow = false;
	Mesh1P->CastShadow = false;

	// Create a gun mesh component
	FP_Gun = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("FP_Gun"));
	FP_Gun->SetOnlyOwnerSee(true);			// only the owning player will see this mesh
	FP_Gun->bCastDynamicShadow = false;
	FP_Gun->CastShadow = false;
	FP_Gun->AttachTo(Mesh1P, TEXT("GripPoint"), EAttachLocation::SnapToTargetIncludingScale, true);


	// Note: The ProjectileClass and the skeletal mesh/anim blueprints for Mesh1P are set in the
	// derived blueprint asset named MyCharacter (to avoid direct content references in C++)
}
开发者ID:brandon2499,项目名称:14BirdsEyeTerrace,代码行数:33,代码来源:BETCharacter.cpp

示例11: GetCapsuleComponent

AFPSHorrorCharacter::AFPSHorrorCharacter()
{
	//test
	Health = MaxHealth;
	DecayingRate = 1.5f;

	// Set size for collision capsule
	GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);

	// set our turn rates for input
	BaseTurnRate = 45.f;
	BaseLookUpRate = 45.f;

	// Create a CameraComponent	
	FirstPersonCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera"));
	FirstPersonCameraComponent->AttachParent = GetCapsuleComponent();
	FirstPersonCameraComponent->RelativeLocation = FVector(0, 0, 64.f); // Position the camera
	FirstPersonCameraComponent->bUsePawnControlRotation = true;


	// Scene Color Settings
	FirstPersonCameraComponent->PostProcessSettings.bOverride_SceneColorTint = true;
	FirstPersonCameraComponent->PostProcessSettings.bOverride_VignetteIntensity = true;
	FirstPersonCameraComponent->PostProcessSettings.bOverride_GrainIntensity = true;
	FirstPersonCameraComponent->PostProcessSettings.bOverride_ColorContrast = true;
	FirstPersonCameraComponent->PostProcessSettings.bOverride_ColorGamma = true;
	FirstPersonCameraComponent->PostProcessSettings.bOverride_ColorGain = true;

	FirstPersonCameraComponent->PostProcessSettings.SceneColorTint = FLinearColor(.5f, .5f, .5f, 1.0f);
	FirstPersonCameraComponent->PostProcessSettings.VignetteIntensity = 0.0f;
	FirstPersonCameraComponent->PostProcessSettings.GrainIntensity = .15f;

	// Create a mesh component that will be used when being viewed from a '1st person' view (when controlling this pawn)
	Mesh1P = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("CharacterMesh1P"));
	Mesh1P->SetOnlyOwnerSee(true);
	Mesh1P->AttachParent = FirstPersonCameraComponent;
	Mesh1P->bCastDynamicShadow = false;
	Mesh1P->CastShadow = false;

	// Create a Sowrd mesh component
	FP_Sword = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("FP_Sword"));
	FP_Sword->SetOnlyOwnerSee(true);			// only the owning player will see this mesh
	FP_Sword->bCastDynamicShadow = false;
	FP_Sword->CastShadow = false;
	FP_Sword->AttachTo(Mesh1P, TEXT("Sword"), EAttachLocation::SnapToTargetIncludingScale, true);

	// Create a Hammer mesh component
	FP_Hammer = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("FP_Hammer"));
	FP_Hammer->SetOnlyOwnerSee(true);			// only the owning player will see this mesh
	FP_Hammer->bCastDynamicShadow = false;
	FP_Hammer->CastShadow = false;
	FP_Hammer->AttachTo(Mesh1P, TEXT("Hammer"), EAttachLocation::SnapToTargetIncludingScale, true);

	// Default offset from the character location for projectiles to spawn
	GunOffset = FVector(100.0f, 30.0f, 10.0f);

	// Note: The ProjectileClass and the skeletal mesh/anim blueprints for Mesh1P are set in the
	// derived blueprint asset named MyCharacter (to avoid direct content references in C++)
}
开发者ID:Rish79,项目名称:FPS-Horror,代码行数:59,代码来源:FPSHorrorCharacter.cpp

示例12: Super

// Sets default values
AMainCharacter::AMainCharacter(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
 	// Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	bCanBeDamaged = true;
	bFireIsReady = true;
	CurrentWeapon = NULL;
	Inventory.SetNum(3, false);
	Inventory[0] = NULL;
	Inventory[1] = NULL;
	Inventory[2] = NULL;
	WeaponAmmoStorage.SetNum(3, false);
	WeaponAmmoStorage[0].CurrentSpareAmmo = -1;
	WeaponAmmoStorage[1].CurrentSpareAmmo = -1;
	WeaponAmmoStorage[2].CurrentSpareAmmo = -1;
	WeaponAmmoStorage[0].CurrentMagazineAmmo = -1;
	WeaponAmmoStorage[1].CurrentMagazineAmmo = -1;
	WeaponAmmoStorage[2].CurrentMagazineAmmo = -1;
	//WeaponSpawn = NULL;

	GetCharacterMovement()->GetNavAgentPropertiesRef().bCanCrouch = true;
	GetCharacterMovement()->bCanWalkOffLedgesWhenCrouching = true;
	GetCharacterMovement()->MaxAcceleration = 1400.0f;
	GetCharacterMovement()->BrakingDecelerationWalking = 0.0f;

	RootComponent = GetCapsuleComponent();
	FirstPersonCameraComponent = ObjectInitializer.CreateDefaultSubobject<UCameraComponent>(this, TEXT("FirstPersonCamera"));
	FirstPersonCameraComponent->AttachParent = GetCapsuleComponent();
	FirstPersonCameraComponent->RelativeLocation = FVector(0, 0, BaseEyeHeight);
	FirstPersonCameraComponent->bUsePawnControlRotation = true;

	GetMesh()->SetOwnerNoSee(true);
	FirstPersonMesh = ObjectInitializer.CreateDefaultSubobject<USkeletalMeshComponent>(this, TEXT("FirstPersonMesh"));
	FirstPersonMesh->SetOnlyOwnerSee(true);         // only the owning player will see this mesh
	FirstPersonMesh->AttachParent = FirstPersonCameraComponent;
	FirstPersonMesh->bCastDynamicShadow = false;
	FirstPersonMesh->CastShadow = false;

	Flashlight = ObjectInitializer.CreateDefaultSubobject<USpotLightComponent>(this, TEXT("Flashlight"));
	Flashlight->AttachParent = FirstPersonCameraComponent;

	GetCapsuleComponent()->OnComponentBeginOverlap.AddDynamic(this, &AMainCharacter::OnCollision);

	/*
	static ConstructorHelpers::FObjectFinder<UBlueprint> WeaponBlueprint(TEXT("Blueprint'/Game/FPS/Blueprints/Weapons/BP_Weapon_M4A1.BP_Weapon_M4A1'"));

	if (WeaponBlueprint.Succeeded())
	{
		WeaponSpawn = (UClass*)WeaponBlueprint.Object->GeneratedClass;
	}
	*/
}
开发者ID:rcktscnc,项目名称:unreal-project,代码行数:54,代码来源:MainCharacter.cpp

示例13: FConstructorStatics

// Sets default values
ASoldierPawn::ASoldierPawn()
{
	struct FConstructorStatics
	{
		ConstructorHelpers::FObjectFinderOptional<UPaperFlipbook> RunAnimationAsset;
		ConstructorHelpers::FObjectFinderOptional<UPaperFlipbook> IdleAnimationAsset;

		FConstructorStatics()
			: RunAnimationAsset(TEXT("/Game/2dSideScroller/Animation/Soldier/Run.Run")),
			IdleAnimationAsset(TEXT("/Game/2dSideScroller/Animation/Soldier/Idle.Idle"))
		{
		}
	};
	static FConstructorStatics ConstructorStatics;

	RunAnimation = ConstructorStatics.RunAnimationAsset.Get();
	IdleAnimation = ConstructorStatics.IdleAnimationAsset.Get();

	GetSprite()->SetFlipbook(IdleAnimation);
	GetSprite()->SetRelativeScale3D(FVector(4.5, 1, 4.5));


	// Use only Yaw from the controller and ignore the rest of the rotation.
	bUseControllerRotationPitch = false;
	bUseControllerRotationYaw = true;
	bUseControllerRotationRoll = false;

	// Set the size of our collision capsule.
	GetCapsuleComponent()->SetCapsuleHalfHeight(90);
	GetCapsuleComponent()->SetCapsuleRadius(43);
	GetCapsuleComponent()->SetRelativeLocation(FVector(-25, 0, 0));

	// Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	// PrimaryActorTick.bCanEverTick = true;

	RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("Root Component"));

	// Configure character movement
	GetCharacterMovement()->GravityScale = 2.0f;
	GetCharacterMovement()->AirControl = 0.80f;
	GetCharacterMovement()->JumpZVelocity = 1000.f;
	GetCharacterMovement()->GroundFriction = 3.0f;
	GetCharacterMovement()->MaxWalkSpeed = 600.0f;
	GetCharacterMovement()->MaxFlySpeed = 600.0f;

	// Lock character motion onto the XZ plane, so the character can't move in or out of the screen
	GetCharacterMovement()->bConstrainToPlane = true;
	GetCharacterMovement()->SetPlaneConstraintNormal(FVector(0, -1, 0));

	GetCharacterMovement()->bUseFlatBaseForFloorChecks = true;
}
开发者ID:NightWolf007,项目名称:ContraProject,代码行数:52,代码来源:SoldierPawn.cpp

示例14: Super

ARealmEnablerShield::ARealmEnablerShield(const FObjectInitializer& objectInitializer)
: Super(objectInitializer)
{
	GetCapsuleComponent()->SetCollisionResponseToAllChannels(ECR_Ignore);
	GetCapsuleComponent()->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Block);

	shieldCollision = CreateDefaultSubobject<USphereComponent>(TEXT("shieldCollision"));
	shieldCollision->InitSphereRadius(1150.f);
	shieldCollision->AttachParent = RootComponent;
	shieldCollision->SetCollisionResponseToAllChannels(ECR_Ignore);
	shieldCollision->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
	shieldCollision->OnComponentBeginOverlap.AddDynamic(this, &ARealmEnablerShield::OnShieldBeginOverlap);
	shieldCollision->OnComponentEndOverlap.AddDynamic(this, &ARealmEnablerShield::OnShieldEndOverlap);
}
开发者ID:MatrIsCool,项目名称:Mythos-Realm,代码行数:14,代码来源:RealmEnablerShield.cpp

示例15: GetCapsuleComponent

AInventoryPrototypeCharacter::AInventoryPrototypeCharacter()
{
    //PrimaryActorTick.bCanEverTick = true;
	// Set size for collision capsule
	GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);

	// set our turn rates for input
	BaseTurnRate = 45.f;
	BaseLookUpRate = 45.f;

	// Create a CameraComponent	
	FirstPersonCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera"));
	FirstPersonCameraComponent->AttachParent = GetCapsuleComponent();
	FirstPersonCameraComponent->RelativeLocation = FVector(0, 0, 64.f); // Position the camera
	FirstPersonCameraComponent->bUsePawnControlRotation = true;

	// Create a mesh component that will be used when being viewed from a '1st person' view (when controlling this pawn)
	Mesh1P = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("CharacterMesh1P"));
	Mesh1P->SetOnlyOwnerSee(true);
	Mesh1P->AttachParent = FirstPersonCameraComponent;
	Mesh1P->bCastDynamicShadow = false;
	Mesh1P->CastShadow = false;

	// Create a gun mesh component
	FP_Gun = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("FP_Gun"));
	FP_Gun->SetOnlyOwnerSee(true);			// only the owning player will see this mesh
	FP_Gun->bCastDynamicShadow = false;
	FP_Gun->CastShadow = false;
	FP_Gun->AttachTo(Mesh1P, TEXT("GripPoint"), EAttachLocation::SnapToTargetIncludingScale, true);


	// Default offset from the character location for projectiles to spawn
	GunOffset = FVector(100.0f, 30.0f, 10.0f);

	// Note: The ProjectileClass and the skeletal mesh/anim blueprints for Mesh1P are set in the
	// derived blueprint asset named MyCharacter (to avoid direct content references in C++)


    //stamina and movement
    this->stamina = 500;
    this->maxStamina = 1000;
    this->staminaRate = 1;
    this->isRunning = true;

    //inventory and items
    this->inventory = new Inventory(150);
    this->testItem = new Item(0, "ITEM", 5);
    this->testItem1 = new Item(1, "myItem", 10);
}
开发者ID:drakemain,项目名称:UE4_Prototypes,代码行数:49,代码来源:InventoryPrototypeCharacter.cpp


注:本文中的GetCapsuleComponent函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。