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 071fb0b + b120236 commit bc9a0f9
Show file tree
Hide file tree
Showing 26 changed files with 278 additions and 19 deletions.
Binary file added GGJ17/Assets/Fonts/Perfect DOS VGA 437 Win.ttf
Binary file not shown.
21 changes: 21 additions & 0 deletions GGJ17/Assets/Fonts/Perfect DOS VGA 437 Win.ttf.meta

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

Binary file modified GGJ17/Assets/Prefab/Dialog/Dialog Left.prefab
Binary file not shown.
4 changes: 2 additions & 2 deletions GGJ17/Assets/Prefab/Dialog/Dialog Left.prefab.meta

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

Binary file modified GGJ17/Assets/Prefab/Dialog/Dialog Right.prefab
Binary file not shown.
2 changes: 1 addition & 1 deletion GGJ17/Assets/Prefab/Dialog/Dialog Right.prefab.meta

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

Binary file modified GGJ17/Assets/Prefab/Dialog/Dialog.prefab
Binary file not shown.
2 changes: 1 addition & 1 deletion GGJ17/Assets/Prefab/Dialog/Dialog.prefab.meta

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

Binary file modified GGJ17/Assets/Scene/BlockTest.unity
Binary file not shown.
Binary file modified GGJ17/Assets/Scene/IntroScene.unity
Binary file not shown.
91 changes: 78 additions & 13 deletions GGJ17/Assets/Script/Blocks/Building/Building_Barracks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,101 @@

public class Building_Barracks : AbstractBaseBuilding {

public float EffectiveRange = 5;
public float AlertCheckIntervall = 1f;
public float AtackIntervall = 0.5f;
public bool isAlerted;
public Vector3 effectiveRange = new Vector3(5, 20, 5);
public float sonarPulseIntervall = 2f;
public int ticksToLeaveAlert = 10;
public float alertResourceDrain = -0.1f;
public float atackIntervall = 0.5f;

private LineRenderer ousiaRay;
private Collider[] enemiesSpotted = new Collider[0];

private bool isAlerted;
public bool IsAlerted
{
set
{
isAlerted = value;
if (value)
{
FindObjectOfType<ResourceManager>().RegisterResources(alertResourceDrain);
}
else
{
FindObjectOfType<ResourceManager>().DeregisterResources(alertResourceDrain);
}
}
}

// Use this for initialization
void Awake () {
ousiaRay = GetComponent<LineRenderer>();
ousiaRay.SetPosition(0, transform.position);
BuildingBlockInit bbi = new BuildingBlockInit();
bbi.up = bbi.down = true;
bbi.sides = false;
Init(bbi);
}

void Update()
void Start()
{
StartCoroutine(Sonar());
}

private bool AlertCheck(out Collider[] cc)
{
cc = Physics.OverlapBox(transform.position,
effectiveRange,
Quaternion.identity,
LayerMask.NameToLayer("Enemy"));
return cc.Length > 0;
}

public Collider AquireTarget()
{
if (!isAlerted)
foreach(Collider enemy in enemiesSpotted)
{
Collider[] cc = Physics.OverlapBox(transform.position, new Vector3(EffectiveRange, 20, EffectiveRange));
foreach(Collider c in cc)
Vector3 dir = enemy.transform.position - transform.position;
float distance = dir.magnitude;
dir.Normalize();
if (Physics.Raycast(transform.position, dir, distance))
{ continue; }
else
{
if(c.tag == "Enemy")
{
ousiaRay.SetPosition(1, enemy.transform.position);
return enemy;
}

}
}
return null;
}

public IEnumerator Sonar()
{
int clearTicks = 0;
while(true)
{
Collider[] cc;
if(AlertCheck(out cc))
{
if(!isAlerted) StartCoroutine(Engaging());
clearTicks = 0;
IsAlerted = true;
}
else if(++clearTicks == ticksToLeaveAlert)
{
IsAlerted = false;
}
yield return new WaitForSeconds(sonarPulseIntervall);
}
}

public IEnumerator OnAlert()
public IEnumerator Engaging()
{
yield return null;
for(Collider target = AquireTarget(); target; target = AquireTarget())
{

yield return null;
}
}
}
15 changes: 14 additions & 1 deletion GGJ17/Assets/Script/Dialog/Dialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ public IEnumerator Talk()

yield return StartCoroutine(MoveDialogBox(rect,
new Vector3(rect.anchoredPosition.x,
-rect.rect.height / 2 - (i * rect.rect.height) - 14)));
-rect.rect.height / 2 - (i * rect.rect.height) - 30)));

rect.anchoredPosition = new Vector3(rect.rect.width / 2 + 17,
-rect.rect.height / 2 - (i * rect.rect.height) - 30 - 15*i);

DialogBox d = box.GetComponent<DialogBox>();
d.text = speeches[i].text;
Expand All @@ -64,6 +67,16 @@ public IEnumerator MoveDialogBox(RectTransform rect, Vector3 target)
}
}

public void Reset()
{
foreach(DialogBox d in FindObjectsOfType<DialogBox>())
{
Destroy(d.gameObject);
}

speeches.Clear();
}

internal void Clear()
{
speeches.Clear();
Expand Down
34 changes: 33 additions & 1 deletion GGJ17/Assets/Script/IntroSequence.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using UnityEngine.SceneManagement;

public class IntroSequence : MonoBehaviour
{

Expand Down Expand Up @@ -50,5 +51,36 @@ public IEnumerator PlayIntro()
d.speeches.Add(e);

yield return StartCoroutine(d.Talk());

d.Reset();

e = new Dialog.DialogElement();
e.dialogBox = d.dialogBoxes[1];
e.text = "Mission control, we are now entering Psion's orbit.";
d.speeches.Add(e);

e = new Dialog.DialogElement();
e.dialogBox = d.dialogBoxes[1];
e.text = "Mission control, please come in! We are just above Psion..... Do you copy?";
d.speeches.Add(e);

e = new Dialog.DialogElement();
e.dialogBox = d.dialogBoxes[1];
e.text = "They are not answering!";
d.speeches.Add(e);

e = new Dialog.DialogElement();
e.dialogBox = d.dialogBoxes[1];
e.text = "Check the main systems!";
d.speeches.Add(e);

e = new Dialog.DialogElement();
e.dialogBox = d.dialogBoxes[1];
e.text = "Whate the ...? Something has fried our computer! We are coming down hard. Brace for impact.";
d.speeches.Add(e);

yield return StartCoroutine(d.Talk());

SceneManager.LoadScene(2, LoadSceneMode.Single);
}
}
9 changes: 9 additions & 0 deletions GGJ17/Assets/Sounds.meta

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

9 changes: 9 additions & 0 deletions GGJ17/Assets/Sounds/Blocks.meta

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

Binary file added GGJ17/Assets/Sounds/Blocks/build_defense.wav
Binary file not shown.
22 changes: 22 additions & 0 deletions GGJ17/Assets/Sounds/Blocks/build_defense.wav.meta

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

Binary file added GGJ17/Assets/Sounds/Blocks/build_extractor.wav
Binary file not shown.
22 changes: 22 additions & 0 deletions GGJ17/Assets/Sounds/Blocks/build_extractor.wav.meta

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

Binary file added GGJ17/Assets/Sounds/Blocks/build_wall.wav
Binary file not shown.
22 changes: 22 additions & 0 deletions GGJ17/Assets/Sounds/Blocks/build_wall.wav.meta

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

Binary file added GGJ17/Assets/Sounds/alien.wav
Binary file not shown.
22 changes: 22 additions & 0 deletions GGJ17/Assets/Sounds/alien.wav.meta

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

Binary file added GGJ17/Assets/Sounds/android.wav
Binary file not shown.
22 changes: 22 additions & 0 deletions GGJ17/Assets/Sounds/android.wav.meta

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

Binary file modified GGJ17/ProjectSettings/EditorBuildSettings.asset
Binary file not shown.

0 comments on commit bc9a0f9

Please sign in to comment.