Skip to content

Commit

Permalink
Merged branch master into master
Browse files Browse the repository at this point in the history
  • Loading branch information
AdronTech committed Jan 22, 2017
2 parents 3310863 + 4cb7504 commit e77f958
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 21 deletions.
33 changes: 33 additions & 0 deletions GGJ17/Assets/LairCannon.cs
Original file line number Diff line number Diff line change
@@ -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<Building_EnemyLair>();
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<Building_Flag>().transform.position - lair.transform.position;
transform.parent.rotation = Quaternion.LookRotation(firedirection, Vector3.up);

ParticleSystem spwner = GetComponent<ParticleSystem>();
while (true)
{
yield return new WaitForSeconds(lair.spawnFrequence);
if (spwner) spwner.Emit(1);
}
}
}
12 changes: 12 additions & 0 deletions GGJ17/Assets/LairCannon.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified GGJ17/Assets/Prefab/BuildingBlocks/Building_EnemyLair.prefab
Binary file not shown.
25 changes: 25 additions & 0 deletions GGJ17/Assets/Script/Blocks/Building/Building_Barracks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,36 @@

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();
bbi.up = bbi.down = true;
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;
}
}
25 changes: 4 additions & 21 deletions GGJ17/Assets/Script/Blocks/Building/Building_EnemyLair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -20,27 +20,10 @@ void Awake () {

void Start()
{
StartCoroutine(SpawnDrops());
StartCoroutine(GetComponentInChildren<LairCannon>().SpawnDrops(this, startDelay));
}

IEnumerator SpawnDrops()
{
ParticleSystem spwner = GetComponent<ParticleSystem>();
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;
}
}


}
9 changes: 9 additions & 0 deletions GGJ17/Assets/Script/WorldControl.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e77f958

Please sign in to comment.