Skip to content
Snippets Groups Projects
Commit 79b6a370 authored by Sebastian Pape's avatar Sebastian Pape
Browse files

Initial Commit

parents
No related branches found
No related tags found
No related merge requests found
# Visual Studio 2015 user specific files
.vs/
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
*.ipa
# These project files can be generated by the engine
*.xcodeproj
*.xcworkspace
*.sln
*.suo
*.opensdf
*.sdf
*.VC.db
*.VC.opendb
# Precompiled Assets
SourceArt/**/*.png
SourceArt/**/*.tga
# Binary Files
Binaries/*
Plugins/*/Binaries/*
# Builds
Build/*
# Whitelist PakBlacklist-<BuildConfiguration>.txt files
!Build/*/
Build/*/**
!Build/*/PakBlacklist*.txt
# Don't ignore icon files in Build
!Build/**/*.ico
# Configuration files generated by the Editor
Saved/*
# Compiled source files for the engine to use
Intermediate/*
Plugins/*/Intermediate/*
# Cache files for the editor to use
DerivedDataCache/*
LocalDerivedDataCache/*
\ No newline at end of file
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.0",
"FriendlyName": "CaveGun",
"Description": "",
"Category": "Other",
"CreatedBy": "",
"CreatedByURL": "",
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "",
"CanContainContent": true,
"IsBetaVersion": false,
"Installed": false,
"Modules": [
{
"Name": "CaveGun",
"Type": "Runtime",
"LoadingPhase": "Default"
}
],
"Plugins": [
{
"Name": "nDisplay",
"Enabled": true
},
{
"Name": "nDisplayExtensions",
"Enabled": true
}
]
}
\ No newline at end of file
Resources/Icon128.png

6.47 KiB

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class CaveGun : ModuleRules
{
public CaveGun(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"DisplayCluster",
"DisplayClusterExtensions"
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "CaveGun.h"
#define LOCTEXT_NAMESPACE "FCaveGunModule"
void FCaveGunModule::StartupModule()
{
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
}
void FCaveGunModule::ShutdownModule()
{
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
// we call this function before unloading the module.
}
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FCaveGunModule, CaveGun)
\ No newline at end of file
// Fill out your copyright notice in the Description page of Project Settings.
#include "CaveGunBase.h"
#include "IDisplayCluster.h"
#include "VirtualRealityUtilities.h"
// Sets default values
ACaveGunBase::ACaveGunBase()
{
// 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;
}
// Called when the game starts or when spawned
void ACaveGunBase::BeginPlay()
{
Super::BeginPlay();
//Register Cluster Events
IDisplayClusterClusterManager* ClusterManager = IDisplayCluster::Get().GetClusterMgr();
if (ClusterManager && !ClusterEventListenerDelegate.IsBound())
{
ClusterEventListenerDelegate = FOnClusterEventListener::CreateUObject(this, &ACaveGunBase::HandleClusterEvent);
ClusterManager->AddClusterEventListener(ClusterEventListenerDelegate);
}
AttachToClusterComponent();
}
void ACaveGunBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
//Deregister Cluster Events
IDisplayClusterClusterManager* ClusterManager = IDisplayCluster::Get().GetClusterMgr();
if (ClusterManager && ClusterEventListenerDelegate.IsBound())
{
ClusterManager->RemoveClusterEventListener(ClusterEventListenerDelegate);
}
Super::EndPlay(EndPlayReason);
}
// Called every frame
void ACaveGunBase::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
AttachToClusterComponent();
}
void ACaveGunBase::OnPump_Implementation(bool Pressed){}
void ACaveGunBase::OnReload_Implementation(bool Pressed){}
void ACaveGunBase::OnTrigger_Implementation(bool Pressed){}
void ACaveGunBase::HandleClusterEvent(const FDisplayClusterClusterEvent& Event)
{
if (!Event.Category.Equals("CAVEGun") || !Event.Type.Equals("ButtonChange")) return;
if(Event.Parameters.Contains("Pump")){
bool Status = Event.Parameters["Pump"].Equals("1")?true:false;
if(bPumpPressed ^ Status){
bPumpPressed = Status;
OnPump(bPumpPressed);
}
} else if(Event.Parameters.Contains("Reload")){
bool Status = Event.Parameters["Reload"].Equals("1")?true:false;
if(bReloadPressed ^ Status){
bReloadPressed = Status;
OnReload(bReloadPressed);
}
} else if(Event.Parameters.Contains("Trigger")){
bool Status = Event.Parameters["Trigger"].Equals("1")?true:false;
if(bTriggerPressed ^ Status){
bTriggerPressed = Status;
OnTrigger(bTriggerPressed);
}
}
}
void ACaveGunBase::AttachToClusterComponent()
{
static bool bAttached = false;
if(bAttached) return;
UDisplayClusterSceneComponent* CaveGunComponent = UVirtualRealityUtilities::GetClusterComponent("CaveGun");
if(CaveGunComponent){
AttachToComponent(CaveGunComponent, FAttachmentTransformRules::SnapToTargetIncludingScale);
bAttached = true;
}
}
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Modules/ModuleManager.h"
class FCaveGunModule : public IModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
};
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Cluster/DisplayClusterClusterEvent.h"
#include "Cluster/IDisplayClusterClusterManager.h"
#include "CaveGunBase.generated.h"
UCLASS()
class CAVEGUN_API ACaveGunBase : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ACaveGunBase();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
UFUNCTION(BlueprintNativeEvent, Category="Cave Gun") void OnPump(bool Pressed);
UFUNCTION(BlueprintNativeEvent, Category="Cave Gun") void OnReload(bool Pressed);
UFUNCTION(BlueprintNativeEvent, Category="Cave Gun") void OnTrigger(bool Pressed);
void OnPump_Implementation(bool Pressed);
void OnReload_Implementation(bool Pressed);
void OnTrigger_Implementation(bool Pressed);
private:
//Cluster Events
FOnClusterEventListener ClusterEventListenerDelegate;
void HandleClusterEvent(const FDisplayClusterClusterEvent& Event);
void AttachToClusterComponent();
bool bPumpPressed = false;
bool bReloadPressed = false;
bool bTriggerPressed = false;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment