Implement enemy spawning and following waypoints
This commit is contained in:
12
Assets/Scripts/Data/Enemy.cs
Normal file
12
Assets/Scripts/Data/Enemy.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
[CreateAssetMenu(fileName = "Enemy", menuName = "Data/Enemy")]
|
||||
public class Enemy : ScriptableObject
|
||||
{
|
||||
[SerializeField]
|
||||
public int health;
|
||||
}
|
||||
11
Assets/Scripts/Data/Enemy.cs.meta
Normal file
11
Assets/Scripts/Data/Enemy.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fbf9bdf5c9924664eaf24e1e5b44fbce
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
11
Assets/Scripts/Data/Level.cs
Normal file
11
Assets/Scripts/Data/Level.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Sirenix.OdinInspector;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "Level", menuName = "Data/Level")]
|
||||
public class Level : ScriptableObject
|
||||
{
|
||||
[SerializeField]
|
||||
public Wave[] waves = new Wave[0];
|
||||
}
|
||||
11
Assets/Scripts/Data/Level.cs.meta
Normal file
11
Assets/Scripts/Data/Level.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6113d1f06beb6a24cb28f2425b7ea301
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
27
Assets/Scripts/Data/SpawnInformation.cs
Normal file
27
Assets/Scripts/Data/SpawnInformation.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class SpawnInformation
|
||||
{
|
||||
[SerializeField]
|
||||
public GameObject prefab;
|
||||
|
||||
[SerializeField]
|
||||
public Vector3 position;
|
||||
|
||||
[SerializeField]
|
||||
public Action<GameObject> onSpawned;
|
||||
|
||||
public SpawnInformation(
|
||||
GameObject prefab,
|
||||
Vector3 position,
|
||||
Action<GameObject> onSpawned)
|
||||
{
|
||||
this.prefab = prefab;
|
||||
this.position = position;
|
||||
this.onSpawned = onSpawned;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Data/SpawnInformation.cs.meta
Normal file
11
Assets/Scripts/Data/SpawnInformation.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30cb692399aec2148bec8ce075f3cac8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
26
Assets/Scripts/Data/Wave.cs
Normal file
26
Assets/Scripts/Data/Wave.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Sirenix.OdinInspector;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class Wave
|
||||
{
|
||||
[HorizontalGroup("Split", width: 130)]
|
||||
[VerticalGroup("Split/Left")]
|
||||
[Title("Time To Next Wave")]
|
||||
[HideLabel]
|
||||
[SerializeField]
|
||||
public float timeToNextWave = 60;
|
||||
|
||||
[Title("Time To Next Group")]
|
||||
[HideLabel]
|
||||
[VerticalGroup("Split/Left")]
|
||||
[SerializeField]
|
||||
public float timeToNextGroup = 1;
|
||||
|
||||
[VerticalGroup("Split/Right")]
|
||||
[SerializeField]
|
||||
public WaveGroup[] groups = new WaveGroup[0];
|
||||
}
|
||||
11
Assets/Scripts/Data/Wave.cs.meta
Normal file
11
Assets/Scripts/Data/Wave.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00d898c9ee1f3f543853c351aa4de552
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
35
Assets/Scripts/Data/WaveGroup.cs
Normal file
35
Assets/Scripts/Data/WaveGroup.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Sirenix.OdinInspector;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class WaveGroup
|
||||
{
|
||||
[SerializeField]
|
||||
[AssetsOnly]
|
||||
[Required]
|
||||
public GameObject prefab;
|
||||
|
||||
[SerializeField]
|
||||
[Range(1, 30)]
|
||||
public int count = 1;
|
||||
|
||||
[SerializeField]
|
||||
[Range(0, 30)]
|
||||
[LabelText("Time to next")]
|
||||
public float timeToNext = 1;
|
||||
|
||||
//[LabelText("1")]
|
||||
//[HorizontalGroup(Title = "Waypoint group")]
|
||||
//public bool inWaypointGroup1;
|
||||
|
||||
//[LabelText("2")]
|
||||
//[HorizontalGroup]
|
||||
//public bool inWaypointGroup2;
|
||||
|
||||
//[LabelText("3")]
|
||||
//[HorizontalGroup]
|
||||
//public bool inWaypointGroup3;
|
||||
}
|
||||
11
Assets/Scripts/Data/WaveGroup.cs.meta
Normal file
11
Assets/Scripts/Data/WaveGroup.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9b63d2d9d8d3ae43b8bb7d8c8fc8e82
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user