Lots of changes
This commit is contained in:
parent
312afd0cae
commit
f5533407b9
13 changed files with 97468 additions and 123 deletions
Binary file not shown.
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.5 KiB |
|
@ -4078,6 +4078,47 @@ SpriteRenderer:
|
|||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
--- !u!1 &95581932
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 95581934}
|
||||
- component: {fileID: 95581933}
|
||||
m_Layer: 0
|
||||
m_Name: LevelController
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &95581933
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 95581932}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 61cd1d4ed12e73d4d89f6301bb296452, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
winText: {fileID: 1346051377}
|
||||
--- !u!4 &95581934
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 95581932}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 1.39, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 9
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &98167301
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -8723,7 +8764,7 @@ Transform:
|
|||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 195543022}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 8.5388, y: 20.908, z: 0}
|
||||
m_LocalPosition: {x: 1.37, y: -1.28, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 644993876}
|
||||
|
@ -20647,7 +20688,7 @@ Rigidbody2D:
|
|||
m_Mass: 1
|
||||
m_LinearDrag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_GravityScale: 5
|
||||
m_GravityScale: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_Interpolate: 1
|
||||
m_SleepingMode: 1
|
||||
|
@ -20665,9 +20706,8 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
jumpPower: 15
|
||||
rocketPrefab: {fileID: 1704205186022040, guid: 34e7aebb9fac79643b1a3450a3891e90,
|
||||
rocketPrefab: {fileID: 1994979455912998, guid: 74c48da302c436644b93f93d394a39f3,
|
||||
type: 2}
|
||||
winText: {fileID: 476302442}
|
||||
--- !u!212 &440329286
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -22574,80 +22614,6 @@ SpriteRenderer:
|
|||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
--- !u!1 &476302440
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 476302441}
|
||||
- component: {fileID: 476302443}
|
||||
- component: {fileID: 476302442}
|
||||
m_Layer: 5
|
||||
m_Name: Win Text
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &476302441
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 476302440}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1636734163}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 50}
|
||||
m_SizeDelta: {x: 160, y: 30}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &476302442
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 476302440}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 14
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 10
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 0
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text:
|
||||
--- !u!222 &476302443
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 476302440}
|
||||
--- !u!1 &476514443
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -63055,6 +63021,80 @@ SpriteRenderer:
|
|||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
--- !u!1 &1346051376
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 1346051379}
|
||||
- component: {fileID: 1346051378}
|
||||
- component: {fileID: 1346051377}
|
||||
m_Layer: 5
|
||||
m_Name: Win Text
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1346051377
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1346051376}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 100
|
||||
m_FontStyle: 1
|
||||
m_BestFit: 0
|
||||
m_MinSize: 0
|
||||
m_MaxSize: 100
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 1
|
||||
m_VerticalOverflow: 1
|
||||
m_LineSpacing: 1
|
||||
m_Text:
|
||||
--- !u!222 &1346051378
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1346051376}
|
||||
--- !u!224 &1346051379
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1346051376}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 0}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1636734163}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 160, y: 30}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &1348709894
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -74815,7 +74855,7 @@ RectTransform:
|
|||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_Children:
|
||||
- {fileID: 476302441}
|
||||
- {fileID: 1346051379}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 7
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
93873
Game 1/Assets/Levels/Level1.unity
Normal file
93873
Game 1/Assets/Levels/Level1.unity
Normal file
File diff suppressed because it is too large
Load diff
8
Game 1/Assets/Levels/Level1.unity.meta
Normal file
8
Game 1/Assets/Levels/Level1.unity.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 322c8dfc43ff2b24b926087d36ef357d
|
||||
timeCreated: 1504760226
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 34e7aebb9fac79643b1a3450a3891e90
|
||||
timeCreated: 1504654990
|
||||
guid: 74c48da302c436644b93f93d394a39f3
|
||||
timeCreated: 1504761746
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 100100000
|
||||
|
|
|
@ -6,6 +6,7 @@ public class Explosion : MonoBehaviour {
|
|||
|
||||
public PlayerController player;
|
||||
private float MAX_PLAYER_DIST = 3.0f;
|
||||
private float EXPLOSION_FORCE = 10.0f;
|
||||
|
||||
void Start () {
|
||||
Vector3 playerPos = player.transform.position;
|
||||
|
@ -13,9 +14,8 @@ public class Explosion : MonoBehaviour {
|
|||
if (dist < MAX_PLAYER_DIST)
|
||||
{
|
||||
Rigidbody2D playerBody = player.GetComponent<Rigidbody2D>();
|
||||
Vector2 force = (playerPos - transform.position).normalized * (MAX_PLAYER_DIST - dist) * 15.0f;
|
||||
Vector2 force = (playerPos - transform.position).normalized * (MAX_PLAYER_DIST - dist) * EXPLOSION_FORCE;
|
||||
playerBody.AddForce(force, ForceMode2D.Impulse);
|
||||
Debug.Log(force);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
50
Game 1/Assets/Scripts/LevelController.cs
Normal file
50
Game 1/Assets/Scripts/LevelController.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class LevelController : MonoBehaviour {
|
||||
|
||||
public Text winText;
|
||||
protected static LevelController levelController;
|
||||
private bool wonLevel = false;
|
||||
|
||||
void Start () {
|
||||
if (levelController)
|
||||
{
|
||||
Destroy(this);
|
||||
}
|
||||
levelController = this;
|
||||
}
|
||||
|
||||
public static LevelController GetController()
|
||||
{
|
||||
if (levelController)
|
||||
return levelController;
|
||||
Debug.LogError("A LevelController object is not present in this scene.");
|
||||
return null;
|
||||
}
|
||||
|
||||
public void WinLevel()
|
||||
{
|
||||
wonLevel = true;
|
||||
winText.text = "YOU WIN!";
|
||||
StartCoroutine(DelayLoadLevel("Level1", 3.0f));
|
||||
}
|
||||
|
||||
public void ResetLevel()
|
||||
{
|
||||
if (wonLevel)
|
||||
return;
|
||||
winText.text = "TRY AGAIN!";
|
||||
StartCoroutine(DelayLoadLevel(SceneManager.GetActiveScene().name, 2.0f));
|
||||
}
|
||||
|
||||
public IEnumerator DelayLoadLevel(string levelName, float delay)
|
||||
{
|
||||
yield return new WaitForSeconds(delay);
|
||||
SceneManager.LoadScene(levelName);
|
||||
yield return null;
|
||||
}
|
||||
}
|
12
Game 1/Assets/Scripts/LevelController.cs.meta
Normal file
12
Game 1/Assets/Scripts/LevelController.cs.meta
Normal file
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 61cd1d4ed12e73d4d89f6301bb296452
|
||||
timeCreated: 1504759397
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -10,27 +10,25 @@ public class PlayerController : MonoBehaviour {
|
|||
|
||||
public float jumpPower;
|
||||
public GameObject rocketPrefab;
|
||||
|
||||
public Text winText;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
}
|
||||
private float reloadTime = 0.5f;
|
||||
private bool reloading = false;
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
// Basic jumping
|
||||
/*// Basic jumping
|
||||
if (Input.GetKeyDown (KeyCode.Space)) {
|
||||
GetComponent<Rigidbody2D> ().velocity = new Vector2 (0, jumpPower);
|
||||
}
|
||||
}*/
|
||||
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
if (Input.GetMouseButtonDown(0) && !reloading)
|
||||
{
|
||||
reloading = true;
|
||||
StartCoroutine("Reload");
|
||||
Vector2 rocketPos = transform.position;
|
||||
GameObject rocket = Instantiate(rocketPrefab, rocketPos, Quaternion.identity);
|
||||
rocket.GetComponent<RocketController>().player = this;
|
||||
Physics2D.IgnoreCollision(rocket.GetComponent<Collider2D>(), GetComponent<Collider2D>());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,12 +36,19 @@ public class PlayerController : MonoBehaviour {
|
|||
{
|
||||
//Check the provided Collider2D parameter other to see if it is tagged "PickUp", if it is...
|
||||
if (other.gameObject.CompareTag ("Finish Line")) {
|
||||
winText.text = "You Win!";
|
||||
LevelController.GetController().WinLevel();
|
||||
}
|
||||
|
||||
// Deathbox and saws restart level
|
||||
if (other.gameObject.CompareTag ("Deathbox")) {
|
||||
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
|
||||
LevelController.GetController().ResetLevel();
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator Reload()
|
||||
{
|
||||
yield return new WaitForSeconds(reloadTime);
|
||||
reloading = false;
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,10 +6,12 @@ public class RocketController : MonoBehaviour {
|
|||
|
||||
public PlayerController player;
|
||||
public GameObject explosionPrefab;
|
||||
private float ROCKET_SPEED = 20.0f;
|
||||
private float ROCKET_SPEED = 10.0f;
|
||||
private float ROCKET_LIFETIME = 5.0f;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
StartCoroutine(DestroyAfterTime());
|
||||
Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
Vector2 playerPos = player.transform.position;
|
||||
Vector2 rocketDir = (mousePos - playerPos).normalized;
|
||||
|
@ -24,15 +26,19 @@ public class RocketController : MonoBehaviour {
|
|||
void OnCollisionEnter2D(Collision2D collision)
|
||||
{
|
||||
if (collision.gameObject.layer == LayerMask.NameToLayer("Player"))
|
||||
{
|
||||
Debug.Log("Player Collision Detected");
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 explosionPos = transform.position;
|
||||
Vector3 explosionPos = collision.contacts[0].point;
|
||||
explosionPos.z = 0;
|
||||
GameObject explosion = Instantiate(explosionPrefab, explosionPos, Quaternion.identity);
|
||||
explosion.GetComponent<Explosion>().player = player;
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
IEnumerator DestroyAfterTime()
|
||||
{
|
||||
yield return new WaitForSeconds(ROCKET_LIFETIME);
|
||||
Destroy(gameObject);
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,4 +4,10 @@
|
|||
EditorBuildSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Scenes: []
|
||||
m_Scenes:
|
||||
- enabled: 1
|
||||
path: Assets/Levels/Level0.unity
|
||||
guid: 5dc8391a13432fd4bbed301245e9f53f
|
||||
- enabled: 1
|
||||
path: Assets/Levels/Level1.unity
|
||||
guid: 322c8dfc43ff2b24b926087d36ef357d
|
||||
|
|
Reference in a new issue