Skip to content

Instantly share code, notes, and snippets.

@MonteverdiPL
Created May 14, 2018 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MonteverdiPL/992eb62fcfee5e249731c20dee13c48f to your computer and use it in GitHub Desktop.
Save MonteverdiPL/992eb62fcfee5e249731c20dee13c48f to your computer and use it in GitHub Desktop.
// 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