Additional collision/avoidance changes for monstos
This commit is contained in:
@@ -20,6 +20,8 @@ public partial class MonsterRoom : DungeonRoom
|
||||
|
||||
[Node] public Marker3D PlayerSpawn { get; set; } = default!;
|
||||
|
||||
private string _color = "white";
|
||||
|
||||
public void SpawnEnemies(Array<EnemySpawnRate> spawnTable)
|
||||
{
|
||||
if (spawnTable.Count == 0)
|
||||
@@ -42,6 +44,7 @@ public partial class MonsterRoom : DungeonRoom
|
||||
AddChild(instantiatedEnemy);
|
||||
instantiatedEnemy.GlobalPosition = new Vector3(spawnPoint.GlobalPosition.X, 0f, spawnPoint.GlobalPosition.Z);
|
||||
ResetPhysicsInterpolation();
|
||||
GD.PrintRich($"Spawned [color=red]{selectedEnemy.EnemyType}[/color] at {instantiatedEnemy.GlobalPosition}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,22 +70,34 @@ public partial class MonsterRoom : DungeonRoom
|
||||
var rarity = RarityTag.Common;
|
||||
var rarityGroup = rng.Randf();
|
||||
if (rarityGroup < 0.5f)
|
||||
{
|
||||
rarity = RarityTag.Common;
|
||||
_color = "white";
|
||||
}
|
||||
else if (rarityGroup < 0.85f)
|
||||
{
|
||||
rarity = RarityTag.Uncommon;
|
||||
_color = "green";
|
||||
}
|
||||
else if (rarityGroup < 0.99f)
|
||||
{
|
||||
rarity = RarityTag.Rare;
|
||||
_color = "cyan";
|
||||
}
|
||||
else
|
||||
{
|
||||
rarity = RarityTag.Legendary;
|
||||
_color = "gold";
|
||||
}
|
||||
|
||||
spawnableItems = [.. spawnableItems.Where(x => x.RarityTag == rarity)];
|
||||
if (spawnableItems.Count() == 0)
|
||||
break;
|
||||
var selectedItem = database.PickItemFromList(spawnableItems) as Node3D;
|
||||
GD.Print($"Item spawned: {(selectedItem as IBaseInventoryItem).ItemName}");
|
||||
var duplicated = selectedItem.Duplicate((int)DuplicateFlags.UseInstantiation) as Node3D;
|
||||
AddChild(duplicated);
|
||||
duplicated.Position = new Vector3(spawnPoint.Position.X, 0, spawnPoint.Position.Z);
|
||||
GD.PrintRich($"Item spawned: [b]{(selectedItem as IBaseInventoryItem).ItemName}[/b] at {duplicated.GlobalPosition}. Rolled a {rarityGroup} for a [color={_color}]{rarity}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,3 +263,5 @@ lifetime = 41.19
|
||||
local_coords = true
|
||||
process_material = SubResource("ParticleProcessMaterial_kdgfu")
|
||||
draw_pass_1 = SubResource("QuadMesh_ec0oy")
|
||||
|
||||
[editable path="Model/A2-Deadend"]
|
||||
|
||||
Reference in New Issue
Block a user