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/Assets/Prefab/BuildingBlocks/Building_Barracks.prefab
	GGJ17/ProjectSettings/TagManager.asset
  • Loading branch information
LEM-II\Ilja committed Jan 22, 2017
2 parents 1ad150e + 1a65747 commit 4a951b6
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 38 deletions.
Binary file modified GGJ17/Assets/Prefab/Psi.prefab
Binary file not shown.
Binary file modified GGJ17/Assets/Prefab/PsiRed.prefab
Binary file not shown.
Binary file modified GGJ17/Assets/Scene/IntroScene.unity
Binary file not shown.
Binary file modified GGJ17/Assets/Scene/MainScene.unity
Binary file not shown.
Binary file modified GGJ17/Assets/Scene/Marky.unity
Binary file not shown.
7 changes: 4 additions & 3 deletions GGJ17/Assets/Script/AttackBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ void Start () {
public void startAttack(Transform target)
{
this.target = target;
lr.enabled = true;
}

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

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

Expand All @@ -43,6 +43,7 @@ void Update()

public void stopAttack()
{
lr.enabled = false;
target = null;
}

Expand Down
5 changes: 0 additions & 5 deletions GGJ17/Assets/Script/GameOverScreen/gameOverInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ void Start()
sceneStartTime = Time.time;
}

void Awake()
{
sceneStartTime = Time.time;
}

// Update is called once per frame
void Update()
{
Expand Down
4 changes: 3 additions & 1 deletion GGJ17/Assets/Script/GameOverScreen/gameOverSpawner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ public class gameOverSpawner : MonoBehaviour
public GameObject psiPrefab;
public float spawnDuration;
public float waitBetween;
private float sceneStartTime;

// Use this for initialization
void Start()
{
sceneStartTime = Time.time;
StartCoroutine(PsiRain(psiPrefab));
}

Expand All @@ -23,6 +25,6 @@ IEnumerator PsiRain(GameObject prefab)
Random.Range(0f, 360f),
Random.Range(0f, 360f))));
yield return new WaitForSeconds(waitBetween);
} while (spawnDuration > Time.time);
} while (spawnDuration > Time.time - sceneStartTime);
}
}
9 changes: 7 additions & 2 deletions GGJ17/Assets/Script/IntroSequence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class IntroSequence : MonoBehaviour

public GameObject dialog;
private Dialog d;
public string nextSceneName;

// Use this for initialization
void Start()
{
Expand All @@ -18,7 +20,10 @@ void Start()
// Update is called once per frame
void Update()
{

if (Input.anyKeyDown)
{
SceneManager.LoadScene(nextSceneName, LoadSceneMode.Single);
}
}

public IEnumerator PlayIntro()
Expand Down Expand Up @@ -81,6 +86,6 @@ public IEnumerator PlayIntro()

yield return StartCoroutine(d.Talk());

SceneManager.LoadScene(2, LoadSceneMode.Single);
SceneManager.LoadScene(nextSceneName, LoadSceneMode.Single);
}
}
23 changes: 12 additions & 11 deletions GGJ17/Assets/Script/KingBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ public class KingBehaviour : MonoBehaviour {
public GameObject soldierPre;
public int size;

private List<Transform> possibleTargets;

private List<MyPhysics> army;

private MyPhysics my;
Expand All @@ -24,7 +22,6 @@ void Awake () {
mySeek = GetComponent<SeekBehaviour>();

army = new List<MyPhysics>();
possibleTargets = new List<Transform>();

state = KingState.Seeking;

Expand Down Expand Up @@ -78,6 +75,8 @@ IEnumerator scanForTarget()
{
yield return new WaitUntil(() => state == KingState.Seeking);

List<Transform> possibleTargets = new List<Transform>();

foreach (AbstractBaseBuilding a in FindObjectsOfType<AbstractBaseBuilding>())
{
if (a.neighbors[AbstractBuildingBlock.down] && a.neighbors[AbstractBuildingBlock.down].tag == "Ground")
Expand All @@ -92,7 +91,6 @@ IEnumerator scanForTarget()
else
{
Debug.DrawLine(my.pos, a.transform.position, Color.blue);
if (possibleTargets.Contains(a.transform)) possibleTargets.Remove(a.transform);
}
}
}
Expand Down Expand Up @@ -141,15 +139,18 @@ IEnumerator stateMachineManager()
case KingState.Seeking:
if (!mySeek.target) break;

if (Mathf.Abs(my.pos.x - mySeek.target.position.x) <= attackRange || Mathf.Abs(my.pos.z - mySeek.target.position.z) <= attackRange)
if (Mathf.Abs(my.pos.x - mySeek.target.position.x) <= attackRange && Mathf.Abs(my.pos.z - mySeek.target.position.z) <= attackRange)
{
state = KingState.Attack;
mySeek.stop();

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

}
Expand All @@ -158,14 +159,14 @@ IEnumerator stateMachineManager()
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);
if (ah) ah.stopAttack();
}
mySeek.start();
state = KingState.Seeking;
Debug.Log("Destroyed");
}

break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class LairCannon : MonoBehaviour {

void OnParticleCollision(GameObject go)
{
if (go.tag.Equals("Ground"))
if (go.tag == "Ground")
{
Building_EnemyLair lair = GetComponentInParent<Building_EnemyLair>();
GameObject obj = Instantiate(lair.spawnPrefab);
Expand Down
File renamed without changes.
5 changes: 0 additions & 5 deletions GGJ17/Assets/Script/TitleScreen/titleInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ void Start()
sceneStartTime = Time.time;
}

void Awake()
{
sceneStartTime = Time.time;
}

// Update is called once per frame
void Update()
{
Expand Down
4 changes: 3 additions & 1 deletion GGJ17/Assets/Script/TitleScreen/titleSpawner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ public class titleSpawner : MonoBehaviour
public GameObject psiPrefab;
public float spawnDuration;
public float waitBetween;
private float sceneStartTime;

// Use this for initialization
void Start()
{
sceneStartTime = Time.time;
StartCoroutine(PsiRain(psiPrefab));
}

Expand All @@ -23,6 +25,6 @@ IEnumerator PsiRain(GameObject prefab)
Random.Range(0f, 360f),
Random.Range(0f, 360f))));
yield return new WaitForSeconds(waitBetween);
} while (spawnDuration > Time.time);
} while (spawnDuration > Time.time - sceneStartTime);
}
}
9 changes: 0 additions & 9 deletions GGJ17/Assets/Script/WorldControl.meta

This file was deleted.

0 comments on commit 4a951b6

Please sign in to comment.