Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/AdronTech/GGJ_2017
Browse files Browse the repository at this point in the history
Conflicts:
	GGJ17/ProjectSettings/TagManager.asset
  • Loading branch information
LEM-II\Ilja committed Jan 22, 2017
2 parents 0aca747 + 71d046e commit b5ceaca
Show file tree
Hide file tree
Showing 35 changed files with 403 additions and 16 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 added GGJ17/Assets/Images/EnemyFire.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions GGJ17/Assets/Images/EnemyFire.png.meta

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

Binary file added GGJ17/Assets/Material/EnemyFire.mat
Binary file not shown.
8 changes: 8 additions & 0 deletions GGJ17/Assets/Material/EnemyFire.mat.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/Prefab/King.prefab
Binary file not shown.
Binary file modified GGJ17/Assets/Prefab/Soldier.prefab
Binary file not shown.
Binary file modified GGJ17/Assets/Scene/IntroScene.unity
Binary file not shown.
Binary file modified GGJ17/Assets/Scene/Marky.unity
Binary file not shown.
88 changes: 88 additions & 0 deletions GGJ17/Assets/Script/AttackBehaviour.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(LineRenderer))]
public class AttackBehaviour : MonoBehaviour {

public Transform target;
LineRenderer lr;

bool canSee;

public float delay;
public float damage;

void Start () {
lr = GetComponent<LineRenderer>();
lr.enabled = false;

StartCoroutine(inRange());
StartCoroutine(attack());
}

public void startAttack(Transform target)
{
this.target = target;
}

void Update()
{
lr.enabled = target != null;

if (lr.enabled)
{
Vector3[] positions = new Vector3[2];

positions[0] = transform.position;
positions[1] = target.position;

lr.SetPositions(positions);
}
}

public void stopAttack()
{
target = null;
}

IEnumerator inRange()
{
while(true)
{
if (target)
{
Vector3 dist = target.position - transform.position;

canSee = !Physics.Raycast(transform.position, dist.normalized, dist.magnitude - 1);
lr.enabled = canSee;
}
else
{
canSee = false;
}

yield return new WaitForSeconds(0.25f);
}
}

IEnumerator attack()
{
while(true)
{
if(target && canSee)
{
AbstractBaseBuilding t = target.GetComponent<AbstractBaseBuilding>();
if(t)
{
t.HP -= damage;
}

yield return new WaitForSeconds(delay);
}

yield return null;
}

}
}
12 changes: 12 additions & 0 deletions GGJ17/Assets/Script/AttackBehaviour.cs.meta

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

7 changes: 4 additions & 3 deletions GGJ17/Assets/Script/Blocks/AbstractBaseBuilding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ public abstract class AbstractBaseBuilding : AbstractBuildingBlock {
private float hp = 10;
public float HP
{
get { return hp; }
set
{
hp = value;
if (hp < value)
if (hp < 0)
{
DestroyBuilding();
}
}
}

}

public void DestroyBuilding()
{

Expand Down
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);
}
}
27 changes: 22 additions & 5 deletions GGJ17/Assets/Script/KingBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ IEnumerator scanForTarget()

if (!Physics.Raycast(my.pos, dist.normalized, dist.magnitude - 1))
{
//Debug.DrawLine(my.pos, a.transform.position, Color.red);
Debug.DrawLine(my.pos, a.transform.position, Color.red);
possibleTargets.Add(a.transform);
}
else
{
//Debug.DrawLine(my.pos, a.transform.position, Color.blue);
Debug.DrawLine(my.pos, a.transform.position, Color.blue);
if (possibleTargets.Contains(a.transform)) possibleTargets.Remove(a.transform);
}
}
Expand All @@ -112,9 +112,7 @@ IEnumerator scanForTarget()
bestTarget = possible;
}

Debug.Log(mySeek.target = bestTarget);

if (!mySeek.target ||
if (!mySeek.target || !possibleTargets.Contains(mySeek.target) ||
getPriority(bestTarget) > getPriority(mySeek.target) ||
(getPriority(bestTarget) == getPriority(mySeek.target) && Vector3.Distance(my.pos, bestTarget.position) <= Vector3.Distance(my.pos, mySeek.target.position)))
mySeek.target = bestTarget;
Expand Down Expand Up @@ -146,10 +144,29 @@ IEnumerator stateMachineManager()
{
state = KingState.Attack;
mySeek.stop();

foreach(MyPhysics soldier in army)
{
AttackBehaviour ah = soldier.GetComponent<AttackBehaviour>();
if (ah) ah.startAttack(mySeek.target);
}

}

break;
case KingState.Attack:
if (!mySeek.target)
{
state = KingState.Seeking;
mySeek.start();

foreach (MyPhysics soldier in army)
{
AttackBehaviour ah = soldier.GetComponent<AttackBehaviour>();
if (ah) ah.startAttack(mySeek.target);
}
}

break;
}

Expand Down

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

Loading

0 comments on commit b5ceaca

Please sign in to comment.