From 7fd94449f5ed02016354d1d2fba0341f8deb5057 Mon Sep 17 00:00:00 2001 From: "LEM-II\\Ilja" <> Date: Sun, 22 Jan 2017 12:21:39 +0100 Subject: [PATCH 1/3] enemy lair --- GGJ17/Assets/LairCannon.cs | 33 ++++++++++++++++++ GGJ17/Assets/LairCannon.cs.meta | 12 +++++++ .../BuildingBlocks/Building_EnemyLair.prefab | Bin 81984 -> 83064 bytes .../Blocks/Building/Building_EnemyLair.cs | 25 +++---------- 4 files changed, 49 insertions(+), 21 deletions(-) create mode 100644 GGJ17/Assets/LairCannon.cs create mode 100644 GGJ17/Assets/LairCannon.cs.meta 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 6e4ed87d044c9fe41734c28c9bcdd2217090ac7d..ccd750ee3929f248bc6c067d090f779a321467b8 100644 GIT binary patch delta 1302 zcmYjR4NOy46h7y@S9ri<6f$CEr92R7;~e4`kuldFV3}qtRz|?+h(lxxNy8e}Wg{$7 zj4ai;0D06)bOX0(hGGQm7Km}7VFZ_mku5G`fn+sHT;e9t%_T%yx^qjJ-sHY>&v(x` z_uTKC`+{EGl24Zh5cL37eh2{RwC*7ZC50u0MQ<0wN;De9luLPY>kF0#E_r5Gy3hW; znEL#$g-6s=pT8-6x5*ED%FGQE+kJ|izpOh+>R0>Il#kVMn04QKZ!zvpRa^;9;w z8rlNors;Vx6F^IPw5_8n79QY&v*4$cI}(&4z^8HS%E)t#JFe>B2g2&(*vU+HOWn2v zum}KcaqNJ(c7D@aPr(pjZo){wm$$Kb>%lZIh>x*7Z#?K-wCce}m~Yii8-A43p{F!I ziu*0>Rd+WT)1l`H?9hPS=Buj#y$+y{?8qI=^>w#vy5EN(!d@Vq-!$Xynb22*K?o6M zC!GWwZt_&Ptam|80C18{0*<@%Bhr!|-K10kbU-43)rrSWg?666aRR>~U8Z^Yz)d-$ zGbp&pU@99Ri7+#!E29aMLTLdp9>)Z$C^BeIgY-L2~VGilR8sNylkiJ@%> zwT;ksm8ei#_Nv02pz7+x=LgRns~T^1-C37+tx*K6Yq`~2Hq+C7a_5_`9DUe4>E2;| zod*JV=g^jnKuO)J-cw8a_T2kBpgmYNYPI1q?b}F>b~>zR<6)oXTrp}35n1bxDw;cD zkk>A+9f?$F3t^cyJ(@jYH1WjvSgQbEbG8~AT3X(1(Xt}ufOBOE6XW|@Z#Y}CM^!ee zqMY`}&lwZkfscoQ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GJ17/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; - } - } + + } From 4eab3f7bb1647925aed15e4664912410722ed5bc Mon Sep 17 00:00:00 2001 From: "LEM-II\\Ilja" <> Date: Sun, 22 Jan 2017 12:40:12 +0100 Subject: [PATCH 2/3] commit --- .../Blocks/Building/Building_Barracks.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/GGJ17/Assets/Script/Blocks/Building/Building_Barracks.cs b/GGJ17/Assets/Script/Blocks/Building/Building_Barracks.cs index c2a6dab..909bd2d 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() + { + + } } From 4cb75045eaed13750a151776d7d8b54241742166 Mon Sep 17 00:00:00 2001 From: "LEM-II\\Ilja" <> Date: Sun, 22 Jan 2017 12:41:03 +0100 Subject: [PATCH 3/3] fix --- GGJ17/Assets/Script/Blocks/Building/Building_Barracks.cs | 2 +- GGJ17/Assets/Script/WorldControl.meta | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 GGJ17/Assets/Script/WorldControl.meta diff --git a/GGJ17/Assets/Script/Blocks/Building/Building_Barracks.cs b/GGJ17/Assets/Script/Blocks/Building/Building_Barracks.cs index 909bd2d..54b8e14 100644 --- a/GGJ17/Assets/Script/Blocks/Building/Building_Barracks.cs +++ b/GGJ17/Assets/Script/Blocks/Building/Building_Barracks.cs @@ -34,6 +34,6 @@ void Update() public IEnumerator OnAlert() { - + yield return null; } } 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: