Enemy spawning update
- spawning is now taken care by the actual gamescene based on the zone data, instead of network manager - each zone data now have a list of possible enemies for that specific zone
This commit is contained in:
parent
fd0e2d7d19
commit
5569dd2b06
@ -381,6 +381,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
zone: {fileID: 11400000, guid: c9e3493130481e84e926fcce855a1ecb, type: 2}
|
zone: {fileID: 11400000, guid: c9e3493130481e84e926fcce855a1ecb, type: 2}
|
||||||
onGameSceneLoaded: {fileID: 11400000, guid: ddf05d34e629c254f998bd0db6da0481, type: 2}
|
onGameSceneLoaded: {fileID: 11400000, guid: ddf05d34e629c254f998bd0db6da0481, type: 2}
|
||||||
|
onSpawnRiftRequest: {fileID: 11400000, guid: 8e3f503514db5934d965671de2695496, type: 2}
|
||||||
spawnPoints:
|
spawnPoints:
|
||||||
- {fileID: 189844204}
|
- {fileID: 189844204}
|
||||||
- {fileID: 1188928028}
|
- {fileID: 1188928028}
|
||||||
|
@ -493,6 +493,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
zone: {fileID: 11400000, guid: e36ea6b9660389f45a604d7075de7d4b, type: 2}
|
zone: {fileID: 11400000, guid: e36ea6b9660389f45a604d7075de7d4b, type: 2}
|
||||||
onGameSceneLoaded: {fileID: 11400000, guid: ddf05d34e629c254f998bd0db6da0481, type: 2}
|
onGameSceneLoaded: {fileID: 11400000, guid: ddf05d34e629c254f998bd0db6da0481, type: 2}
|
||||||
|
onSpawnRiftRequest: {fileID: 11400000, guid: 8e3f503514db5934d965671de2695496, type: 2}
|
||||||
spawnPoints:
|
spawnPoints:
|
||||||
- {fileID: 1965174616}
|
- {fileID: 1965174616}
|
||||||
- {fileID: 1163712637}
|
- {fileID: 1163712637}
|
||||||
|
@ -381,6 +381,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
zone: {fileID: 11400000, guid: 5b6467b6a4765974a8a36e80982c566e, type: 2}
|
zone: {fileID: 11400000, guid: 5b6467b6a4765974a8a36e80982c566e, type: 2}
|
||||||
onGameSceneLoaded: {fileID: 11400000, guid: ddf05d34e629c254f998bd0db6da0481, type: 2}
|
onGameSceneLoaded: {fileID: 11400000, guid: ddf05d34e629c254f998bd0db6da0481, type: 2}
|
||||||
|
onSpawnRiftRequest: {fileID: 11400000, guid: 8e3f503514db5934d965671de2695496, type: 2}
|
||||||
spawnPoints:
|
spawnPoints:
|
||||||
- {fileID: 189844204}
|
- {fileID: 189844204}
|
||||||
- {fileID: 1188928028}
|
- {fileID: 1188928028}
|
||||||
|
@ -15,4 +15,5 @@ MonoBehaviour:
|
|||||||
zoneName: Dayard
|
zoneName: Dayard
|
||||||
levelName: 4-Dayard
|
levelName: 4-Dayard
|
||||||
isHostileZone: 1
|
isHostileZone: 1
|
||||||
|
possibleEnemies: 0400000002000000
|
||||||
spawnPoints: []
|
spawnPoints: []
|
||||||
|
@ -15,3 +15,5 @@ MonoBehaviour:
|
|||||||
zoneName: Skellyard
|
zoneName: Skellyard
|
||||||
levelName: 4-Skellyard
|
levelName: 4-Skellyard
|
||||||
isHostileZone: 1
|
isHostileZone: 1
|
||||||
|
possibleEnemies: 0000000001000000
|
||||||
|
spawnPoints: []
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
using static GameConstants.EnemySpawning;
|
||||||
|
|
||||||
public static class GameConstants
|
public static class GameConstants
|
||||||
{
|
{
|
||||||
public static class PlayerPrefsKeys
|
public static class PlayerPrefsKeys
|
||||||
@ -37,53 +39,97 @@ public static class GameConstants
|
|||||||
|
|
||||||
public static class CharacterBalancing
|
public static class CharacterBalancing
|
||||||
{
|
{
|
||||||
public static int StatPointsPerLevel = 1;
|
public const int StatPointsPerLevel = 1;
|
||||||
|
|
||||||
public static float SoloCheatDeathHealthPercent = 0.5f;
|
public const float SoloCheatDeathHealthPercent = 0.5f;
|
||||||
public static float SoloCheatDeathInvulnerabilityDuration = 3f;
|
public const float SoloCheatDeathInvulnerabilityDuration = 3f;
|
||||||
|
|
||||||
public static float GroupBleedOutDuration = 30f;
|
public const float GroupBleedOutDuration = 30f;
|
||||||
|
|
||||||
public static float ReviveTriggerRadius = 3f;
|
public const float ReviveTriggerRadius = 3f;
|
||||||
public static float ReviveSpeed = 1f;
|
public const float ReviveSpeed = 1f;
|
||||||
public static float ReviveTime = 5f;
|
public const float ReviveTime = 5f;
|
||||||
public static float ReviveHealthPercent = 0.5f;
|
public const float ReviveHealthPercent = 0.5f;
|
||||||
|
|
||||||
public static float PercentageStatScaleForMinions = 0.8f;
|
public const float PercentageStatScaleForMinions = 0.8f;
|
||||||
}
|
}
|
||||||
public static class GameBalancing
|
public static class GameBalancing
|
||||||
{
|
{
|
||||||
public static int HealthIntoExperienceMultiplier = 1;
|
public const int HealthIntoExperienceMultiplier = 1;
|
||||||
|
|
||||||
public static int MinimumNumberOfWavesPerRift = 3;
|
public const int MinimumNumberOfWavesPerRift = 3;
|
||||||
public static int MaximumNumberOfWavesPerRift = 5;
|
public const int MaximumNumberOfWavesPerRift = 5;
|
||||||
|
|
||||||
public static int MinimumQuantityAngrySkelly = 2;
|
public const int MinimumQuantityAngrySkelly = 2;
|
||||||
public static int MaximumQuantityAngrySkelly = 5;
|
public const int MaximumQuantityAngrySkelly = 5;
|
||||||
|
|
||||||
public static int MinimumQuantitySkellyMage = 2;
|
public const int MinimumQuantitySkellyMage = 2;
|
||||||
public static int MaximumQuantitySkellyMage = 5;
|
public const int MaximumQuantitySkellyMage = 5;
|
||||||
|
|
||||||
public static int MinimumQuantityVineGolem = 2;
|
public const int MinimumQuantityVineGolem = 2;
|
||||||
public static int MaximumQuantityVineGolem = 5;
|
public const int MaximumQuantityVineGolem = 5;
|
||||||
|
|
||||||
public static int MinimumQuantityPolygonGolem = 2;
|
public const int MinimumQuantityPolygonGolem = 2;
|
||||||
public static int MaximumQuantityPolygonGolem = 5;
|
public const int MaximumQuantityPolygonGolem = 5;
|
||||||
|
|
||||||
public static int MinimumQuantityLich = 2;
|
public const int MinimumQuantityLich = 2;
|
||||||
public static int MaximumQuantityLich = 5;
|
public const int MaximumQuantityLich = 5;
|
||||||
|
|
||||||
public static float RiftDelayBetweenSpawns = 1f;
|
public const float RiftStartSpawningDelay = 1.5f;
|
||||||
|
public const float RiftDelayBetweenSpawns = 1f;
|
||||||
|
|
||||||
public static float BossTargetLockInPhaseDuration = 6f;
|
public const float BossTargetLockInPhaseDuration = 6f;
|
||||||
|
|
||||||
public static float BossSearchForNewTargetLockInDuration = 6f;
|
public const float BossSearchForNewTargetLockInDuration = 6f;
|
||||||
|
|
||||||
public static float PermaDeathInfoTime = 2f;
|
public const float PermaDeathInfoTime = 2f;
|
||||||
|
|
||||||
|
public static int GetMinimumQuantityByEnemyID(EnemyID id)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case EnemyID.AngrySkelly:
|
||||||
|
return MinimumQuantityAngrySkelly;
|
||||||
|
case EnemyID.SkellyMage:
|
||||||
|
return MinimumQuantitySkellyMage;
|
||||||
|
case EnemyID.VineGolem:
|
||||||
|
return MinimumQuantityVineGolem;
|
||||||
|
case EnemyID.PolygonGolem:
|
||||||
|
return MinimumQuantityPolygonGolem;
|
||||||
|
case EnemyID.Lich:
|
||||||
|
return MinimumQuantityLich;
|
||||||
|
case EnemyID.Count:
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static int GetMaximumQuantityByEnemyID(EnemyID id)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case EnemyID.AngrySkelly:
|
||||||
|
return MaximumQuantityAngrySkelly;
|
||||||
|
case EnemyID.SkellyMage:
|
||||||
|
return MaximumQuantitySkellyMage;
|
||||||
|
case EnemyID.VineGolem:
|
||||||
|
return MaximumQuantityVineGolem;
|
||||||
|
case EnemyID.PolygonGolem:
|
||||||
|
return MaximumQuantityPolygonGolem;
|
||||||
|
case EnemyID.Lich:
|
||||||
|
return MaximumQuantityLich;
|
||||||
|
case EnemyID.Count:
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
public static class EnemySpawning
|
public static class EnemySpawning
|
||||||
{
|
{
|
||||||
|
[System.Serializable]
|
||||||
public enum EnemyID
|
public enum EnemyID
|
||||||
{
|
{
|
||||||
AngrySkelly = 0,
|
AngrySkelly = 0,
|
||||||
@ -110,30 +156,30 @@ public static class GameConstants
|
|||||||
{
|
{
|
||||||
#region Network Event Codes
|
#region Network Event Codes
|
||||||
|
|
||||||
public static byte JobSelection = 112;
|
public const byte JobSelection = 112;
|
||||||
public static byte CancelChangeLevelVoted = 114;
|
public const byte CancelChangeLevelVoted = 114;
|
||||||
public static byte ChangeLevelVoted = 115;
|
public const byte ChangeLevelVoted = 115;
|
||||||
public static byte LoadLevelStarting = 116;
|
public const byte LoadLevelStarting = 116;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class NetworkPropertyKeys
|
public static class NetworkPropertyKeys
|
||||||
{
|
{
|
||||||
public static string AvailableJobsKey = "availableJobs";
|
public const string AvailableJobsKey = "availableJobs";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Sizes
|
public static class Sizes
|
||||||
{
|
{
|
||||||
public static int TotalEquipmentSlots = 6;
|
public const int TotalEquipmentSlots = 6;
|
||||||
public static int TotalInventorySlots = 18;
|
public const int TotalInventorySlots = 18;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Scenes
|
public static class Scenes
|
||||||
{
|
{
|
||||||
public static string HuntersInn = "4-RiftHuntersInn";
|
public const string HuntersInn = "4-RiftHuntersInn";
|
||||||
public static string Skellyard = "4-Skellyard";
|
public const string Skellyard = "4-Skellyard";
|
||||||
public static string Dayard = "4-Dayard";
|
public const string Dayard = "4-Dayard";
|
||||||
|
|
||||||
|
|
||||||
public static string GetSceneNameByZoneName(string zoneName)
|
public static string GetSceneNameByZoneName(string zoneName)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using Photon.Pun;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -6,8 +7,11 @@ public class GameScene : MonoBehaviour
|
|||||||
{
|
{
|
||||||
[SerializeField] private ZoneData zone;
|
[SerializeField] private ZoneData zone;
|
||||||
[SerializeField] private GameEvent_ZoneData onGameSceneLoaded;
|
[SerializeField] private GameEvent_ZoneData onGameSceneLoaded;
|
||||||
|
[SerializeField] private GameEvent_RiftSettings onSpawnRiftRequest;
|
||||||
[SerializeField] private List<Transform> spawnPoints = new List<Transform>();
|
[SerializeField] private List<Transform> spawnPoints = new List<Transform>();
|
||||||
|
|
||||||
|
RiftSettings riftSettings = new RiftSettings();
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
zone.spawnPoints = spawnPoints;
|
zone.spawnPoints = spawnPoints;
|
||||||
@ -17,6 +21,26 @@ public class GameScene : MonoBehaviour
|
|||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
if (PhotonNetwork.LocalPlayer.IsMasterClient && zone.isHostileZone)
|
||||||
|
StartCoroutine(SpawnEnemiesWithDelay(zone));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerator SpawnEnemiesWithDelay(ZoneData zoneData)
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(GameConstants.GameBalancing.RiftStartSpawningDelay);
|
||||||
|
|
||||||
|
riftSettings.zoneData = zoneData;
|
||||||
|
riftSettings.numberOfWaves = Random.Range(GameConstants.GameBalancing.MinimumNumberOfWavesPerRift, GameConstants.GameBalancing.MaximumNumberOfWavesPerRift);
|
||||||
|
riftSettings.riftIndex = Random.Range(0, 5);
|
||||||
|
riftSettings.enemyIndexes_Quantity = new Dictionary<int, int>();
|
||||||
|
riftSettings.bossIndex = (int)zone.possibleEnemies[Random.Range(0, zone.possibleEnemies.Count)];
|
||||||
|
|
||||||
|
for (int i = 0; i < zone.possibleEnemies.Count; i++)
|
||||||
|
{
|
||||||
|
riftSettings.enemyIndexes_Quantity.Add((int)zone.possibleEnemies[i], Random.Range(GameConstants.GameBalancing.GetMinimumQuantityByEnemyID(zone.possibleEnemies[i]), GameConstants.GameBalancing.GetMaximumQuantityByEnemyID(zone.possibleEnemies[i])));
|
||||||
|
}
|
||||||
|
|
||||||
|
onSpawnRiftRequest.Raise(riftSettings);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,8 +100,6 @@ public class NetworkManager : MonoBehaviourPunCallbacks, IOnEventCallback
|
|||||||
{
|
{
|
||||||
ClearVotes();
|
ClearVotes();
|
||||||
StartCoroutine(SpawnCharacterWithDelay());
|
StartCoroutine(SpawnCharacterWithDelay());
|
||||||
if (PhotonNetwork.LocalPlayer.IsMasterClient && zoneData.isHostileZone)
|
|
||||||
StartCoroutine(SpawnEnemiesWithDelay(zoneData));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator SpawnCharacterWithDelay()
|
public IEnumerator SpawnCharacterWithDelay()
|
||||||
@ -140,7 +138,7 @@ public class NetworkManager : MonoBehaviourPunCallbacks, IOnEventCallback
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
/*
|
||||||
public IEnumerator SpawnEnemiesWithDelay(ZoneData zoneData)
|
public IEnumerator SpawnEnemiesWithDelay(ZoneData zoneData)
|
||||||
{
|
{
|
||||||
yield return new WaitForSeconds(1f);
|
yield return new WaitForSeconds(1f);
|
||||||
@ -160,7 +158,7 @@ public class NetworkManager : MonoBehaviourPunCallbacks, IOnEventCallback
|
|||||||
},
|
},
|
||||||
bossIndex = Random.Range(0, (int)GameConstants.EnemySpawning.EnemyID.Count)
|
bossIndex = Random.Range(0, (int)GameConstants.EnemySpawning.EnemyID.Count)
|
||||||
}); ;
|
}); ;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public override void OnPlayerEnteredRoom(Player newPlayer)
|
public override void OnPlayerEnteredRoom(Player newPlayer)
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ using Kryz.CharacterStats;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using static GameConstants.EnemySpawning;
|
||||||
|
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
[CreateAssetMenu(fileName = "ZoneData", menuName = "RiftMayhem/Settings/Zones/ZoneData", order = 0)]
|
[CreateAssetMenu(fileName = "ZoneData", menuName = "RiftMayhem/Settings/Zones/ZoneData", order = 0)]
|
||||||
@ -14,6 +15,8 @@ public class ZoneData : ScriptableObject
|
|||||||
public string levelName;
|
public string levelName;
|
||||||
[Header("IsHostileZone:")]
|
[Header("IsHostileZone:")]
|
||||||
public bool isHostileZone = true;
|
public bool isHostileZone = true;
|
||||||
|
[Header("EnemyIDs:")]
|
||||||
|
public List<EnemyID> possibleEnemies = new List<EnemyID>();
|
||||||
|
|
||||||
[Header("Runtime Data:")]
|
[Header("Runtime Data:")]
|
||||||
public List<Transform> spawnPoints = new List<Transform>();
|
public List<Transform> spawnPoints = new List<Transform>();
|
||||||
|
@ -94,7 +94,7 @@ Material:
|
|||||||
- _Mode: 0
|
- _Mode: 0
|
||||||
- _OcclusionStrength: 1
|
- _OcclusionStrength: 1
|
||||||
- _Parallax: 0.02
|
- _Parallax: 0.02
|
||||||
- _Rotation: 7.045085
|
- _Rotation: 0.74223155
|
||||||
- _SmoothnessTextureChannel: 0
|
- _SmoothnessTextureChannel: 0
|
||||||
- _SpecularHighlights: 1
|
- _SpecularHighlights: 1
|
||||||
- _SrcBlend: 1
|
- _SrcBlend: 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user