Skip to content

Instantly share code, notes, and snippets.

/**
* FWorld data is a struct containing all the information about a world and it's setting
*/
USTRUCT(BlueprintType)
struct FWorldData
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Level Data")
int ID;
/ Script made by Levi Visser
#include "BaseGameInstance.h"
// Singleton-like accessor. I only use this as a workaround for PIE
// The GameInstance lifecycle is different in PIE
// In proper builds, this wouldn't be necessary
ULevelGenerationManager* UBaseGameInstance::LevelGenerationManager()
{
return
IsValid(LevelGenerationManagerInstance) ?
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class MenuManager : MonoBehaviour {
public static MenuManager Instance;
private GameObject _fadeImg;
private readonly List<GameObject> _menuScreens = new List<GameObject>();
using UnityEngine;
using UnityEditor;
/// <summary>
/// Zone data asset which can be created by the designer
/// </summary>
public class ZoneDataAsset
{
[MenuItem("Assets/Create/Zone")]
public static void Create()
{
/// <summary>
/// Director class
/// </summary>
class Director : MonoBehaviour {
private AbstractShipBuilder _shipBuilder;
public void SetShipBuilder(AbstractShipBuilder builder)
{
_shipBuilder = builder;
using UnityEngine;
public class ShipMovementComponent : MonoBehaviour {
private Vector3 cameraStartingPos;
private Vector3 crosshairScreenPos;
private Vector3 crosshairViewPos;
private Vector3 crosshairWorldPos;
private float maxHorizontalCamChange;
private float MaxRotationRoll = 70;
@LeviVisser
LeviVisser / TankAimingComponent.cpp
Created November 20, 2017 18:36
TankAimingComponent.cpp
#include "TankAimingComponent.h"
#include "Engine/World.h"
#include "TankBarrel.h"
#include "TankTurret.h"
#include "Engine.h" // TODO find correct include -> included to solve error UGameplayStatics::SuggestProjectileVelocity
#include "Engine/StaticMesh.h"
// Sets default values for this component's properties
UTankAimingComponent::UTankAimingComponent()
{
@LeviVisser
LeviVisser / TankAIControler.cpp
Created November 20, 2017 18:35
TankAIControler.cpp
#include "TankAIController.h"
#include "Engine.h" // TODO Find correct include included to fix error given at GetWord()
#include "BattleTank.h"
#include "TankAimingComponent.h"
#include "Tank.h"
void ATankAIController::BeginPlay()
{
Super::BeginPlay();
}
@LeviVisser
LeviVisser / Tank.cpp
Created November 20, 2017 18:34
Tank.cpp
#include "Tank.h"
#include "Engine.h"
// Sets default values
ATank::ATank()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = false;
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Projectile : MonoBehaviour, IDamageDealer<float> {
public float speed;
public float range = 100;
private Vector3 startPosition;