Ajout d'instructions pour la configuration de la vague d'ennemi
Changé le nom de classe de LevelConfig vers WaveConfig afin d'éviter une confusion avec le LevelEditor
This commit is contained in:
parent
d83f621c3e
commit
b57efc49a8
22
Assets/Editor/WaveConfigCustomInspector.cs
Normal file
22
Assets/Editor/WaveConfigCustomInspector.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace GatherAndDefend.LevelEditor
|
||||
{
|
||||
[CustomEditor(typeof(WaveConfig))]
|
||||
public class WaveConfigCustomInspector : Editor
|
||||
{
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.HelpBox(@"How to use :
|
||||
Créer élément de la liste ConstantSpawn.
|
||||
Drag l'ennemi choisi dans Enemy et insérer le nombre à créer dans Count
|
||||
Choisir la durée du jeux en terme de minutes dans GameDuration
|
||||
L'intervalle de création est déterminé d'après la durée du jeux et le nombre d'ennemi à créer
|
||||
|
||||
Importante consideration :
|
||||
- Il faut assigner au moins un ennemi avec un Count d'au moins 1 pour jouer.", MessageType.None);
|
||||
base.OnInspectorGUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Editor/WaveConfigCustomInspector.cs.meta
Normal file
11
Assets/Editor/WaveConfigCustomInspector.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c38e7df17e51a6448682caeaba0f29e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -220,3 +220,4 @@ MonoBehaviour:
|
||||
_renderLayer: Default
|
||||
_position: {x: 0, y: 0}
|
||||
_scale: {x: 1, y: 1}
|
||||
_waveConfig: {fileID: 11400000, guid: 21b0f85f7c746974db1e72f2df646f5d, type: 2}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(menuName = "Gather And Defend/Levels/LevelConfig")]
|
||||
public class LevelConfig : ScriptableObject
|
||||
[CreateAssetMenu(menuName = "Gather And Defend/Levels/WaveConfig")]
|
||||
public class WaveConfig : ScriptableObject
|
||||
{
|
||||
|
||||
[SerializeField]
|
||||
private List<EnemyType> _constantSpawn = new List<EnemyType>();
|
||||
[SerializeField]
|
||||
@ -1,4 +1,3 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
@ -6,8 +5,8 @@ public class WaveObserver : Singleton<WaveObserver>
|
||||
{
|
||||
private List<SpawnerTile> _subjects = new List<SpawnerTile>();
|
||||
private List<int> _copyConstantSpawn;
|
||||
private LevelConfig _levelConfig;
|
||||
public LevelConfig LevelConfig
|
||||
private WaveConfig _levelConfig;
|
||||
public WaveConfig LevelConfig
|
||||
{
|
||||
set
|
||||
{
|
||||
@ -29,14 +28,15 @@ public class WaveObserver : Singleton<WaveObserver>
|
||||
|
||||
public void NotifySpawned(SpawnerTile spawnerSubject)
|
||||
{
|
||||
if (spawnerSubject.Prefab.Equals(_levelConfig.ConstantSpawn[0].GetEnemyObject()))
|
||||
GameObject paramPrefab = spawnerSubject.Prefab;
|
||||
if (paramPrefab.Equals(_levelConfig.ConstantSpawn[0].GetEnemyObject()))
|
||||
{
|
||||
int currentCount = 0;
|
||||
for (int i = 0; i < _copyConstantSpawn.Count; i++)
|
||||
{
|
||||
if(_levelConfig.ConstantSpawn[i].GetEnemyObject() == spawnerSubject.Prefab)
|
||||
if(_levelConfig.ConstantSpawn[i].GetEnemyObject() == paramPrefab)
|
||||
{
|
||||
currentCount = _copyConstantSpawn[i]--;
|
||||
currentCount = _copyConstantSpawn[i] - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -44,7 +44,7 @@ public class WaveObserver : Singleton<WaveObserver>
|
||||
{
|
||||
foreach (SpawnerTile spawner in _subjects)
|
||||
{
|
||||
if (spawner.Prefab.Equals(spawnerSubject.Prefab))
|
||||
if (spawner.Prefab.Equals(paramPrefab))
|
||||
{
|
||||
spawner.StopSpawn();
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ namespace GatherAndDefend.LevelEditor
|
||||
[SerializeField]
|
||||
private List<TilemapData> _data = new List<TilemapData>();
|
||||
[SerializeField]
|
||||
private LevelConfig _waveConfig;
|
||||
private WaveConfig _waveConfig;
|
||||
public void SaveFromTilemap(Tilemap tilemap)
|
||||
{
|
||||
var data = new TilemapData();
|
||||
@ -26,7 +26,7 @@ namespace GatherAndDefend.LevelEditor
|
||||
|
||||
data.LoadToTilemap(tilemap);
|
||||
}
|
||||
public LevelConfig WaveConfig { get { return _waveConfig; } }
|
||||
public WaveConfig WaveConfig { get { return _waveConfig; } }
|
||||
|
||||
public IEnumerator<TilemapData> GetEnumerator()
|
||||
{
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user