Added enemySpawner
This commit is contained in:
parent
61c1c81dd5
commit
9b24f85783
|
@ -11851,6 +11851,7 @@ GameObject:
|
||||||
- component: {fileID: 1529264662}
|
- component: {fileID: 1529264662}
|
||||||
- component: {fileID: 1529264661}
|
- component: {fileID: 1529264661}
|
||||||
- component: {fileID: 1529264660}
|
- component: {fileID: 1529264660}
|
||||||
|
- component: {fileID: 1529264665}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: MainCamera
|
m_Name: MainCamera
|
||||||
m_TagString: MainCamera
|
m_TagString: MainCamera
|
||||||
|
@ -12010,6 +12011,29 @@ Transform:
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &1529264665
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1529264659}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 8a592fac78e06964b863b67047a446a1, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
Wave: 0
|
||||||
|
difficulty: 1
|
||||||
|
difficultyIncreasePerWave: 0.75
|
||||||
|
WaveTime: 5
|
||||||
|
enemyDifficulties: []
|
||||||
|
SpawnRadius: 17.8
|
||||||
|
NumEnemies: 6
|
||||||
|
players:
|
||||||
|
- {fileID: 1254139629}
|
||||||
|
- {fileID: 1579580564}
|
||||||
|
enemyList: []
|
||||||
--- !u!1 &1530488094
|
--- !u!1 &1530488094
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -20,6 +20,7 @@ public class NewBehaviourScript : MonoBehaviour
|
||||||
[SerializeField] private List<float> enemyDifficulties;
|
[SerializeField] private List<float> enemyDifficulties;
|
||||||
[SerializeField] private float SpawnRadius = 10;
|
[SerializeField] private float SpawnRadius = 10;
|
||||||
[SerializeField] private int NumEnemies = 6;
|
[SerializeField] private int NumEnemies = 6;
|
||||||
|
[SerializeField] private GameObject[] players;
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
private bool nextWaveRequested = false;
|
private bool nextWaveRequested = false;
|
||||||
|
@ -84,6 +85,8 @@ public class NewBehaviourScript : MonoBehaviour
|
||||||
{
|
{
|
||||||
GameObject enemy = Instantiate(decendingList[i].prefabs[UnityEngine.Random.Range(0, decendingList[i].prefabs.Length)], GetRandomPointOnCircle(mainCam.transform.position, SpawnRadius), Quaternion.identity, SpawnedEnenmyHolder.transform);
|
GameObject enemy = Instantiate(decendingList[i].prefabs[UnityEngine.Random.Range(0, decendingList[i].prefabs.Length)], GetRandomPointOnCircle(mainCam.transform.position, SpawnRadius), Quaternion.identity, SpawnedEnenmyHolder.transform);
|
||||||
difficulty -= decendingList[i].Difficulty;
|
difficulty -= decendingList[i].Difficulty;
|
||||||
|
|
||||||
|
enemy.GetComponent<EnemyPathFinding>().targets = players.Select(x=>x.transform).ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,6 +99,8 @@ public class NewBehaviourScript : MonoBehaviour
|
||||||
var enemyToSpawn = validEnemies[UnityEngine.Random.Range(0, validEnemies.Length)];
|
var enemyToSpawn = validEnemies[UnityEngine.Random.Range(0, validEnemies.Length)];
|
||||||
difficulty -= enemyToSpawn.Difficulty;
|
difficulty -= enemyToSpawn.Difficulty;
|
||||||
GameObject enemy = Instantiate(enemyToSpawn.prefabs[UnityEngine.Random.Range(0, enemyToSpawn.prefabs.Length)], GetRandomPointOnCircle(mainCam.transform.position, SpawnRadius), Quaternion.identity, SpawnedEnenmyHolder.transform);
|
GameObject enemy = Instantiate(enemyToSpawn.prefabs[UnityEngine.Random.Range(0, enemyToSpawn.prefabs.Length)], GetRandomPointOnCircle(mainCam.transform.position, SpawnRadius), Quaternion.identity, SpawnedEnenmyHolder.transform);
|
||||||
|
|
||||||
|
enemy.GetComponent<EnemyPathFinding>().targets = players.Select(x => x.transform).ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ using UnityEngine.AI;
|
||||||
|
|
||||||
public class EnemyPathFinding : MonoBehaviour
|
public class EnemyPathFinding : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] private Transform[] targets;
|
[SerializeField] public Transform[] targets;
|
||||||
|
|
||||||
[SerializeField] private float ropeDistCheck = 1f;
|
[SerializeField] private float ropeDistCheck = 1f;
|
||||||
[SerializeField] private LayerMask ropeCheckMask;
|
[SerializeField] private LayerMask ropeCheckMask;
|
||||||
|
|
|
@ -169,8 +169,8 @@ InputManager:
|
||||||
m_Name: bruh_v
|
m_Name: bruh_v
|
||||||
descriptiveName:
|
descriptiveName:
|
||||||
descriptiveNegativeName:
|
descriptiveNegativeName:
|
||||||
negativeButton:
|
negativeButton: w
|
||||||
positiveButton:
|
positiveButton: s
|
||||||
altNegativeButton:
|
altNegativeButton:
|
||||||
altPositiveButton:
|
altPositiveButton:
|
||||||
gravity: 0
|
gravity: 0
|
||||||
|
|
Loading…
Reference in New Issue