Changed creepling to be an array
This commit is contained in:
parent
eef09242a8
commit
3ae0de86ba
@ -248,7 +248,7 @@ MonoBehaviour:
|
|||||||
_renderLayer: Default
|
_renderLayer: Default
|
||||||
_position: {x: 0, y: 0}
|
_position: {x: 0, y: 0}
|
||||||
_scale: {x: 1, y: 1}
|
_scale: {x: 1, y: 1}
|
||||||
_waveConfig: {fileID: 11400000, guid: d8140ae36f1b7fd4fb1a57ab3dc69de4, type: 2}
|
_waveConfig: {fileID: 11400000, guid: 660102a48ad7d2244ab404cfc1f6a573, type: 2}
|
||||||
_startPopulation: 10
|
_startPopulation: 10
|
||||||
_startFood: 40
|
_startFood: 40
|
||||||
_startWood: 0
|
_startWood: 0
|
||||||
|
|||||||
23
Assets/Design/Levels/WaveConfig_Creeper_Test.asset
Normal file
23
Assets/Design/Levels/WaveConfig_Creeper_Test.asset
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: eb0795e326609f0499365f5b65c2b5cd, type: 3}
|
||||||
|
m_Name: WaveConfig_Creeper_Test
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_constantSpawn:
|
||||||
|
- _enemy: {fileID: 80204295746100150, guid: 1be769d6ef642314b8846bed35e7297c, type: 3}
|
||||||
|
_count: 20
|
||||||
|
_nestedGroupSpawn:
|
||||||
|
- groupSpawn:
|
||||||
|
- _enemy: {fileID: 80204295746100150, guid: 2def22091e1ff0d43abe2797c18a2fda, type: 3}
|
||||||
|
_count: 1
|
||||||
|
triggerTime: 0.5
|
||||||
|
_gameDuration: 1
|
||||||
8
Assets/Design/Levels/WaveConfig_Creeper_Test.asset.meta
Normal file
8
Assets/Design/Levels/WaveConfig_Creeper_Test.asset.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 660102a48ad7d2244ab404cfc1f6a573
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -104,8 +104,10 @@ MonoBehaviour:
|
|||||||
_attack_damage: 10
|
_attack_damage: 10
|
||||||
_attack_interval: 3
|
_attack_interval: 3
|
||||||
_enemy: {fileID: 0}
|
_enemy: {fileID: 0}
|
||||||
creeplings: {fileID: 80204295746100150, guid: 2419a879bd4e47d4fa8b30de0fcdde42, type: 3}
|
creeplings:
|
||||||
creeplingsCount: 3
|
- {fileID: 80204295746100150, guid: 2419a879bd4e47d4fa8b30de0fcdde42, type: 3}
|
||||||
|
- {fileID: 80204295746100150, guid: 2419a879bd4e47d4fa8b30de0fcdde42, type: 3}
|
||||||
|
- {fileID: 80204295746100150, guid: 2419a879bd4e47d4fa8b30de0fcdde42, type: 3}
|
||||||
--- !u!114 &5416582167583119277
|
--- !u!114 &5416582167583119277
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@ -5,23 +5,16 @@ using UnityEngine;
|
|||||||
public class Creeper : Opponent
|
public class Creeper : Opponent
|
||||||
{
|
{
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private GameObject creeplings;
|
private GameObject[] creeplings;
|
||||||
[SerializeField]
|
|
||||||
private int creeplingsCount = 3;
|
|
||||||
|
|
||||||
public override void Death()
|
public override void Death()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < creeplingsCount; i++)
|
for (int i = 0; i < creeplings.Length; i++)
|
||||||
{
|
|
||||||
SpawnCreeplings();
|
|
||||||
}
|
|
||||||
base.Death();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SpawnCreeplings()
|
|
||||||
{
|
{
|
||||||
float randomX = Random.Range(0f, 2f) + transform.position.x;
|
float randomX = Random.Range(0f, 2f) + transform.position.x;
|
||||||
Vector3 spawnPosition = new Vector3(randomX, transform.position.y, transform.position.z);
|
Vector3 spawnPosition = new Vector3(randomX, transform.position.y, transform.position.z);
|
||||||
GameObject creeplingsInstance = Instantiate(creeplings, spawnPosition, Quaternion.identity);
|
GameObject creeplingsInstance = Instantiate(creeplings[i], spawnPosition, Quaternion.identity);
|
||||||
|
}
|
||||||
|
base.Death();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user