mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 08:55:54 +00:00
Added shrouds to rooms
This commit is contained in:
parent
07d49a0b23
commit
f460103239
12 changed files with 104 additions and 32 deletions
|
|
@ -7,6 +7,9 @@ public partial class BlackCover : Sprite2D, IActivable
|
|||
{
|
||||
[Export]
|
||||
public bool StartActive { get; private set; } = true;
|
||||
|
||||
[Signal]
|
||||
public delegate void DisabledEventHandler();
|
||||
|
||||
private bool _activated;
|
||||
|
||||
|
|
@ -47,7 +50,18 @@ public partial class BlackCover : Sprite2D, IActivable
|
|||
}
|
||||
else
|
||||
{
|
||||
EmitSignalDisabled();
|
||||
this.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAreaEntered(Area2D area)
|
||||
{
|
||||
if (area is not InteractionController interactionController)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_activated = false;
|
||||
UpdateSprite();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cirno.Scripts.Activables;
|
||||
using Cirno.Scripts.Components.FSM.Enemy;
|
||||
using Cirno.Scripts.Enums;
|
||||
using Cirno.Scripts.Interactables;
|
||||
|
|
@ -24,8 +25,11 @@ public partial class RogueliteRoom : Node2D
|
|||
|
||||
public Vector2I BottomLeft => GridPosition + new Vector2I(0, RoomResource.Size.Y - 1);
|
||||
|
||||
private Vector2 BaseRoomSize => new Vector2(320, 160);
|
||||
//private Vector2 BaseRoomSize => new Vector2(320, 160);
|
||||
private Vector2 BaseRoomSize => MapTheme.TileSize * MapTheme.RoomSizeInTiles;
|
||||
|
||||
public Vector2 RoomSize => BaseRoomSize * RoomResource.Size;
|
||||
|
||||
public Vector2I RandomBottomExit()
|
||||
{
|
||||
return BottomLeft + new Vector2I(GD.RandRange(0, RoomResource.Size.X - 1), 0);
|
||||
|
|
@ -63,6 +67,7 @@ public partial class RogueliteRoom : Node2D
|
|||
SpawnEnemies();
|
||||
SpawnFeatures();
|
||||
SpawnFixedWeapons();
|
||||
SpawnShroud();
|
||||
//HandleDoors(connectionChecker);
|
||||
//AddDebugLabel();
|
||||
return this;
|
||||
|
|
@ -441,4 +446,16 @@ public partial class RogueliteRoom : Node2D
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SpawnShroud()
|
||||
{
|
||||
if (!RoomResource.StartShrouded) return;
|
||||
|
||||
var shroud = this.CreateChild<BlackCover>(MapTheme.ShroudPrefab);
|
||||
|
||||
shroud.Position = new Vector2(RoomSize.X / 2, RoomSize.Y / 2);
|
||||
shroud.Scale = RoomSize;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -121,6 +121,9 @@ public partial class RogueliteRoomManager : Node2D
|
|||
|
||||
var shuffledOffshoots = offshoots.Shuffle().ToList();
|
||||
|
||||
// var offshootsQueue = new Queue<RoomType>();
|
||||
// offshootsQueue.EnqueueRange(shuffledOffshoots);
|
||||
|
||||
int currentOffshoot = 0;
|
||||
|
||||
RogueliteRoom lastRoom = spawnedBeginRoom;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ public partial class RogueliteRoomResource : Resource
|
|||
[Export] public StringName ScenePath { get; set; }
|
||||
[Export] public Vector2I Size { get; set; } = new(1, 1);
|
||||
|
||||
[Export] public bool StartShrouded { get; set; } = true;
|
||||
[Export] public Array<Vector2I> DoorGridPositions { get; set; } = [];
|
||||
|
||||
[Export] public Array<EnemyResource> SpawnableEnemies { get; set; }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Cirno.Scripts.Resources.Loot;
|
||||
using Cirno.Scripts.Activables;
|
||||
using Cirno.Scripts.Resources.Loot;
|
||||
using Cirno.Scripts.Resources.Roguelite;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
|
@ -8,6 +9,10 @@ namespace Cirno.Scripts.Resources;
|
|||
[GlobalClass]
|
||||
public partial class RogueliteMapTheme : Resource
|
||||
{
|
||||
[ExportCategory("Dimensions")]
|
||||
[Export] public Vector2I TileSize { get; set; } = new Vector2I(16, 16);
|
||||
[Export] public Vector2I RoomSizeInTiles { get; set; } = new Vector2I(20, 10);
|
||||
|
||||
[ExportGroup("Prefabs")]
|
||||
[Export] public PackedScene HorizontalDoorPrefab { get; set; }
|
||||
[Export] public PackedScene HorizontalWallPrefab { get; set; }
|
||||
|
|
@ -18,8 +23,10 @@ public partial class RogueliteMapTheme : Resource
|
|||
[Export] public PackedScene ChestPrefab { get; set; }
|
||||
[Export] public PackedScene VendingMachinePrefab { get; set; }
|
||||
[Export] public Array<PackedScene> KeyCardsPrefabs { get; set; }
|
||||
[Export] public PackedScene ShroudPrefab { get; set; }
|
||||
[Export] public LootItem PointItemResource { get; set; }
|
||||
|
||||
|
||||
[ExportGroup("Chances")]
|
||||
[Export] public double ChestChance { get; set; }
|
||||
[Export] public float EnemyDropChance { get; set; }
|
||||
|
|
|
|||
15
Scripts/Utils/QueueExtensions.cs
Normal file
15
Scripts/Utils/QueueExtensions.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Cirno.Scripts.Utils;
|
||||
|
||||
public static class QueueExtensions
|
||||
{
|
||||
public static Queue<T> EnqueueRange<T>(this Queue<T> queue, IEnumerable<T> items)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
queue.Enqueue(item);
|
||||
}
|
||||
return queue;
|
||||
}
|
||||
}
|
||||
1
Scripts/Utils/QueueExtensions.cs.uid
Normal file
1
Scripts/Utils/QueueExtensions.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cttwp4gofabln
|
||||
Loading…
Add table
Add a link
Reference in a new issue