1
0
Fork 0

Randomized mob shooting

And other balancing
This commit is contained in:
Piegames 2018-04-24 21:07:32 +02:00
parent fdfc33e759
commit 69f013755e
4 changed files with 14 additions and 12 deletions

View file

@ -16,12 +16,12 @@ namespace Assets.Scripts.Entities {
} }
protected override void Start() { protected override void Start() {
base.Start();
SingleShot s = new SingleShot(this.gameObject, 8, 3, 8 ); SingleShot s = new SingleShot(this.gameObject, 8, 3, 8 );
s.SetRange(3); s.SetRange(3);
s.SetPrefab(bullet); s.SetPrefab(bullet);
s.SetSpawn(bulletSpawn); s.SetSpawn(bulletSpawn);
SetAttack(s); SetAttack(s);
base.Start();
} }
} }
} }

View file

@ -33,11 +33,11 @@ namespace Assets.Scripts.Entities {
victim = ply.gameObject; victim = ply.gameObject;
} }
if (attack != null)
nextAttackTime = Time.timeSinceLevelLoad + attack.GetCooldownTime() * (UnityEngine.Random.value + 0.5f);
} }
void Update() { void Update() {
if ( victim == null || attack == null ) { if ( victim == null || attack == null ) {
if ( objective != null ) { if ( objective != null ) {
Player ply = objective.GetPlayer(); Player ply = objective.GetPlayer();
@ -53,8 +53,8 @@ namespace Assets.Scripts.Entities {
RaycastHit2D hit = rh.Find(x => x.fraction != 0); RaycastHit2D hit = rh.Find(x => x.fraction != 0);
if ( hit.collider != null && hit.collider.gameObject == victim ) { if ( hit.collider != null && hit.collider.gameObject == victim ) {
Debug.Log("Attacking Player!!!"); Debug.Log("Attacking Player!!!");
attack.Attack(); attack.Attack();
nextAttackTime = Time.timeSinceLevelLoad + attack.GetCooldownTime(); nextAttackTime = Time.timeSinceLevelLoad + attack.GetCooldownTime() * (UnityEngine.Random.value + 0.25f);
} }
} }

View file

@ -16,12 +16,12 @@ namespace Assets.Scripts.Entities {
} }
protected override void Start() { protected override void Start() {
base.Start();
SingleShot s = new SingleShot(this.gameObject, 25, 4, 2); SingleShot s = new SingleShot(this.gameObject, 25, 4, 2);
s.SetRange(10); s.SetRange(10);
s.SetPrefab(bullet); s.SetPrefab(bullet);
s.SetSpawn(bulletSpawn); s.SetSpawn(bulletSpawn);
SetAttack(s); SetAttack(s);
base.Start();
} }
} }
} }

View file

@ -461,9 +461,11 @@ public class DungeonGenerator {
Objective o = null; Objective o = null;
int rand = UnityEngine.Random.Range(0, 7); int rand = UnityEngine.Random.Range(0, 8);
switch (rand) { switch (rand) {
case 0: { case 0:
case 7:
{
// Scorpion Attack!!!!: // Scorpion Attack!!!!:
List<GameObject> lg = new List<GameObject>(); List<GameObject> lg = new List<GameObject>();
int count = UnityEngine.Random.Range(1, ( int ) Math.Min(Mathf.Floor(r.GetSpawnpoints().Count), 4)); int count = UnityEngine.Random.Range(1, ( int ) Math.Min(Mathf.Floor(r.GetSpawnpoints().Count), 4));
@ -505,7 +507,7 @@ public class DungeonGenerator {
{ {
// Siders!!!!: // Siders!!!!:
List<GameObject> lg = new List<GameObject>(); List<GameObject> lg = new List<GameObject>();
int count = Math.Min(UnityEngine.Random.Range(1, (int)Mathf.Floor(r.GetSpawnpoints().Count)), 3); int count = Math.Min(UnityEngine.Random.Range(1, (int)Mathf.Floor(r.GetSpawnpoints().Count)), 5);
for (int c = 0; c < count; c++) for (int c = 0; c < count; c++)
{ {
lg.Add(enemyPrefabs[Entity.Entities.SPIDER]); lg.Add(enemyPrefabs[Entity.Entities.SPIDER]);