More actor and UObject progress
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
using Prospect.Unreal.Core;
|
||||
using Prospect.Unreal.Core.Objects;
|
||||
using Prospect.Unreal.Runtime;
|
||||
|
||||
namespace Prospect.Unreal.Net.Actors;
|
||||
|
||||
public class AActor
|
||||
public class AActor : UObject
|
||||
{
|
||||
private bool bActorInitialized;
|
||||
|
||||
// TODO: UPROPERTY(BlueprintReadWrite, ReplicatedUsing=OnRep_Instigator, meta=(ExposeOnSpawn=true, AllowPrivateAccess=true), Category=Actor)
|
||||
/// <summary>
|
||||
/// Pawn responsible for damage and other gameplay events caused by this actor.
|
||||
/// </summary>
|
||||
private APawn? _instigator;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the value of Role without causing other side effects to this instance.
|
||||
@@ -36,9 +43,38 @@ public class AActor
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public UWorld GetWorld()
|
||||
public UWorld? GetWorld()
|
||||
{
|
||||
// if ()
|
||||
if (!HasAnyFlags(EObjectFlags.RF_ClassDefaultObject))
|
||||
{
|
||||
var outer = GetOuter();
|
||||
if (outer == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!outer.HasAnyFlags(EObjectFlags.RF_BeginDestroyed) &&
|
||||
!outer.IsUnreachable())
|
||||
{
|
||||
var level = GetLevel();
|
||||
if (level != null)
|
||||
{
|
||||
return level.OwningWorld;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ULevel? GetLevel()
|
||||
{
|
||||
return GetTypedOuter<ULevel>();
|
||||
}
|
||||
|
||||
public APawn? GetInstigator()
|
||||
{
|
||||
return _instigator;
|
||||
}
|
||||
|
||||
public bool IsActorInitialized()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Prospect.Unreal.Core;
|
||||
using Prospect.Unreal.Core.Objects;
|
||||
using Prospect.Unreal.Runtime;
|
||||
|
||||
namespace Prospect.Unreal.Net.Actors;
|
||||
@@ -19,6 +20,12 @@ public class AGameModeBase : AInfo
|
||||
|
||||
public virtual void InitGame(string mapName, string options, out string errorMessage)
|
||||
{
|
||||
// Default error.
|
||||
errorMessage = string.Empty;
|
||||
|
||||
// Find world.
|
||||
var world = GetWorld();
|
||||
|
||||
// Save Options for future use
|
||||
OptionsString = options;
|
||||
|
||||
@@ -28,7 +35,7 @@ public class AGameModeBase : AInfo
|
||||
ObjectFlags = EObjectFlags.RF_Transient
|
||||
};
|
||||
|
||||
GameSession = World.SpawnActor();
|
||||
// GameSession = world.SpawnActor();
|
||||
}
|
||||
|
||||
public virtual void InitGameState()
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Prospect.Unreal.Net.Actors;
|
||||
|
||||
public class APawn : AActor
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using Prospect.Unreal.Core;
|
||||
using Prospect.Unreal.Core.Names;
|
||||
using Prospect.Unreal.Core.Objects;
|
||||
using Prospect.Unreal.Net.Actors;
|
||||
|
||||
namespace Prospect.Unreal.Net;
|
||||
@@ -10,7 +11,7 @@ public ref struct FActorSpawnParameters
|
||||
/// A name to assign as the Name of the Actor being spawned.
|
||||
/// If no value is specified, the name of the spawned Actor will be automatically generated using the form [Class]_[Number].
|
||||
/// </summary>
|
||||
public FName? Name { get; set; }
|
||||
public FName Name { get; set; } = EName.None;
|
||||
|
||||
/// <summary>
|
||||
/// An Actor to use as a template when spawning the new Actor.
|
||||
|
||||
Reference in New Issue
Block a user