This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ATurret::Tick(float DeltaSeconds) { | |
... | |
TimeSinceLastTargetUpdate += DeltaSeconds; | |
if (TimeSinceLastTargetUpdate >= TargetSearchInterval) { | |
TimeSinceLastTargetUpdate = 0.f; | |
CurrentTarget = FindNearestTarget(); | |
} | |
} | |
AActor* ATurret::FindNearestTarget() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void AHolyGrenade::Tick(float DeltaTime) { | |
... | |
const auto FurtherLocation = PredictFurtherLocation(...); | |
FurtherLocationBeacon->SetLocation(FurtherLocation); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FVector PredictFurtherLocation( | |
const FVector& Location, | |
const FVector& Velocity, | |
const FVector& Acceleration, | |
float Time) { | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ATurret::Tick(float DeltaSeconds) { | |
... | |
TimeSinceLastTargetUpdate += DeltaSeconds; | |
if (TimeSinceLastTargetUpdate >= TargetSearchInterval) { | |
TimeSinceLastTargetUpdate = 0.f; | |
CurrentTarget = FindBestTarget(); | |
} | |
} | |
AActor* ATurret::FindBestTarget() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void AActor::GetAttachedActors(TArray<class AActor*>& OutActors) const | |
{ | |
OutActors.Reset(); | |
if (RootComponent != nullptr) | |
{ | |
// Current set of components to check | |
TInlineComponentArray<USceneComponent*> CompsToCheck; | |
// Set of all components we have checked | |
TInlineComponentArray<USceneComponent*> CheckedComps; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Vector3 WallNormal(Vector3 position, bool smoothNormalAtCorners = false) { | |
var clampedPosition = Clamp(position); | |
var positions = | |
_alignmentArea | |
.Where(path => !path.isEmpty) | |
.Select(path => { | |
int nearestSegIndex; | |
Vector2 nearestPoint2D; | |
var side = path.PointSide(Project(position), out nearestPoint2D, out nearestSegIndex); | |
var nearestPoint3D = Unproject(nearestPoint2D); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def copyFrom | |
(source: ReadOnlySpace[ShapeT], | |
sourceRegion: CellBox = null, | |
destination: Int3 = this.lower): Unit = { | |
val sourceBounds = | |
if (sourceRegion != null) { | |
Check.argument(source.bounds contains sourceRegion) | |
sourceRegion | |
} else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool FindMaskOrDie() { | |
if (_destroyed) | |
return false; | |
mask = NearestMask(transform, out _affectedByMask) | |
?? NearestMask(transform, out _affectedByMask, enabledOnly: false); | |
if (mask == null) { | |
_destroyed = true; | |
DestroyImmediate(this); | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Attack(from: Int3, to: Int3) extends Action { | |
override def apply(gs: GameState): GameState = { | |
Check.state(possible(gs)) | |
gs mapWorld { world => | |
(world.at(from), world.at(to)) match { | |
case (turret @ Building(_, _, tag @ Turret(ammo)), target @ Building(_, _, _)) => | |
val damagedTarget = damage(target) | |
val worldAfterShot = | |
world. | |
replace(from, turret.copy(tag = tag.copy(ammo = ammo - 1))). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void AActor::BeginDestroy() | |
{ | |
ULevel* OwnerLevel = GetLevel(); | |
UnregisterAllComponents(); | |
if (OwnerLevel && !OwnerLevel->HasAnyInternalFlags(EInternalObjectFlags::Unreachable)) | |
{ | |
OwnerLevel->Actors.RemoveSingleSwap(this, false); | |
} | |
Super::BeginDestroy(); | |
} |
NewerOlder