Added more radio music, based on dungeon variant.

Redid vent code to work better and like work in general.
Knight animation now pauses for a second.
Knights no longer trigger the default scarlet vent animation.
Revenants now spawn at a vent if no knights exist.
This commit is contained in:
LadyAliceMargatroid 2025-01-15 20:41:48 -08:00
parent e28f3ca2db
commit f37cded831
14 changed files with 285 additions and 114 deletions

View file

@ -5,6 +5,8 @@ using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using DunGen;
using static LethalLevelLoader.ExtendedEvent;
using UnityEngine.AI;
namespace ScarletMansion {
@ -22,6 +24,13 @@ namespace ScarletMansion {
Instance = this;
}
public static bool WillSpawnOnSpawnPoint(){
if (Instance) {
return !Instance.disableNextKnightSpecialSpawn && Instance.spawnPoints.Count > 0;
}
return false;
}
public void OnDungeonComplete(Dungeon dungeon) {
var points = dungeon.GetComponentsInChildren<KnightSpawnPoint>();
spawnPoints = points.ToList();
@ -60,10 +69,29 @@ namespace ScarletMansion {
return item.index;
}
public Transform GetSpawnPointTransform(int index){
return spawnPoints[index].transform;
public KnightSpawnPoint GetSpawnPoint(int index){
return spawnPoints[index];
}
public void SpawnEnemyOnSpawnPoint(EnemyAI enemyAI, KnightSpawnPoint spawnPoint){
SpawnEnemyOnSpawnPoint(enemyAI, spawnPoint.transform.position, spawnPoint.transform.rotation);
spawnPoint.OnStop();
}
public void SpawnEnemyOnSpawnPoint(EnemyAI enemyAI, Vector3 position, Quaternion rotation){
enemyAI.transform.position = position;
enemyAI.transform.rotation = rotation;
enemyAI.serverPosition = position;
if (enemyAI.agent == null) enemyAI.agent = GetComponentInChildren<NavMeshAgent>();
enemyAI.agent.Warp(position);
if (enemyAI.IsOwner) {
enemyAI.SyncPositionToClients();
}
ScarletNetworkManager.Instance?.CreateSpawnAudioPrefabLocal(position);
}
}
}

View file

@ -16,6 +16,10 @@ namespace ScarletMansion.GamePatch.Managers {
public static ScarletGenericManager Instance { get; private set; }
[Header("Settings")]
public AudioClip[] radioAudioClips;
[Header("Debug")]
public List<Transform> roomsOfInterest;
public List<ScarletBedroom> bedrooms;
@ -42,7 +46,8 @@ namespace ScarletMansion.GamePatch.Managers {
}
void Update(){
if (!StartOfRound.Instance.IsServer) return;
if (!StartOfRound.Instance) return;
if (StartOfRound.Instance.IsServer) return;
if (selfDestroyTargets == null) return;
var time = Utility.GetTime();

View file

@ -10,7 +10,6 @@ using GameNetcodeStuff;
using ScarletMansion.GamePatch.Items;
using ScarletMansion.GamePatch;
using ScarletMansion.GamePatch.Components;
using static LethalLevelLoader.ExtendedEvent;
using ScarletMansion.GamePatch.Managers;
using ScarletMansion.Configs;
@ -306,7 +305,7 @@ namespace ScarletMansion {
public void CreateSpawnAudioPrefab(Vector3 positon, ulong playerId) {
CreateSpawnAudioPrefabServerRpc(positon, playerId);
CreateSpawnAudioPrefab(positon);
CreateSpawnAudioPrefabLocal(positon);
}
[ServerRpc(RequireOwnership = false)]
@ -317,10 +316,10 @@ namespace ScarletMansion {
[ClientRpc]
public void CreateSpawnAudioPrefabClientRpc(Vector3 position, ulong playerId){
if (StartOfRound.Instance.localPlayerController.actualClientId == playerId) return;
CreateSpawnAudioPrefab(position);
CreateSpawnAudioPrefabLocal(position);
}
private void CreateSpawnAudioPrefab(Vector3 position) {
public void CreateSpawnAudioPrefabLocal(Vector3 position) {
var copy = Instantiate(Assets.networkObjectList.yukariSpawnPrefab, position, Quaternion.identity);
var audioSource = copy.GetComponentInChildren<AudioSource>();
audioSource.time = 0.5f;