forked from Shardstone/trail-into-darkness
Added part of the encounter triggering system
This commit is contained in:
@@ -1,19 +1,43 @@
|
||||
using Jovian.EncounterSystem;
|
||||
using Nox.Game.UI;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nox.Game {
|
||||
public class EncounterView : IMenuView{
|
||||
private readonly EncounterPrefabs encounterPrefabs;
|
||||
private readonly IEncounterKind encounterKind;
|
||||
private IEncounter currentEncounter;
|
||||
|
||||
public void Initialize() {
|
||||
throw new System.NotImplementedException();
|
||||
private Dictionary<IEncounterKind, EncounterReference> encounterKindToPrefab = new ();
|
||||
private IEncounterKind currentActiveKind;
|
||||
|
||||
public EncounterView(EncounterPrefabs encounterPrefabs) {
|
||||
this.encounterPrefabs = encounterPrefabs;
|
||||
}
|
||||
|
||||
public void SetCurrentEncounter(IEncounter encounter) {
|
||||
currentEncounter = encounter;
|
||||
if(!encounterKindToPrefab.TryGetValue(encounter.EncounterDefinition.Kind, out var encounterReference)) {
|
||||
encounterReference = Object.Instantiate(encounterPrefabs.encounterSets.FirstOrDefault(e => e.encounterKind == encounterKind)?.encounterReference);
|
||||
encounterKindToPrefab.Add(encounter.EncounterDefinition.Kind, encounterReference);
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize() { }
|
||||
|
||||
public void Show() {
|
||||
throw new System.NotImplementedException();
|
||||
currentActiveKind = currentEncounter.EncounterDefinition.Kind;
|
||||
PopulateEncounterReference();
|
||||
encounterKindToPrefab[currentActiveKind].gameObject.SetActive(true);
|
||||
}
|
||||
private void PopulateEncounterReference() {
|
||||
}
|
||||
|
||||
public void Hide() {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
public void Tick() {
|
||||
throw new System.NotImplementedException();
|
||||
encounterKindToPrefab[currentActiveKind].gameObject.SetActive(false);
|
||||
}
|
||||
public void Tick() { }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user