Skip to content

Commit

Permalink
General Project Wrap up
Browse files Browse the repository at this point in the history
  • Loading branch information
Argzero committed Oct 24, 2019
1 parent 4f28b45 commit 2d08c8a
Show file tree
Hide file tree
Showing 26 changed files with 300 additions and 20 deletions.
26 changes: 26 additions & 0 deletions Assets/CanvasGroupFadeInOnRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CanvasGroupFadeInOnRequest : MonoBehaviour {
public CanvasGroup Group;
public float Alpha = 0f;
public float FadeInAlpha = 1f;
public float FadeInRate = 0.1f;
public float Threshold = 0.1f;

public IEnumerator FadeInCoroutine(){
while(Alpha <= FadeInAlpha){
Alpha = Mathf.Lerp (Alpha, FadeInAlpha, FadeInRate);
if (Mathf.Abs (FadeInAlpha - Alpha) < Threshold)
Alpha = FadeInAlpha;
Group.alpha = Alpha;
yield return new WaitForEndOfFrame();
}
yield return 0;
}

public void RequestFadeIn(){
StartCoroutine (FadeInCoroutine());
}
}
12 changes: 12 additions & 0 deletions Assets/CanvasGroupFadeInOnRequest.cs.meta

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

49 changes: 49 additions & 0 deletions Assets/EndScreen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class EndScreen : MonoBehaviour {
public CanvasGroupFadeInOnRequest CanvasManager;
public Image Bg;
public float Alpha = 0f;
public float FadeInAlpha = 216f;
public float FadeInRate = 0.1f;
public float Threshold = 1f;
public float DelayTime = 5f;
public bool DO_IT = false;
private void Update()
{
if (DO_IT)
FadeIn();
}
// Use this for initialization
public void FadeIn() {
CanvasManager.RequestFadeIn ();
StartCoroutine (FadeInCoroutine());
}

public IEnumerator FadeInCoroutine()
{
StartCoroutine(DelayToStart());
Color col;
Bg = GetComponent<Image> ();
while(Alpha <= FadeInAlpha){
Alpha = Mathf.Lerp (Alpha, FadeInAlpha, FadeInRate);
if (Mathf.Abs (FadeInAlpha - Alpha) < Threshold)
Alpha = FadeInAlpha;
col = Bg.color;
col.a = Alpha;
Bg.color = col;
yield return new WaitForEndOfFrame();
}
yield return 0;
}

public IEnumerator DelayToStart(){
yield return new WaitForSeconds(DelayTime);
SceneManager.LoadScene ("StartMenu");
yield return 0;
}
}
12 changes: 12 additions & 0 deletions Assets/EndScreen.cs.meta

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

