Skip to content

Commit

Permalink
Removing unused assets, adding light switch meshes, created puzzle di…
Browse files Browse the repository at this point in the history
…agram class
  • Loading branch information
Shawn Warnock committed Jul 15, 2019
1 parent 0de9bc1 commit aee1cdc
Show file tree
Hide file tree
Showing 115 changed files with 414 additions and 72 deletions.
Binary file removed Content/BasementBackHallway.uasset
Binary file not shown.
Binary file removed Content/BasementFrontLeftHallway.uasset
Binary file not shown.
Binary file removed Content/BasementStairwell.uasset
Binary file not shown.
Binary file modified Content/Blueprints/Characters/PlayerCharacter.uasset
Binary file not shown.
Binary file not shown.
Binary file modified Content/Blueprints/Interactables/LightSwitch_Auto8.uasset
Binary file not shown.
Binary file removed Content/Blueprints/MyGameInstance.uasset
Binary file not shown.
Binary file removed Content/Blueprints/NewBlueprint.uasset
Binary file not shown.
Binary file added Content/Blueprints/PuzzleDiagram.uasset
Binary file not shown.
Binary file modified Content/Blueprints/Puzzles/PuzzleBoard.uasset
Binary file not shown.
Binary file modified Content/Blueprints/Puzzles/VentPuzzle.uasset
Binary file not shown.
Binary file removed Content/Box_Brush94_StaticMesh.uasset
Binary file not shown.
Binary file removed Content/FamilyRoom.uasset
Binary file not shown.
Binary file removed Content/FirstFloorFrontHallway.uasset
Binary file not shown.
Binary file removed Content/FirstFloorFrontStairwell.uasset
Binary file not shown.
Binary file removed Content/FrontCenterBasementRoom.uasset
Binary file not shown.
Binary file removed Content/HallwayCloset.uasset
Binary file not shown.
Binary file removed Content/Kitchen.uasset
Binary file not shown.
Binary file removed Content/LeftFrontBasementRoom.uasset
Binary file not shown.
Binary file removed Content/Library.uasset
Binary file not shown.
Binary file removed Content/LivingRoom.uasset
Binary file not shown.
Binary file modified Content/Maps/BackgroundLevel.umap
Binary file not shown.
Binary file modified Content/Maps/BackgroundLevel_BuiltData.uasset
Binary file not shown.
Binary file removed Content/MasterBathroom.uasset
Binary file not shown.
Binary file removed Content/MasterBedroom.uasset
Binary file not shown.
Binary file added Content/Materials/PuzzleDiagram.uasset
Binary file not shown.
Binary file removed Content/RoomToAttic.uasset
Binary file not shown.
Binary file removed Content/RoomToBasement.uasset
Binary file not shown.
Binary file removed Content/SecondFloorBackHallway.uasset
Binary file not shown.
Binary file removed Content/SecondFloorCenterHallway.uasset
Binary file not shown.
Binary file removed Content/SecondFloorFrontBathroom.uasset
Binary file not shown.
Binary file removed Content/SecondFloorFrontHallway.uasset
Binary file not shown.
Binary file removed Content/SecondFloorMainBathroom.uasset
Binary file not shown.
Binary file removed Content/SpareBedroom.uasset
Binary file not shown.
Binary file modified Content/StarterContent/Architecture/Floor_400x400.uasset
Binary file not shown.
Binary file modified Content/StarterContent/Props/SM_Door.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/Attic.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/BasementBackHallway.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/BasementBackLeftRoom.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/BasementBackRightRoom.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/BasementCenterHallway.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/BasementCenterRoom.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/BasementFrontCenterRoom.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/BasementFrontLeftHallway.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/BasementFrontLeftRoom.uasset
Binary file not shown.
Binary file not shown.
Binary file removed Content/StaticMeshes/BasementFrontRightRoom.uasset
Binary file not shown.
Binary file not shown.
Binary file removed Content/StaticMeshes/BasementStairWall.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/BasementStairwell.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/FirstFloorBackBathroom.uasset
Binary file not shown.
Binary file not shown.
Binary file removed Content/StaticMeshes/FirstFloorBackHallway.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/FirstFloorCenterHallway.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/FirstFloorFamilyRoom.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/FirstFloorFrontBathroom.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/FirstFloorFrontHallway.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/FirstFloorFrontStairwell.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/FirstFloorKitchen.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/FirstFloorLibrary.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/FirstFloorLivingRoom.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/FirstFloorRoomToBasement.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/FirstFloorRoomToGarage.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/Garage.uasset
Binary file not shown.
Binary file added Content/StaticMeshes/Items/01___Default.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Content/StaticMeshes/Items/Material_001.uasset
Binary file not shown.
Binary file added Content/StaticMeshes/Items/Material_002.uasset
Binary file not shown.
Binary file added Content/StaticMeshes/Items/ScrewHead.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed Content/StaticMeshes/SecondFloorBackHallway.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/SecondFloorCenterHallway.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/SecondFloorFrontBathroom.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/SecondFloorFrontHallway.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/SecondFloorHallwayCloset.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/SecondFloorMainBathroom.uasset
Binary file not shown.
Binary file not shown.
Binary file removed Content/StaticMeshes/SecondFloorMasterBedroom.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/SecondFloorRoomToAttic.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/SecondFloorSpareBedroom.uasset
Binary file not shown.
Binary file removed Content/StaticMeshes/SecondFloorSpareBedroom2.uasset
Binary file not shown.
Binary file not shown.
Binary file added Content/Textures/PuzzleDiagram.uasset
Binary file not shown.
Binary file modified Content/UI/GameOver.uasset
Binary file not shown.
Binary file modified Content/UI/Inventory.uasset
Binary file not shown.
Binary file modified Content/UI/InventoryItem.uasset
Binary file not shown.
53 changes: 53 additions & 0 deletions Source/HouseEscape/Character/HouseEscapeCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ AHouseEscapeCharacter::AHouseEscapeCharacter()

isOverlapping = false;
mostDesirableTarget = nullptr;

IsInventoryOpen = false;

lastItemSelected;
}

void AHouseEscapeCharacter::BeginPlay()
Expand All @@ -55,6 +59,7 @@ void AHouseEscapeCharacter::BeginPlay()
messenger->OnItemPickedUp.AddDynamic(this, &AHouseEscapeCharacter::HandleItemPickedUp);
messenger->OnAddInteractTarget.AddDynamic(this, &AHouseEscapeCharacter::AddInteractTarget);
messenger->OnRemoveInteract.AddDynamic(this, &AHouseEscapeCharacter::RemoveInteractTarget);
messenger->OnInventoryItemSelected.AddDynamic(this, &AHouseEscapeCharacter::SetLastItemSelected);
}

//////////////////////////////////////////////////////////////////////////
Expand All @@ -67,6 +72,7 @@ void AHouseEscapeCharacter::SetupPlayerInputComponent(class UInputComponent* Pla

// Bind fire event
PlayerInputComponent->BindAction("Interact", IE_Pressed, this, &AHouseEscapeCharacter::OnInteract);
PlayerInputComponent->BindAction("Inventory", IE_Pressed, this, &AHouseEscapeCharacter::OnInventory);

// Bind movement events
PlayerInputComponent->BindAxis("MoveForward", this, &AHouseEscapeCharacter::MoveForward);
Expand Down Expand Up @@ -133,6 +139,11 @@ void AHouseEscapeCharacter::AddInteractTarget(FMessage message)
currentTargets.Add(message.interact);
isOverlapping = true;
AInteractable* tempTarget = AInteractable::FindMostDesirableTarget(currentTargets, this);

if (!tempTarget)
{
return;
}

if (mostDesirableTarget == nullptr)
{
Expand Down Expand Up @@ -162,6 +173,10 @@ void AHouseEscapeCharacter::RemoveInteractTarget(FMessage message)
else
{
mostDesirableTarget = AInteractable::FindMostDesirableTarget(currentTargets, this);
if (!mostDesirableTarget)
{
return;
}
mostDesirableTarget->SetRenderDepth(true);
messenger->CollideWithInteractable(message);
}
Expand All @@ -182,6 +197,10 @@ void AHouseEscapeCharacter::Tick(float DeltaSeconds)
if (FirstPersonCameraComponent->GetForwardVector() != CameraForward && AnyCurrentTargets())
{
AInteractable* tempMostDesirable = AInteractable::FindMostDesirableTarget(currentTargets, this);
if (!tempMostDesirable)
{
return;
}
if (mostDesirableTarget != tempMostDesirable)
{
CameraForward = FirstPersonCameraComponent->GetForwardVector();
Expand All @@ -198,3 +217,37 @@ void AHouseEscapeCharacter::Tick(float DeltaSeconds)
}
}
}

void AHouseEscapeCharacter::OnInventory()
{
APlayerController* playerController = UGameplayStatics::GetPlayerController(GetWorld(), 0);
if (IsInventoryOpen)
{
playerController->bEnableMouseOverEvents = false;
playerController->bShowMouseCursor = false;
playerController->bEnableClickEvents = false;
playerController->SetInputMode(FInputModeGameOnly());
}
else
{
playerController->bEnableMouseOverEvents = true;
playerController->bShowMouseCursor = true;
playerController->bEnableClickEvents = true;
playerController->SetInputMode(FInputModeGameAndUI());
}

FMessage message;
message.items = items;
messenger->ToggleInventory(message);
IsInventoryOpen = !IsInventoryOpen;
}

void AHouseEscapeCharacter::SetLastItemSelected(FMessage message)
{
lastItemSelected = message.itemInfo;
}

FItem AHouseEscapeCharacter::GetLastSelectedItem()
{
return lastItemSelected;
}
15 changes: 14 additions & 1 deletion Source/HouseEscape/Character/HouseEscapeCharacter.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class AHouseEscapeCharacter : public ACharacter

TArray<AInteractable*> GetCurrentTargets();

FItem GetLastSelectedItem();

protected:
virtual void BeginPlay();

Expand Down Expand Up @@ -72,6 +74,9 @@ class AHouseEscapeCharacter : public ACharacter
virtual void SetupPlayerInputComponent(UInputComponent* InputComponent) override;
// End of APawn interface

UPROPERTY(BlueprintReadOnly)
AInteractable* mostDesirableTarget;

private:
const float InteractDistance = 300.0f;

Expand All @@ -84,7 +89,7 @@ class AHouseEscapeCharacter : public ACharacter

TArray<AInteractable*> currentTargets;

AInteractable* mostDesirableTarget;


UFUNCTION()
void AddInteractTarget(FMessage message);
Expand All @@ -97,5 +102,13 @@ class AHouseEscapeCharacter : public ACharacter
void Tick(float DeltaSeconds) override;

UMessenger* messenger;

void OnInventory();
bool IsInventoryOpen;

FItem lastItemSelected;

UFUNCTION()
void SetLastItemSelected(FMessage message);
};

6 changes: 5 additions & 1 deletion Source/HouseEscape/Interactables/InteractInterface.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "Interface.h"
#include "MessageStruct.h"
#include "InteractInterface.generated.h"

UINTERFACE(Blueprintable)
Expand All @@ -14,6 +15,9 @@ class IInteractInterface
GENERATED_BODY()

public:
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "MyCategory")
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Interact")
void OnInteract();

UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Item")
void OnUseItem(FMessage message);
};
8 changes: 7 additions & 1 deletion Source/HouseEscape/Interactables/Interactable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ AInteractable::AInteractable()
BoxComponent->SetRelativeLocation(FVector::ZeroVector);

uniqueId = FGuid::NewGuid();

IsValidInteract = true;
}

// Called when the game starts or when spawned
Expand Down Expand Up @@ -75,6 +77,10 @@ void AInteractable::OnInteract_Implementation()
{
}

void AInteractable::OnUseItem_Implementation(FMessage message)
{
}

bool AInteractable::IsPlayerOverlapping()
{
return BoxComponent->IsOverlappingActor(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
Expand Down Expand Up @@ -113,7 +119,7 @@ AInteractable* AInteractable::FindMostDesirableTarget(TArray<AInteractable*> int

void AInteractable::SetRenderDepth(bool renderSet)
{
StaticMeshComponent->SetRenderCustomDepth(renderSet);
Cast<UStaticMeshComponent>(RootComponent)->SetRenderCustomDepth(renderSet);
}

TEnumAsByte<Interacts> AInteractable::GetInteractType()
Expand Down
6 changes: 6 additions & 0 deletions Source/HouseEscape/Interactables/Interactable.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ class HOUSEESCAPE_API AInteractable : public AActor, public IInteractInterface
USaveGameUtil* saveGameUtil;

virtual void OnInteract_Implementation() override;
virtual void OnUseItem_Implementation(FMessage message) override;

UPROPERTY(EditAnywhere, BlueprintReadOnly)
TEnumAsByte<Interacts> interactType;

public:
Expand All @@ -58,6 +60,8 @@ class HOUSEESCAPE_API AInteractable : public AActor, public IInteractInterface

TEnumAsByte<Interacts> GetInteractType();

bool GetIsValidInteract();

protected:

UFUNCTION()
Expand All @@ -69,4 +73,6 @@ class HOUSEESCAPE_API AInteractable : public AActor, public IInteractInterface
bool IsPlayerOverlapping();

FGuid uniqueId;

bool IsValidInteract;
};
15 changes: 6 additions & 9 deletions Source/HouseEscape/Interactables/Items/ItemStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,18 @@ struct FItem

public:

UPROPERTY(EditAnywhere)
UStaticMeshComponent* meshComponent;

UPROPERTY(EditAnywhere)
UPROPERTY(EditAnywhere, BlueprintReadOnly)
TEnumAsByte<ItemType> itemType;

UPROPERTY(EditAnywhere)
UPROPERTY(EditAnywhere, BlueprintReadOnly)
UTexture2D* texture;

UPROPERTY(EditAnywhere)
FName name;
UPROPERTY(EditAnywhere, BlueprintReadOnly)
FText name;

UPROPERTY(EditAnywhere)
UPROPERTY(EditAnywhere, BlueprintReadOnly)
int itemIndex;

UPROPERTY(EditAnywhere)
UPROPERTY(EditAnywhere, BlueprintReadOnly)
AItemBase* baseClass;
};
24 changes: 23 additions & 1 deletion Source/HouseEscape/Interactables/LightSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ void ALightSwitch::OnInteract_Implementation()
{
pointLight->GetLightComponent()->SetActive(false);
pointLight->GetLightComponent()->ToggleVisibility(false);
SwitchFlip->SetRelativeRotation(FRotator::ZeroRotator);
}
else
{

pointLight->GetLightComponent()->SetActive(true);
pointLight->GetLightComponent()->ToggleVisibility(true);
SwitchFlip->SetRelativeRotation(FRotator(0, 0, -45));
}

if (pointLight2 != nullptr)
Expand All @@ -38,4 +39,25 @@ void ALightSwitch::OnInteract_Implementation()
ALightSwitch::ALightSwitch()
{
interactType = Interacts::LightSwitch;

static ConstructorHelpers::FObjectFinder<UStaticMesh> LightSwitchBase(TEXT("/Game/StaticMeshes/Items/LightSwitch/LightSwitchBase.LightSwitchBase"));
StaticMeshComponent->SetStaticMesh(LightSwitchBase.Object);

static ConstructorHelpers::FObjectFinder<UStaticMesh> LightSwitchFlip(TEXT("/Game/StaticMeshes/Items/LightSwitch/LightSwitchFlip.LightSwitchFlip"));
SwitchFlip = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Flipper"));
SwitchFlip->SetStaticMesh(LightSwitchFlip.Object);
SwitchFlip->SetRelativeLocation(FVector(0, -1, 0));
SwitchFlip->SetupAttachment(RootComponent);

static ConstructorHelpers::FObjectFinder<UStaticMesh> LightSwitchScrewTop(TEXT("/Game/StaticMeshes/Items/LightSwitch/LightSwitchScrewTop.LightSwitchScrewTop"));
TopScrew = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("TopScrew"));
TopScrew->SetStaticMesh(LightSwitchScrewTop.Object);
TopScrew->SetupAttachment(RootComponent);

static ConstructorHelpers::FObjectFinder<UStaticMesh> LightSwitchScrewBottom(TEXT("/Game/StaticMeshes/Items/LightSwitch/LightSwitchScrewBottom.LightSwitchScrewBottom"));
BottomScrew = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("BottomScrew"));
BottomScrew->SetStaticMesh(LightSwitchScrewBottom.Object);
BottomScrew->SetupAttachment(RootComponent);

