Guest User

Untitled

a guest
May 12th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.63 KB | None | 0 0
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2.  
  3. #include "Grid.h"
  4.  
  5. AGrid::AGrid()
  6. {
  7.     // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
  8.     UE_LOG(LogTemp, Warning, TEXT("Changing the tick"));
  9.     PrimaryActorTick.bCanEverTick = false;
  10.     UE_LOG(LogTemp, Warning, TEXT("Tick changed"));
  11.  
  12.     //We don't yet know what type of grid this is. This will be changed by the subclasses
  13.     UE_LOG(LogTemp, Warning, TEXT("Setting the grid type"));
  14.     GridType = EGridType::EUnknown;
  15.     UE_LOG(LogTemp, Warning, TEXT("Grid type set"));
  16.  
  17.     //Create the static mesh component
  18.     UE_LOG(LogTemp, Warning, TEXT("Creating default subobject"));
  19.     GridMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("GridMesh"));
  20.     UE_LOG(LogTemp, Warning, TEXT("Default subobject created"));
  21.  
  22.     //Base other stuff around this component. Not needed for our example, but we may come back to this
  23.     UE_LOG(LogTemp, Warning, TEXT("Setting root component"));
  24.     RootComponent = GridMesh;
  25.     UE_LOG(LogTemp, Warning, TEXT("Root component set"));
  26.  
  27.     /* TODO: Set mobility to stationary for efficient lighting */
  28.  
  29. }
  30.  
  31. // Called when the game starts or when spawned
  32. void AGrid::BeginPlay()
  33. {
  34.     Super::BeginPlay();
  35.  
  36. }
  37.  
  38. // Called every frame
  39. void AGrid::Tick(float DeltaTime)
  40. {
  41.     Super::Tick(DeltaTime);
  42.  
  43. }
  44.  
  45. EGridType AGrid::GetGridType() const
  46. {
  47.     return GridType;
  48. }
  49.  
  50. FVector AGrid::GetGridOrigin() const
  51. {
  52.     return GetActorLocation(); //This returns the rootcomponent's location relative to the centre of the actor, not our world location
  53.                                //return GridMesh->GetComponentLocation();
  54. }
Add Comment
Please, Sign In to add comment