1 change: 1 addition & 0 deletions Assets/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ void Update () {

public void EndGame(){
IsPlaying = false;
GameObject.Find ("EndGameScreen").GetComponent<EndScreen> ().FadeIn ();
Destroy(GameObject.Find ("P1"));
}

Expand Down
12 changes: 12 additions & 0 deletions Assets/OnClickLoadScene.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class OnClickLoadScene : MonoBehaviour {
public string SceneName;

public void LoadScene(){
SceneManager.LoadScene (SceneName);
}
}
12 changes: 12 additions & 0 deletions Assets/OnClickLoadScene.cs.meta

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

Binary file modified Assets/Prefabs/Bullet.prefab
Binary file not shown.
11 changes: 11 additions & 0 deletions Assets/QuitButton.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class QuitButton : MonoBehaviour {

// Use this for initialization
public void Quit(){
Application.Quit();
}
}
12 changes: 12 additions & 0 deletions Assets/QuitButton.cs.meta

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

Binary file modified Assets/Scenes/Gameplay.unity
Binary file not shown.
Binary file added Assets/Scenes/StartMenu.unity
Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/Scenes/StartMenu.unity.meta

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

2 changes: 1 addition & 1 deletion Assets/Scripts/AutoGun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void Awake() {
for (int i = 0; i < maxBullets; i++)
bullets[i] = Instantiate(bullet, offset, transform.rotation) as GameObject;

InvokeRepeating("Shoot", 1f, 1f);
InvokeRepeating("Shoot", 2f, 2f);
}

/* Rotates the gun around the player. */
Expand Down
31 changes: 23 additions & 8 deletions Assets/Scripts/Bullet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
public class Bullet : MonoBehaviour {
public AudioClip cancel;
public AudioClip bounce;

int timeDown = 15;
Color raw = Color.blue;
Color pain = Color.red;
public Color Current;
public int timeDown = 200;
float distanceTraveled = 0;
Vector3 originalPosition;

Expand All @@ -16,17 +18,23 @@ public class Bullet : MonoBehaviour {
/* Gets the components and moves the bullet. */
void Awake() {
originalPosition = transform.position;
hitbox = GetComponent<Collider2D>();
raw = GetComponent<SpriteRenderer>().color;

hitbox = GetComponent<Collider2D>();
hitbox.enabled = false;
rb = GetComponent<Rigidbody2D>();
audio = GetComponent<AudioSource>();
Hide();
}
void Update(){
distanceTraveled = Mathf.Pow(Mathf.Pow(transform.position.x - originalPosition.x, 2) + Mathf.Pow(transform.position.y - originalPosition.y, 2), 0.5f);
if (!hitbox.enabled && distanceTraveled > 1)
if (!hitbox.enabled && distanceTraveled > 2)
hitbox.enabled = true;
timeDown--;
Time.timeScale = 1.2f;
if(timeDown>0)
timeDown--;

GetComponent<SpriteRenderer>().color = Current = Color.Lerp(pain, raw, mapClamped(timeDown, 0, 1500, 0.0f, 1.0f));
}
/* Destroys the bullet; is called after the sound plays. */
void Hide() {
Expand All @@ -39,7 +47,9 @@ public void Renew(Vector3 position, Vector3 rotation){
Hide();
transform.position = originalPosition = position;
transform.eulerAngles = rotation; // Rotation may not matter for the bullet.... unsure tho so I'll leave it :P
rb.AddForce(new Vector2(rotation.x, rotation.y));
rb.AddForce(new Vector2(rotation.x, rotation.y)*1.6f/5f);
Current = Color.blue;
timeDown = 100;
}
/* Handles walls, players, and other bullets. */
void OnCollisionEnter2D (Collision2D coll) {
Expand All @@ -59,11 +69,16 @@ void OnCollisionEnter2D (Collision2D coll) {
}

public bool IsReady(){
return timeDown <= 0;
bool b = timeDown <= 0;
return b;
}

public float getDistanceTraveled(){
return distanceTraveled;
}


public float mapClamped(float r, float a, float b, float c, float d)
{
return ((r - a) / (b - a)) * (d - c) + c;
}
}
18 changes: 8 additions & 10 deletions Assets/Scripts/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,22 @@ void Movement(){
bool horizontalMovement = true;

if (Input.GetKey(up))
rb.velocity = Vector2.up * speed;
rb.velocity = Vector2.up;
else if (Input.GetKey(down))
rb.velocity = -Vector2.up * speed;
rb.velocity = -Vector2.up;
else
verticalMovement = false;
rb.velocity = Vector2.zero;

if (Input.GetKey(left))
rb.velocity = -Vector2.right * speed;
rb.velocity += -Vector2.right;
else if (Input.GetKey(right))
rb.velocity = Vector2.right * speed;
else
horizontalMovement = false;
rb.velocity += Vector2.right;

rb.velocity = rb.velocity.normalized * speed;

if(!verticalMovement && !horizontalMovement){
rb.velocity = Vector3.zero;
if(rb.velocity.magnitude<0.01f){
rb.angularVelocity = 0;
}

screenPos = camera.WorldToScreenPoint(transform.position);
}

Expand Down
14 changes: 14 additions & 0 deletions Assets/SetTextEqualTo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class SetTextEqualTo : MonoBehaviour {
public Text Target;
public Text ThisText;

// Update is called once per frame
void Update () {
ThisText.text = Target.text;
}
}
12 changes: 12 additions & 0 deletions Assets/SetTextEqualTo.cs.meta

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

24 changes: 24 additions & 0 deletions Logs/Packages-Update.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

=== Sat Aug 3 03:25:41 2019

Packages were changed.
Update Mode: updateDependencies

The following packages were added:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
The following packages were updated:
com.unity.analytics from version 2.0.16 to 3.3.2
com.unity.package-manager-ui from version 1.9.11 to 2.2.0
com.unity.purchasing from version 2.0.3 to 2.0.6
com.unity.textmeshpro from version 1.2.4 to 2.0.1
51 changes: 51 additions & 0 deletions Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"dependencies": {
"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.tilemap": "1.0.0",
"com.unity.ads": "2.0.8",
"com.unity.analytics": "3.3.2",
"com.unity.collab-proxy": "1.2.16",
"com.unity.ext.nunit": "1.0.0",
"com.unity.ide.rider": "1.0.8",
"com.unity.ide.vscode": "1.0.7",
"com.unity.multiplayer-hlapi": "1.0.2",
"com.unity.package-manager-ui": "2.2.0",
"com.unity.purchasing": "2.0.6",
"com.unity.test-framework": "1.0.13",
"com.unity.textmeshpro": "2.0.1",
"com.unity.timeline": "1.1.0",
"com.unity.ugui": "1.0.0",
"com.unity.xr.legacyinputhelpers": "2.0.2",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.cloth": "1.0.0",
"com.unity.modules.director": "1.0.0",
"com.unity.modules.imageconversion": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.physics2d": "1.0.0",
"com.unity.modules.screencapture": "1.0.0",
"com.unity.modules.terrain": "1.0.0",
"com.unity.modules.terrainphysics": "1.0.0",
"com.unity.modules.tilemap": "1.0.0",
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.uielements": "1.0.0",
"com.unity.modules.umbra": "1.0.0",
"com.unity.modules.unityanalytics": "1.0.0",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
"com.unity.modules.unitywebrequestaudio": "1.0.0",
"com.unity.modules.unitywebrequesttexture": "1.0.0",
"com.unity.modules.unitywebrequestwww": "1.0.0",
"com.unity.modules.vehicles": "1.0.0",
"com.unity.modules.video": "1.0.0",
"com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0"
}
}
Binary file modified ProjectSettings/EditorBuildSettings.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.
3 changes: 2 additions & 1 deletion ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
m_EditorVersion: 5.5.0f3
m_EditorVersion: 2019.2.0f1
m_EditorVersionWithRevision: 2019.2.0f1 (20c1667945cf)
Binary file not shown.
Loading

0 comments on commit 2d08c8a

Please sign in to comment.