Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Lab12/Assets/Dave.unity
Binary file not shown.
8 changes: 8 additions & 0 deletions Lab12/Assets/Dave.unity.meta

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

19 changes: 19 additions & 0 deletions Lab12/Assets/ScriptHealth.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using UnityEngine;
using UnityEngine.UI;
using System.Collections;

/// <summary>
/// @Author Jake Skov
/// </summary>
public class ScriptHealth : MonoBehaviour
{
public int health = 10;
public Text healthText;

// Update is called once per frame
void Update ()
{
//Updates the UI
healthText.text = health.ToString();
}
}
12 changes: 12 additions & 0 deletions Lab12/Assets/ScriptHealth.cs.meta

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

37 changes: 37 additions & 0 deletions Lab12/Assets/ScriptMovement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using UnityEngine;
using System.Collections;
using System.Threading;

/// <summary>
/// @Author Jake Skov
/// </summary>
public class ScriptMovement : MonoBehaviour
{
float time;
// Use this for initialization
void Start ()
{
//Lerps Movement
Thread lerp = new Thread(() => Vector3.Lerp(transform.position,
new Vector3(Random.Range(-2, 3), Random.Range(-2, 3), 0), 1f * time));

//Starts thread
lerp.Start();
}

// Update is called once per frame
void Update ()
{
//Updates the time variable
time = Time.deltaTime;
}

//Collisions
void OnTriggerEnter(Collider other)
{
if (other.name == "Lost")
{
other.GetComponent<ScriptHealth>().health--;
}
}
}
12 changes: 12 additions & 0 deletions Lab12/Assets/ScriptMovement.cs.meta

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

35 changes: 35 additions & 0 deletions Lab12/Assets/ScriptThreading.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using UnityEngine;
using System.Collections;
using System.Threading;

public class ScriptThreading : MonoBehaviour
{

// Use this for initialization
void Start ()
{
//IN LAB CODE
Thread worker = new Thread(Go);
Debug.Log("Is worker in the Background" + worker.IsBackground);
worker.IsBackground = true;
Debug.Log("Is worker in the Background" + worker.IsBackground);
worker.Start();
Go();
//END IN LAB CODE

//LAB REPORT TEST CODE
string text = "t1";
Thread t1 = new Thread(() => Debug.Log(text));
text = "t2";
Thread t2 = new Thread(() => Debug.Log(text));

t1.Start();
t2.Start();
//END TEST CODE
}

void Go()
{
Debug.Log("Greetings from " + Thread.CurrentThread.Name);
}
}
12 changes: 12 additions & 0 deletions Lab12/Assets/ScriptThreading.cs.meta

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

Binary file added Lab12/ProjectSettings/AudioManager.asset
Binary file not shown.
Binary file added Lab12/ProjectSettings/DynamicsManager.asset
Binary file not shown.
Binary file added Lab12/ProjectSettings/EditorBuildSettings.asset
Binary file not shown.
Binary file added Lab12/ProjectSettings/EditorSettings.asset
Binary file not shown.
Binary file added Lab12/ProjectSettings/GraphicsSettings.asset
Binary file not shown.
Binary file added Lab12/ProjectSettings/InputManager.asset
Binary file not shown.
Binary file added Lab12/ProjectSettings/NavMeshAreas.asset
Binary file not shown.
Binary file added Lab12/ProjectSettings/NetworkManager.asset
Binary file not shown.
Binary file added Lab12/ProjectSettings/Physics2DSettings.asset
Binary file not shown.
Binary file added Lab12/ProjectSettings/ProjectSettings.asset
Binary file not shown.
2 changes: 2 additions & 0 deletions Lab12/ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
m_EditorVersion: 5.1.2f1
m_StandardAssetsVersion: 0
Binary file added Lab12/ProjectSettings/QualitySettings.asset
Binary file not shown.
Binary file added Lab12/ProjectSettings/TagManager.asset
Binary file not shown.
Binary file added Lab12/ProjectSettings/TimeManager.asset
Binary file not shown.