Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating to Unity 2018.1, Adding playability on Mobile devices #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
311 changes: 311 additions & 0 deletions Assembly-CSharp.csproj

Large diffs are not rendered by default.

Binary file modified Assets/Done/Done_Prefabs/Done_Player.prefab
Binary file not shown.
Binary file modified Assets/Done/Done_Scenes/Done_Main.unity
Binary file not shown.
2 changes: 2 additions & 0 deletions Assets/Done/Done_Scripts/Done_EvasiveManeuver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ public class Done_EvasiveManeuver : MonoBehaviour

private float currentSpeed;
private float targetManeuver;
private Rigidbody rigidbody;

void Start ()
{
rigidbody = GetComponent<Rigidbody>();
currentSpeed = rigidbody.velocity.z;
StartCoroutine(Evade());
}
Expand Down
41 changes: 25 additions & 16 deletions Assets/Done/Done_Scripts/Done_GameController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class Done_GameController : MonoBehaviour
{
Expand All @@ -10,9 +12,10 @@ public class Done_GameController : MonoBehaviour
public float startWait;
public float waveWait;

public GUIText scoreText;
public GUIText restartText;
public GUIText gameOverText;
public Text scoreText;
//public Text restartText;
public Button restartButton;
public Text gameOverText;

private bool gameOver;
private bool restart;
Expand All @@ -22,21 +25,22 @@ void Start ()
{
gameOver = false;
restart = false;
restartText.text = "";
//restartText.text = "";
restartButton.gameObject.SetActive(false);
gameOverText.text = "";
score = 0;
UpdateScore ();
StartCoroutine (SpawnWaves ());
}


void Update ()
{
if (restart)
if (gameOver)
{
if (Input.GetKeyDown (KeyCode.R))
{
Application.LoadLevel (Application.loadedLevel);
}
//restartText.text = "Press 'R' for Restart";
restartButton.gameObject.SetActive(true);
restart = true;
}
}

Expand All @@ -53,14 +57,8 @@ IEnumerator SpawnWaves ()
Instantiate (hazard, spawnPosition, spawnRotation);
yield return new WaitForSeconds (spawnWait);
}
yield return new WaitForSeconds (waveWait);
yield return new WaitForSeconds (waveWait);

if (gameOver)
{
restartText.text = "Press 'R' for Restart";
restart = true;
break;
}
}
}

Expand All @@ -80,4 +78,15 @@ public void GameOver ()
gameOverText.text = "Game Over!";
gameOver = true;
}

public void RestartGame ()
{
if(restart)
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}

public void QuitGame ()
{
Application.Quit();
}
}
4 changes: 3 additions & 1 deletion Assets/Done/Done_Scripts/Done_Mover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
public class Done_Mover : MonoBehaviour
{
public float speed;

private Rigidbody rigidbody;

void Start ()
{
rigidbody = GetComponent<Rigidbody>();
rigidbody.velocity = transform.forward * speed;
}
}
31 changes: 30 additions & 1 deletion Assets/Done/Done_Scripts/Done_PlayerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ public class Done_PlayerController : MonoBehaviour

private float nextFire;

private Rigidbody rigidbody;
private AudioSource audio;

void Start ()
{
rigidbody = GetComponent<Rigidbody>();
audio = GetComponent<AudioSource>();
}

void Update ()
{
if (Input.GetButton("Fire1") && Time.time > nextFire)
Expand All @@ -29,7 +38,21 @@ void Update ()
}
}

void FixedUpdate ()
void AccelerometerMovement()
{
Vector3 dir = Vector3.zero;
dir.x = Mathf.Clamp (Input.acceleration.x, boundary.xMin, boundary.xMax);
dir.z = Mathf.Clamp (Input.acceleration.y, boundary.zMin, boundary.zMax);

if (dir.sqrMagnitude > 1)
dir.Normalize();

dir *= Time.deltaTime;

rigidbody.transform.Translate (dir * speed * 2);
}

void KeyboardMovement()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Expand All @@ -46,4 +69,10 @@ void FixedUpdate ()

rigidbody.rotation = Quaternion.Euler (0.0f, 0.0f, rigidbody.velocity.x * -tilt);
}

void FixedUpdate ()
{
AccelerometerMovement();
KeyboardMovement();
}
}
4 changes: 3 additions & 1 deletion Assets/Done/Done_Scripts/Done_RandomRotator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
public class Done_RandomRotator : MonoBehaviour
{
public float tumble;

private Rigidbody rigidbody;

void Start ()
{
rigidbody = GetComponent<Rigidbody>();
rigidbody.angularVelocity = Random.insideUnitSphere * tumble;
}
}
3 changes: 3 additions & 0 deletions Assets/Done/Done_Scripts/Done_WeaponController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ public class Done_WeaponController : MonoBehaviour
public Transform shotSpawn;
public float fireRate;
public float delay;

private AudioSource audio;

void Start ()
{
audio = GetComponent<AudioSource>();
InvokeRepeating ("Fire", delay, fireRate);
}

Expand Down
Binary file added ProjectSettings/ClusterInputManager.asset
Binary file not shown.
Binary file modified ProjectSettings/EditorBuildSettings.asset
Binary file not shown.
Binary file modified ProjectSettings/GraphicsSettings.asset
Binary file not shown.
Binary file added ProjectSettings/NavMeshAreas.asset
Binary file not shown.
Binary file added ProjectSettings/PresetManager.asset
Binary file not shown.
Binary file modified ProjectSettings/ProjectSettings.asset
Binary file not shown.
1 change: 1 addition & 0 deletions ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
m_EditorVersion: 2018.1.0f2
Binary file added ProjectSettings/UnityConnectSettings.asset
Binary file not shown.