diff --git a/Assembly-CSharp-vs.csproj b/Assembly-CSharp-vs.csproj new file mode 100644 index 0000000..3bc01f4 --- /dev/null +++ b/Assembly-CSharp-vs.csproj @@ -0,0 +1,74 @@ + + + + Debug + AnyCPU + 10.0.20506 + 2.0 + {82046576-C011-7ADA-282F-8E9E2216DFF3} + Library + Properties + + Assembly-CSharp + v3.5 + 512 + Assets + + + true + full + false + Temp\bin\Debug\ + DEBUG;TRACE;UNITY_4_6_0;UNITY_4_6;UNITY_ANDROID;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_UNITYEVENTS;ENABLE_NEW_HIERARCHY ;ENABLE_AUDIO_FMOD;ENABLE_MONO;ENABLE_TERRAIN;ENABLE_SUBSTANCE;ENABLE_GENERICS;INCLUDE_WP8SUPPORT;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_4_6_FEATURES;INCLUDE_WP_BLUE_SUPPORT;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;ENABLE_CACHING;ENABLE_CLOTH;UNITY_ANDROID_API;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE + prompt + 4 + 0169 + + + pdbonly + true + Temp\bin\Release\ + TRACE + prompt + 4 + 0169 + + + + + + + + C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEngine.dll + + + C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEditor.dll + + + + + + + + + + + + + + + + + C:/Program Files (x86)/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/4.6.0/UnityEngine.UI.dll + + + + + + diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj new file mode 100644 index 0000000..3bc01f4 --- /dev/null +++ b/Assembly-CSharp.csproj @@ -0,0 +1,74 @@ + + + + Debug + AnyCPU + 10.0.20506 + 2.0 + {82046576-C011-7ADA-282F-8E9E2216DFF3} + Library + Properties + + Assembly-CSharp + v3.5 + 512 + Assets + + + true + full + false + Temp\bin\Debug\ + DEBUG;TRACE;UNITY_4_6_0;UNITY_4_6;UNITY_ANDROID;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_UNITYEVENTS;ENABLE_NEW_HIERARCHY ;ENABLE_AUDIO_FMOD;ENABLE_MONO;ENABLE_TERRAIN;ENABLE_SUBSTANCE;ENABLE_GENERICS;INCLUDE_WP8SUPPORT;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_4_6_FEATURES;INCLUDE_WP_BLUE_SUPPORT;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;ENABLE_CACHING;ENABLE_CLOTH;UNITY_ANDROID_API;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE + prompt + 4 + 0169 + + + pdbonly + true + Temp\bin\Release\ + TRACE + prompt + 4 + 0169 + + + + + + + + C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEngine.dll + + + C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEditor.dll + + + + + + + + + + + + + + + + + C:/Program Files (x86)/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/4.6.0/UnityEngine.UI.dll + + + + + + diff --git a/Assets/Done/Done_Scenes/Done_Main.unity b/Assets/Done/Done_Scenes/Done_Main.unity index 90feca4..a749fb3 100644 Binary files a/Assets/Done/Done_Scenes/Done_Main.unity and b/Assets/Done/Done_Scenes/Done_Main.unity differ diff --git a/Assets/Done/Done_Scripts/Done_FireButton.cs b/Assets/Done/Done_Scripts/Done_FireButton.cs new file mode 100644 index 0000000..f08d805 --- /dev/null +++ b/Assets/Done/Done_Scripts/Done_FireButton.cs @@ -0,0 +1,27 @@ +using UnityEngine; +using UnityEngine.UI; +using UnityEngine.EventSystems; + +public class Done_FireButton : MonoBehaviour, IPointerDownHandler, IPointerUpHandler { + + public Image image; + public bool pressed = false; + + public void OnPointerDown(PointerEventData pointerEventData) + { + pressed = true; + + Color color = image.color; + color.a = 0.25f; + image.color = color; + } + + public void OnPointerUp(PointerEventData pointerEventData) + { + pressed = false; + + Color color = image.color; + color.a = 0.75f; + image.color = color; + } +} diff --git a/Assets/Done/Done_Scripts/Done_FireButton.cs.meta b/Assets/Done/Done_Scripts/Done_FireButton.cs.meta new file mode 100644 index 0000000..c91bbae --- /dev/null +++ b/Assets/Done/Done_Scripts/Done_FireButton.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cafe8f3f716d0c840a110dd98d3305e8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Done/Done_Scripts/Done_GameController.cs b/Assets/Done/Done_Scripts/Done_GameController.cs index 4b65419..cfced29 100644 --- a/Assets/Done/Done_Scripts/Done_GameController.cs +++ b/Assets/Done/Done_Scripts/Done_GameController.cs @@ -33,7 +33,9 @@ void Update () { if (restart) { - if (Input.GetKeyDown (KeyCode.R)) + //Converted this to click instead so that the game could be restarted + //if (Input.GetKeyDown (KeyCode.R)) + if(Input.GetButton ("Fire1") || (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Began)) { Application.LoadLevel (Application.loadedLevel); } @@ -57,7 +59,7 @@ IEnumerator SpawnWaves () if (gameOver) { - restartText.text = "Press 'R' for Restart"; + restartText.text = "Press anywhere to restart"; restart = true; break; } @@ -75,9 +77,9 @@ void UpdateScore () scoreText.text = "Score: " + score; } - public void GameOver () - { + public void GameOver () { gameOverText.text = "Game Over!"; gameOver = true; } + } \ No newline at end of file diff --git a/Assets/Done/Done_Scripts/Done_JoyStick.cs b/Assets/Done/Done_Scripts/Done_JoyStick.cs new file mode 100644 index 0000000..a688d66 --- /dev/null +++ b/Assets/Done/Done_Scripts/Done_JoyStick.cs @@ -0,0 +1,30 @@ +using UnityEngine; +using UnityEngine.EventSystems; +using System.Collections; + +public class Done_JoyStick : MonoBehaviour, IDragHandler, IEndDragHandler { + + public RectTransform joystick; + + public float sensitivity; + + public void OnDrag(PointerEventData pointerEventData) + { + joystick.anchoredPosition += (pointerEventData.delta * sensitivity); + + if(Vector2.Distance(Vector2.zero, joystick.anchoredPosition) > 150f) + { + joystick.anchoredPosition = joystick.anchoredPosition.normalized * 150f; + } + } + + public void OnEndDrag(PointerEventData pointerEventData) + { + joystick.anchoredPosition = Vector2.zero; + } + + public Vector2 GetJoystickValue() + { + return (joystick.anchoredPosition - Vector2.zero) / 150f; + } +} diff --git a/Assets/Done/Done_Scripts/Done_JoyStick.cs.meta b/Assets/Done/Done_Scripts/Done_JoyStick.cs.meta new file mode 100644 index 0000000..d6f65de --- /dev/null +++ b/Assets/Done/Done_Scripts/Done_JoyStick.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 012c53dcd5e52f9428ca025627778aa1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Done/Done_Scripts/Done_PlayerController.cs b/Assets/Done/Done_Scripts/Done_PlayerController.cs index 9892460..8d98b9f 100644 --- a/Assets/Done/Done_Scripts/Done_PlayerController.cs +++ b/Assets/Done/Done_Scripts/Done_PlayerController.cs @@ -1,4 +1,5 @@ using UnityEngine; +using UnityEngine.UI; using System.Collections; [System.Serializable] @@ -9,6 +10,9 @@ public class Done_Boundary public class Done_PlayerController : MonoBehaviour { + public Done_JoyStick joystick; + public Done_FireButton fireButton; + public float speed; public float tilt; public Done_Boundary boundary; @@ -18,10 +22,10 @@ public class Done_PlayerController : MonoBehaviour public float fireRate; private float nextFire; - - void Update () + + void Update() { - if (Input.GetButton("Fire1") && Time.time > nextFire) + if(fireButton.pressed && Time.time > nextFire) { nextFire = Time.time + fireRate; Instantiate(shot, shotSpawn.position, shotSpawn.rotation); @@ -31,8 +35,10 @@ void Update () void FixedUpdate () { - float moveHorizontal = Input.GetAxis ("Horizontal"); - float moveVertical = Input.GetAxis ("Vertical"); + Vector2 value = joystick.GetJoystickValue (); + + float moveHorizontal = value.x; + float moveVertical = value.y; Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical); rigidbody.velocity = movement * speed; diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 3bf9e66..3e9c30d 100644 Binary files a/ProjectSettings/EditorBuildSettings.asset and b/ProjectSettings/EditorBuildSettings.asset differ diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset index a925b7c..9c0f692 100644 Binary files a/ProjectSettings/GraphicsSettings.asset and b/ProjectSettings/GraphicsSettings.asset differ diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 84b2e92..e401673 100644 Binary files a/ProjectSettings/ProjectSettings.asset and b/ProjectSettings/ProjectSettings.asset differ diff --git a/unitydemo-SpaceShooter.userprefs b/unitydemo-SpaceShooter.userprefs new file mode 100644 index 0000000..6086e14 --- /dev/null +++ b/unitydemo-SpaceShooter.userprefs @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file