BoxComponent->SetRelativeLocation(FVector(0, 30, 0));
}
9 changes: 9 additions & 0 deletions Source/HouseEscape/Interactables/LightSwitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ class HOUSEESCAPE_API ALightSwitch : public AInteractable
UPROPERTY(EditAnywhere)
APointLight* pointLight2;

UPROPERTY(EditAnywhere)
UStaticMeshComponent* SwitchFlip;

UPROPERTY(EditAnywhere)
UStaticMeshComponent* TopScrew;

UPROPERTY(EditAnywhere)
UStaticMeshComponent* BottomScrew;

public:
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "MyCategory")
void OnInteract();
Expand Down
62 changes: 62 additions & 0 deletions Source/HouseEscape/Interactables/PuzzleDiagram.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Fill out your copyright notice in the Description page of Project Settings.

#include "PuzzleDiagram.h"

APuzzleDiagram::APuzzleDiagram()
{
static ConstructorHelpers::FObjectFinder<UStaticMesh> Plane(TEXT("/Engine/BasicShapes/Plane.Plane"));

static ConstructorHelpers::FObjectFinder<UMaterialInterface> DiagramMat(TEXT("/Game/Materials/PuzzleDiagram.PuzzleDiagram"));
UMaterialInterface* DiagramMaterial = (UMaterialInterface*)DiagramMat.Object;

StaticMeshComponent->SetStaticMesh(Plane.Object);
StaticMeshComponent->SetMaterial(0, DiagramMaterial);

BoxComponent->SetBoxExtent(FVector(80, 80, 32));
BoxComponent->SetRelativeLocation(FVector(0, 0, 40));

CameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
CameraComponent->SetRelativeLocation(FVector(0, 0, 120));
CameraComponent->SetWorldRotation(FRotator(-90, 0, -90));
CameraComponent->SetupAttachment(AInteractable::RootComponent);

interactType = Interacts::Generic;
}

void APuzzleDiagram::OnInteract_Implementation()
{
//If we are not currently overlapping the box component, do not interact
if (!AInteractable::BoxComponent->IsOverlappingComponent(UGameplayStatics::GetPlayerCharacter(AInteractable::GetWorld(), 0)->GetCapsuleComponent()))
{
return;
}

messenger->RemoveAllWidgets();
APlayerController* playerController = AInteractable::GetWorld()->GetFirstPlayerController();

//Toggle between player controller's camera and this camera when interact button is pressed
if (playerController->GetViewTarget() == this)
{
playerController->SetViewTargetWithBlend((AActor*)UGameplayStatics::GetPlayerCharacter(AInteractable::GetWorld(), 0), 0.5f);
playerController->bEnableMouseOverEvents = false;
playerController->bShowMouseCursor = false;
playerController->bEnableClickEvents = false;
AInteractable::StaticMeshComponent->SetRenderCustomDepth(true);

FMessage message;
message.interactableType = interactType;
messenger->CollideWithInteractable(message);

playerController->SetInputMode(FInputModeGameOnly());
}
else
{
playerController->SetViewTargetWithBlend((AActor*)this, 0.5f);
playerController->bEnableMouseOverEvents = true;
playerController->bShowMouseCursor = true;
playerController->bEnableClickEvents = true;
AInteractable::StaticMeshComponent->SetRenderCustomDepth(false);

playerController->SetInputMode(FInputModeGameAndUI());
}
}
27 changes: 27 additions & 0 deletions Source/HouseEscape/Interactables/PuzzleDiagram.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Interactables/Interactable.h"
#include "Camera/CameraComponent.h"
#include "PuzzleDiagram.generated.h"

/**
*
*/
UCLASS()
class HOUSEESCAPE_API APuzzleDiagram : public AInteractable
{
GENERATED_BODY()

APuzzleDiagram();

UPROPERTY(EditAnywhere)
UCameraComponent* CameraComponent;

protected:
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Interact")
void OnInteract();
void OnInteract_Implementation() override;
};
Loading

0 comments on commit aee1cdc

Please sign in to comment.