Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Fill out your copyright notice in the Description page of Project Settings.
- #include "theWolf.h"
- #include "PushDoor.h"
- #include "Engine.h"
- // Sets default values
- APushDoor::APushDoor()
- {
- // define the mesh.
- static ConstructorHelpers::FObjectFinder<UStaticMesh>
- DoorMesh(TEXT("/Game/SM_Door2.SM_Door2"));
- // Create mesh component for the Asteroid.
- StaticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("door"));
- // Here we insert a mesh into the mesh we created.
- StaticMeshComponent->SetStaticMesh(DoorMesh.Object);
- // Set the root component to the mesh. IS THIS NEEDED. I AM SETTING IT BELOW.
- StaticMeshComponent->AttachTo(RootComponent);
- // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
- PrimaryActorTick.bCanEverTick = true;
- doorHit = false;
- }
- // Called when the game starts or when spawned
- void APushDoor::BeginPlay()
- {
- Super::BeginPlay();
- if (GEngine)
- {
- GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("V1.06"));
- }
- }
- // Called every frame
- void APushDoor::Tick( float DeltaTime )
- {
- Super::Tick( DeltaTime );
- if (doorHit == true ){
- FRotator DoorRotation = GetActorRotation();
- DoorRotation.Yaw += 1;
- SetActorRotation(DoorRotation);
- //doorOpen.Yaw = doorOpen.Yaw + 1;
- }
- }
- void APushDoor::OnHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
- {
- if (OtherActor->GetName().Contains(TEXT("character"), ESearchCase::IgnoreCase, ESearchDir::FromStart))
- {
- if (GEngine)
- {
- GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("shot hit asteroid"));
- }
- }
- doorHit = true;
- if (GEngine)
- {
- GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("door hit"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement