Commit 165b4dbd authored by LasseKau's avatar LasseKau
Browse files

update

-
parent 3b9de856
fileFormatVersion: 2
guid: c0639804bb068664ea38c54785106790
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 00c8a2f2c62c74148a533b52691db654
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 77f6e5e04860e914480b5d1eff91bcea
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a3d3275b7124b9b4f9c8c7a537301fd9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: c274af62be6c928438cf3036068ee9b5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: b2c7b944d5c8d7f4fbedd632022ff4f6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 92fd32c7c73aedc48bed0c38a1158320
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 716db083414a5db418f9ec64f90b8b70
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 7902725a0ade57f46868baa1d6e0b146
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 3ed97fe7851cc8e4bafe6be03b7e36e4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class tttt : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
......@@ -18,9 +18,9 @@ public class SensorTriggeredBehaviorManager : MonoBehaviour
[SerializeField]
private AIBehavior triggeredBehavior;
//wallTriggeredBehavior;
[SerializeField]
/* [SerializeField]
private AIBehavior wallTriggeredBehavior;
*/
//
......@@ -69,12 +69,14 @@ public class SensorTriggeredBehaviorManager : MonoBehaviour
Debug.Log("trigger");
return;
}
/*
if (this.sensors.Any(x => x.IsWallTriggered))
{
this.BeginWallTriggeredState();
Debug.Log("walltrigger");
return;
}
*/
}
/* private void CheckSensorsWallTriggered()
{
......@@ -113,7 +115,7 @@ public class SensorTriggeredBehaviorManager : MonoBehaviour
}
/*
private void BeginWallTriggeredState()
{
this.inWallTriggeredState = true;
......@@ -129,7 +131,7 @@ public class SensorTriggeredBehaviorManager : MonoBehaviour
}
}
*/
private void BeginNormalState()
{
this.inTriggeredState = false;
......@@ -142,5 +144,5 @@ public class SensorTriggeredBehaviorManager : MonoBehaviour
}
public bool InTriggeredState { get { return this.inTriggeredState; } }
public bool InWallTriggeredState { get { return this.inWallTriggeredState; } }
//public bool InWallTriggeredState { get { return this.inWallTriggeredState; } }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RandomGnome : MonoBehaviour
{
/*
public enum SpawnState { SPAWNING, WAITING, COUNTING };
[System.Serializable]
public class Wave
{
public string name;
public Transform enemy;
public int count;
public float rate;
}
public Wave[] waves;
private int nextWave = 0;
//normal waves
public Transform[] spawnPoints;
public float timeBetweenWaves = 5f;
private float waveCountdown;
private float searchCD = 1f;
public Transform player;
public float minimumGap = 4.0F;
private SpawnState state = SpawnState.COUNTING;
*/
public Transform player;
public float minimumGap = 4.0F;
public Transform SpawnPosition;
public GameObject ObjectToCreate;
void Start()
{
/*if (spawnPoints.Length == 0)
{
Debug.LogError("no spawnpoints set.");
}
waveCountdown = timeBetweenWaves;
*/
}
void Update()
{
if (player)
{
Vector3 Gap = player.position - transform.position;
float distanceGap = Gap.sqrMagnitude;
if (distanceGap > minimumGap * minimumGap) //|| waveCountdown <= 0)
{
Debug.Log("over min dist");
SpawnObject();
// Do Something
/*
if (state != SpawnState.SPAWNING)
{
StartCoroutine(SpawnWave(waves[nextWave]));
Debug.Log("testspawnnn");
}
*/
}
void SpawnObject()
{
Instantiate(ObjectToCreate, SpawnPosition.position, SpawnPosition.rotation);
}
/*
if (state == SpawnState.WAITING)
{
if (EnemyisAlive() == false)
{
WaveCompleted();
}
else
{
return;
}
}
if (waveCountdown <= 0)
{
if (state != SpawnState.SPAWNING)
{
StartCoroutine(SpawnWave(waves[nextWave]));
}
}
else
{
waveCountdown -= Time.deltaTime;
}
}
void WaveCompleted()
{
// Debug.Log("Wave complete");
state = SpawnState.COUNTING;
waveCountdown = timeBetweenWaves;
if (nextWave + 1 > waves.Length - 1)
{
nextWave = 0;
// Debug.Log("all waves doned, do it all again");
}
else
{
nextWave++;
}
}
bool EnemyisAlive()
{
searchCD -= Time.deltaTime;
if (searchCD <= 0f)
{
searchCD = 1f;
if (GameObject.FindGameObjectsWithTag("Enemy").Length == 0)
{
return false;
}
}
return true;
}
IEnumerator SpawnWave(Wave _wave)
{
state = SpawnState.SPAWNING;
for (int i = 0; i < _wave.count; i++)
{
SpawnEnemy(_wave.enemy);
yield return new WaitForSeconds(1f / _wave.rate);
}
state = SpawnState.WAITING;
yield break;
}
void SpawnEnemy(Transform _enemy)
{
Transform _sp = spawnPoints[Random.Range(0, spawnPoints.Length)];
Instantiate(_enemy, _sp.position, _sp.rotation);
// Debug.Log("Enemy spawned: " + _enemy.name);
}
*/
}
}
}
fileFormatVersion: 2
guid: 16d3e92ea8c1587459cf3eea041130fa
guid: abcd13041a35687449df521cb6e6cedd
MonoImporter:
externalObjects: {}
serializedVersion: 2
......
......@@ -18,6 +18,7 @@ public class waveManager : MonoBehaviour
public Wave[] waves;
private int nextWave = 0;
//normal waves
public Transform[] spawnPoints;
public float timeBetweenWaves = 5f;
......@@ -116,4 +117,5 @@ public class waveManager : MonoBehaviour
Instantiate(_enemy, _sp.position, _sp.rotation);
// Debug.Log("Enemy spawned: " + _enemy.name);
}
}
fileFormatVersion: 2
guid: 4e4d7acc6167efe4087541e7f093da09
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 50ce542cd2ea2a04d82ec5eaca48a768
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 1840ea125981d0d48a3f550ce64a9801
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: b36bfd699e81a7242a49b27dc3f3cd4f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment