Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
knela96 committed Nov 3, 2019
2 parents 9d3d082 + f888350 commit 93c137c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
13 changes: 9 additions & 4 deletions Police Station Simulator/Assets/CitizenBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ void Update ()

Vector3 distance = move.target.transform.position - transform.position;

if (follow_path.arrived && !action && move.current_velocity == Vector3.zero) //create timer
if (follow_path.arrived && !action && move.current_velocity == Vector3.zero)
{
anim.SetBool("moving", false);
timer -= Time.deltaTime; //timer
if (timer < 0) {

timer -= Time.deltaTime;

if (timer < 0) { // timer to make the citizen wait on the desk

move.target = GameObject.Find("Exit");
follow_path.calcPath(move.target.transform);
action = true;
Expand All @@ -50,6 +51,7 @@ void Update ()
return;
}

//Changes the Animator booleans
if (move.move == true)
{
anim.SetBool("moving", true);
Expand All @@ -69,6 +71,7 @@ private void OnDestroy()
level.citizens.Remove(gameObject);
}

//Triggers steering behaviours
private void OnTriggerEnter(Collider other)
{
if (other == GameObject.Find("Exit").GetComponent<Collider>() && action)
Expand All @@ -92,6 +95,8 @@ private void OnTriggerExit(Collider other)
}
}


//Set up for night mode
public void Night()
{
action = true;
Expand Down
12 changes: 10 additions & 2 deletions Police Station Simulator/Assets/CriminalBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ void Awake()
action = false;
follow_path = gameObject.GetComponent<SteeringFollowPath>();
follow_path.path = new NavMeshPath();

//Agent created to scort him to the cell, creates one each time a new criminal appears.
c_agent = Instantiate(level.policemen_prebab[Random.Range(0, 2)], new Vector3(0, 0, 0), Quaternion.identity);
c_agent.GetComponent<Move>().target = gameObject;
c_agent.transform.position = transform.position + Vector3.back;
Expand All @@ -38,6 +40,7 @@ void Awake()
c_agent.GetComponent<SteeringVelocityMatching>().enabled = true;
c_agent.GetComponent<PoliceBehaviour>().behaviour = PoliceBehaviour.TypeAction.Capture;
c_agent.GetComponent<PoliceBehaviour>().to_cell = true;

anim = GetComponent<Animator>();
cells = GameObject.Find("Cell");

Expand All @@ -56,7 +59,8 @@ void Update()
follow_path.calcPath(cell.getPoint());
}
}


// Changes the Animtor booleans
if (move.move == true)
{
anim.SetBool("moving", true);
Expand All @@ -72,6 +76,7 @@ void Update()

}

//Assign each criminal a point to stand on the cell
void AssignCell()
{
assign = cells.GetComponent<AssignCell>();
Expand All @@ -86,6 +91,7 @@ void AssignCell()
}
}

//Triggers the steering behaviours
private void OnTriggerEnter(Collider other)
{
if (other == GameObject.Find("Exit").GetComponent<Collider>())
Expand Down Expand Up @@ -120,6 +126,7 @@ private void OnDestroy()
cell = null;
}

//Makes the criminal sit on the cell and disables the steering behaviours and changes the agent into an investigator .
public void arrive_cell()
{
follow_path.deleteCurve();
Expand All @@ -142,14 +149,15 @@ public void arrive_cell()

}

//Set up night mode
public void Night()
{

if (c_agent == null && to_cell == true)
{
if (level.day == false)
{
timer -= Time.deltaTime; //timer
timer -= Time.deltaTime; //timer to make the criminal wait before scaping
if (timer < 0)
{
move.move = true;
Expand Down
16 changes: 10 additions & 6 deletions Police Station Simulator/Assets/sun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ public class sun : MonoBehaviour
{
LevelLoop level;
Light light;
Color day;
Color night;
Color day; //light color for the day cycle
Color night; //light color for the night cycle
// Start is called before the first frame update
void Awake()
{
level = GameObject.Find("Level").GetComponent<LevelLoop>();
level = GameObject.Find("Level").GetComponent<LevelLoop>();
light = GetComponent<Light>();


// Setting colors
day.a = 255f/255f;
day.r = 255f/255f;
day.b = 255f/255f;
Expand All @@ -28,14 +30,16 @@ void Awake()
// Update is called once per frame
void Update()
{
//transform.RotateAround(Vector3.zero, Vector3.right, 4.5f * Time.deltaTime);

if (light.intensity == 1F && level.day == false) {


//Changes color and intensity to night mode
light.intensity = 0.2F;
light.color = night;

} else if (light.intensity == 0.2F && level.day == true) {


//Changes color and intensity to day mode
light.intensity = 1F;
light.color = day;

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ As the police captain your job is to assign different workers to different tasks
- Satisfaction

# Gameloop:
## DAY
## DAY (2 minutes)
- Citizen enters the police station
- Citizen gives you notification
- The player asigns a police to the case
Expand All @@ -75,11 +75,11 @@ As the police captain your job is to assign different workers to different tasks
- If the satisfaction reaches 0 or if you have negative money it will be game over.


## NIGHT
## NIGHT (2 minutes)

- Citizen leave the station
- Policemen have to be assigned to random emergency cases
- 2 Policemen in the police station make rounds around keeping watch for scaped criminals
- 2 Policemen in the police station light up their torchlights and make rounds around keeping watch for scaped criminals
- Criminals scape. If the number of policemen are enough to capture the criminal after a short period of time the crimnal will go back to the cell, if the criminal arrives at the door and opens it (Opening the door lasts a short period of time) it will scape.


Expand Down

0 comments on commit 93c137c

Please sign in to comment.