- Turned multi job reward button click into a whole new content - Rift raids open up on multijob completion, allowing players to dive deep and take action into the rifts themselves
74 lines
2.2 KiB
C#
74 lines
2.2 KiB
C#
using Photon.Pun;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class RiftSpawner : MonoBehaviour
|
|
{
|
|
[Header("Rifts:")]
|
|
[SerializeField] private List<GameObject> riftPrefabs = new List<GameObject>();
|
|
|
|
[Header("Interactable Rifts:")]
|
|
[SerializeField] private List<GameObject> interactableRiftPrefabs = new List<GameObject>();
|
|
|
|
[Header("Listeners:")]
|
|
[SerializeField] private GameEventListener_RiftSettings onSpawnRiftRequest;
|
|
[SerializeField] private GameEventListener_JobInstance OnMultiJobBonusRiftReadyToSpawn;
|
|
|
|
GameObject spawnedRiftGO;
|
|
Rift spawnedRift;
|
|
InteractableRift spawnedInteractableRift;
|
|
public int lastUsedSpawnpoint;
|
|
ZoneData currentZoneData;
|
|
|
|
private void Awake()
|
|
{
|
|
DontDestroyOnLoad(this);
|
|
|
|
onSpawnRiftRequest.Response.AddListener(SpawnRiftOnRequest);
|
|
OnMultiJobBonusRiftReadyToSpawn.Response.AddListener(SpawnInteractableRift);
|
|
}
|
|
|
|
private void SpawnRiftOnRequest(RiftSettings riftSettings)
|
|
{
|
|
currentZoneData = riftSettings.zoneData;
|
|
|
|
spawnedRiftGO = PhotonNetwork.Instantiate("Rifts/" + riftPrefabs[riftSettings.riftIndex].name, riftSettings.zoneData.spawnPoints[Random.Range(0, riftSettings.zoneData.spawnPoints.Count)].position, Quaternion.identity);
|
|
|
|
spawnedRift = spawnedRiftGO.GetComponent<Rift>();
|
|
|
|
spawnedRift.InitializeRift(riftSettings, this);
|
|
|
|
spawnedRift.StartSpawning();
|
|
}
|
|
|
|
private void SpawnInteractableRift(JobInstance bonusRiftJob)
|
|
{
|
|
spawnedRiftGO = PhotonNetwork.Instantiate("Rifts/Interactables/" + interactableRiftPrefabs[(int)bonusRiftJob.bonusRiftType].name, currentZoneData.spawnPoints[lastUsedSpawnpoint].position, Quaternion.identity);
|
|
|
|
spawnedInteractableRift = spawnedRiftGO.GetComponent<InteractableRift>();
|
|
spawnedInteractableRift.bonusRiftInstance = bonusRiftJob;
|
|
}
|
|
}
|
|
|
|
[System.Serializable]
|
|
public class RiftSettings
|
|
{
|
|
public int riftIndex;
|
|
public Dictionary<int,int> enemyIndexes_Quantity;
|
|
public int numberOfWaves;
|
|
public int bossIndex;
|
|
public ZoneData zoneData;
|
|
}
|
|
|
|
|
|
[System.Serializable]
|
|
public enum RiftType
|
|
{
|
|
Blue = 0,
|
|
Green,
|
|
Yellow,
|
|
Purple,
|
|
Red,
|
|
Count
|
|
} |