Created
May 14, 2018 22:20
-
-
Save MonteverdiPL/992eb62fcfee5e249731c20dee13c48f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fill out your copyright notice in the Description page of Project Settings. | |
#include "PierwszeDrzwi.h" | |
#include "GameFramework/Actor.h" | |
#include "Engine/TriggerVolume.h" | |
// Sets default values for this component's properties | |
UPierwszeDrzwi::UPierwszeDrzwi() | |
{ | |
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features | |
// off to improve performance if you don't need them. | |
PrimaryComponentTick.bCanEverTick = true; | |
// ... | |
} | |
// Called when the game starts | |
void UPierwszeDrzwi::BeginPlay() | |
{ | |
Super::BeginPlay(); | |
OtwarcieDrzwi(); | |
} | |
void UPierwszeDrzwi::OtwarcieDrzwi() //open door | |
{ | |
AActor* Drzwi = GetOwner(); | |
FRotator NowaRotacja = FRotator(0.0f, -90.0f, 0.0f); | |
Drzwi->SetActorRotation(NowaRotacja); | |
} | |
void UPierwszeDrzwi::ZamkniecieDrzwi() //close door | |
{ | |
AActor* Drzwi = GetOwner(); | |
FRotator NowaRotacja = FRotator(0.0f, KatZamkniecia, 0.0f); | |
Drzwi->SetActorRotation(NowaRotacja); | |
} | |
// Called every frame | |
void UPierwszeDrzwi::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) | |
{ | |
Super::TickComponent(DeltaTime, TickType, ThisTickFunction); | |
if (TriggerWHolu->OnActorEndOverlap(AktorOtwierajacy)) | |
{ | |
ZamkniecieDrzwi(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment