Skip to content

Commit

Permalink
cleaned code
Browse files Browse the repository at this point in the history
  • Loading branch information
knela96 committed Nov 3, 2019
1 parent 93c137c commit 68c433b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
1 change: 0 additions & 1 deletion Police Station Simulator/Assets/CitizenBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ void Update ()
move.target = GameObject.Find("Exit");
follow_path.calcPath(move.target.transform);
action = true;
//Instantiate(level.citizens[Random.Range(0, level.citizens.Length - 1)], GameObject.Find("Entrance").transform.position,Quaternion.Euler(0,90,0));
}

return;
Expand Down
2 changes: 1 addition & 1 deletion Police Station Simulator/Assets/CriminalBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void Update()
}
}

// Changes the Animtor booleans
// Changes the Animator booleans
if (move.move == true)
{
anim.SetBool("moving", true);
Expand Down
16 changes: 5 additions & 11 deletions Police Station Simulator/Assets/LevelLoop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ void Update()
{
if (day)
{
//Spawn Entites evey x time
if (cycle - timer1 > 15)
{
timer1 = cycle;
Expand All @@ -57,11 +58,7 @@ void Update()
}
if (!actions)
{
//foreach (GameObject go in citizens)
//{
// if (go != null)
// go.GetComponent<CitizenBehaviour>().Day();
//}
//Change the behaviour to Day
foreach (GameObject go in policemen)
{
if (go != null)
Expand All @@ -71,11 +68,6 @@ void Update()
GameObject ob = Instantiate(policemen_prebab[Random.Range(0, policemen_prebab.Length - 1)], GameObject.Find("Entrance").transform.position, Quaternion.Euler(0, 90, 0));
ob.GetComponent<PoliceBehaviour>().behaviour = PoliceBehaviour.TypeAction.Receptionist;
policemen.Add(ob);
//foreach (GameObject go in criminals)
//{
// if (go != null)
// go.GetComponent<CriminalBehavior>().Day();
//}

timer1 = 0;
timer2 = -15;
Expand All @@ -88,7 +80,7 @@ void Update()
else if(!actions && !day)
{
patrol = 0;

//Change the behavior of all entities to Night
foreach (GameObject go in citizens)
{
if (go != null)
Expand All @@ -110,13 +102,15 @@ void Update()

cycle += Time.deltaTime;

//Resets the counter to show all possible agents
if (c1 == citizens_prebab.Length)
c1 = 0;
if (c2 == policemen_prebab.Length)
c2 = 0;
if (c3 == criminals_prebab.Length)
c3 = 0;

//Changes the cycle of day and night
if (cycle >= 120)
{
day = !day;
Expand Down

0 comments on commit 68c433b

Please sign in to comment.