Changed available buildings to dictionary
This commit is contained in:
parent
cea045ae2c
commit
9b72751e15
|
@ -1,7 +1,5 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using AsteroidGame.Entities.Structures.Scripts;
|
using AsteroidGame.Entities.Structures.Scripts;
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
|
|
||||||
|
@ -23,7 +21,7 @@ namespace AsteroidGame.Handlers
|
||||||
|
|
||||||
#region Private
|
#region Private
|
||||||
|
|
||||||
private List<StructureBase> _availableStructures = new();
|
private Dictionary<int, StructureBase> _availableStructures = new();
|
||||||
[SerializeField] private Color colorCurrent;
|
[SerializeField] private Color colorCurrent;
|
||||||
private Camera _camera;
|
private Camera _camera;
|
||||||
[SerializeField] private List<StructureBase> activeStructures;
|
[SerializeField] private List<StructureBase> activeStructures;
|
||||||
|
@ -34,14 +32,16 @@ namespace AsteroidGame.Handlers
|
||||||
private MeshRenderer[] _ghostStructureMeshRenderers;
|
private MeshRenderer[] _ghostStructureMeshRenderers;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
protected override void OnEnable()
|
protected override void OnEnable()
|
||||||
{
|
{
|
||||||
base.OnEnable();
|
base.OnEnable();
|
||||||
|
for (int i = 0; i < availableStructuresObject.structureList.Count; i++)
|
||||||
|
{
|
||||||
|
_availableStructures.Add(i, availableStructuresObject.structureList[i]);
|
||||||
|
}
|
||||||
_camera = Camera.main;
|
_camera = Camera.main;
|
||||||
_buildPlane = new Plane(Vector3.up, Vector3.zero);
|
_buildPlane = new Plane(Vector3.up, Vector3.zero);
|
||||||
_availableStructures = availableStructuresObject.structureList;
|
|
||||||
activeStructures.Clear();
|
activeStructures.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ namespace AsteroidGame.Handlers
|
||||||
return Vector3.zero;
|
return Vector3.zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<StructureBase> GetAvailableStructures()
|
public Dictionary<int, StructureBase> GetAvailableStructures()
|
||||||
{
|
{
|
||||||
return _availableStructures;
|
return _availableStructures;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue