diff --git a/GGJ17/Assets/LairCannon.cs b/GGJ17/Assets/LairCannon.cs new file mode 100644 index 0000000..df3e4f3 --- /dev/null +++ b/GGJ17/Assets/LairCannon.cs @@ -0,0 +1,33 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class LairCannon : MonoBehaviour { + + void OnParticleCollision(GameObject go) + { + Debug.Log("Blubl"); + if (go.tag.Equals("Ground")) + { + Debug.Log("Blubl" + go.transform.position); + Building_EnemyLair lair = GetComponentInParent(); + GameObject obj = Instantiate(lair.spawnPrefab); + obj.transform.position = go.transform.position + Vector3.up * 1.2f; + } + } + + public IEnumerator SpawnDrops(Building_EnemyLair lair, float startdelay) + { + yield return new WaitForSeconds(startdelay); + //rotate cannon to target + Vector3 firedirection = FindObjectOfType().transform.position - lair.transform.position; + transform.parent.rotation = Quaternion.LookRotation(firedirection, Vector3.up); + + ParticleSystem spwner = GetComponent(); + while (true) + { + yield return new WaitForSeconds(lair.spawnFrequence); + if (spwner) spwner.Emit(1); + } + } +} diff --git a/GGJ17/Assets/LairCannon.cs.meta b/GGJ17/Assets/LairCannon.cs.meta new file mode 100644 index 0000000..0c43631 --- /dev/null +++ b/GGJ17/Assets/LairCannon.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c4cbfbd9469aa8c48b96c66e71227c36 +timeCreated: 1485081293 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/GGJ17/Assets/Prefab/BuildingBlocks/Building_EnemyLair.prefab b/GGJ17/Assets/Prefab/BuildingBlocks/Building_EnemyLair.prefab index 6e4ed87..ccd750e 100644 Binary files a/GGJ17/Assets/Prefab/BuildingBlocks/Building_EnemyLair.prefab and b/GGJ17/Assets/Prefab/BuildingBlocks/Building_EnemyLair.prefab differ diff --git a/GGJ17/Assets/Script/Blocks/Building/Building_Barracks.cs b/GGJ17/Assets/Script/Blocks/Building/Building_Barracks.cs index c2a6dab..54b8e14 100644 --- a/GGJ17/Assets/Script/Blocks/Building/Building_Barracks.cs +++ b/GGJ17/Assets/Script/Blocks/Building/Building_Barracks.cs @@ -4,6 +4,11 @@ public class Building_Barracks : AbstractBaseBuilding { + public float EffectiveRange = 5; + public float AlertCheckIntervall = 1f; + public float AtackIntervall = 0.5f; + public bool isAlerted; + // Use this for initialization void Awake () { BuildingBlockInit bbi = new BuildingBlockInit(); @@ -11,4 +16,24 @@ void Awake () { bbi.sides = false; Init(bbi); } + + void Update() + { + if (!isAlerted) + { + Collider[] cc = Physics.OverlapBox(transform.position, new Vector3(EffectiveRange, 20, EffectiveRange)); + foreach(Collider c in cc) + { + if(c.tag == "Enemy") + { + + } + } + } + } + + public IEnumerator OnAlert() + { + yield return null; + } } diff --git a/GGJ17/Assets/Script/Blocks/Building/Building_EnemyLair.cs b/GGJ17/Assets/Script/Blocks/Building/Building_EnemyLair.cs index 52fc364..8ec5dcc 100644 --- a/GGJ17/Assets/Script/Blocks/Building/Building_EnemyLair.cs +++ b/GGJ17/Assets/Script/Blocks/Building/Building_EnemyLair.cs @@ -7,7 +7,7 @@ public class Building_EnemyLair : AbstractBuildingBlock { #region Instantiate public GameObject spawnPrefab; #endregion - public float spawnFrequence = 20; + public float spawnFrequence = 20, startDelay = 1; // Use this for initialization void Awake () { @@ -20,27 +20,10 @@ void Awake () { void Start() { - StartCoroutine(SpawnDrops()); + StartCoroutine(GetComponentInChildren().SpawnDrops(this, startDelay)); } - IEnumerator SpawnDrops() - { - ParticleSystem spwner = GetComponent(); - while (true) - { - yield return new WaitForSeconds(spawnFrequence); - if(spwner)spwner.Emit(1); - } - } - void OnParticleCollision(GameObject go) - { - Debug.Log("Blubl"); - if (go.tag.Equals("Ground")) - { - Debug.Log("Blubl" + go.transform.position); - GameObject obj = Instantiate(spawnPrefab); - obj.transform.position = go.transform.position + Vector3.up * 1.2f; - } - } + + } diff --git a/GGJ17/Assets/Script/WorldControl.meta b/GGJ17/Assets/Script/WorldControl.meta new file mode 100644 index 0000000..a651a32 --- /dev/null +++ b/GGJ17/Assets/Script/WorldControl.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 026ecd435f5e8484da51e65011b7b01b +folderAsset: yes +timeCreated: 1485043945 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: