Added dynamic spawning and despawning of objects
This commit is contained in:
parent
adbb208436
commit
e0cf8d9755
23 changed files with 794 additions and 350 deletions
|
|
@ -5,5 +5,18 @@ public class Star(Sector sector, Vector3 localCoordinates) : GameObject(sector,
|
|||
public override void Simulate(double delta)
|
||||
{
|
||||
base.Simulate(delta);
|
||||
|
||||
SetCoordinatesFromGlobal(new(GlobalCoordinates.X, GlobalCoordinates.Y, GlobalCoordinates.Z + 1 * (decimal)delta));
|
||||
}
|
||||
|
||||
public override Node3D Instantiate(Sector sector)
|
||||
{
|
||||
PackedScene prefab = ResourceLoader.Load<PackedScene>("res://prefabs/gameObjects/star.tscn");
|
||||
StarNode instance = prefab.Instantiate<StarNode>();
|
||||
|
||||
instance.StarData = this;
|
||||
SectorOffset = GetSectorOffset(sector);
|
||||
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue