Commit 79146561 authored by Andrew Van Buren's avatar Andrew Van Buren

Added in a bunch of fixes

parent 4f5c0d00
......@@ -13,49 +13,49 @@ AnimatorController:
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: walk state
m_Type: 1
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: on ground
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: on wall
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: is wall sliding
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: is dashing
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: is dead
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: jump failed
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
......@@ -655,6 +655,30 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &1101839230351870134
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: is dead
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1102112602750143940}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.1
m_TransitionOffset: 0
m_ExitTime: 0.9
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &1101909886002805576
AnimatorStateTransition:
m_ObjectHideFlags: 3
......@@ -1127,6 +1151,7 @@ AnimatorStateMachine:
m_ChildStateMachines: []
m_AnyStateTransitions:
- {fileID: 1101125233811007622}
- {fileID: 1101839230351870134}
m_EntryTransitions: []
m_StateMachineTransitions:
data:
......
......@@ -23,7 +23,7 @@ GameObject:
- component: {fileID: 58460928687217622}
- component: {fileID: 50635277209838516}
- component: {fileID: 114154880416009188}
m_Layer: 0
m_Layer: 10
m_Name: CaramelBullet
m_TagString: Untagged
m_Icon: {fileID: 0}
......@@ -38,7 +38,7 @@ Transform:
m_GameObject: {fileID: 1971150978506544}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3.84, y: 0.16, z: 2.3632812}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
......@@ -59,7 +59,7 @@ Rigidbody2D:
m_AngularDrag: 0.05
m_GravityScale: 0
m_Material: {fileID: 0}
m_Interpolate: 0
m_Interpolate: 1
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 4
......
This diff is collapsed.
......@@ -583,7 +583,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1784255690954616}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.63, y: 3.54, z: 0}
m_LocalPosition: {x: 16.55, y: 6.36, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4838104525842692}
......@@ -1007,7 +1007,11 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
inputButtons:
disableScripts: []
disableScripts:
- {fileID: 114296284101528218}
- {fileID: 114496983445290320}
- {fileID: 114468523229820794}
state: 0
--- !u!114 &114468523229820794
MonoBehaviour:
m_ObjectHideFlags: 1
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1382304722217016}
m_IsPrefabParent: 1
--- !u!1 &1382304722217016
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224836438208060128}
- component: {fileID: 222474643737891492}
- component: {fileID: 114813025803214224}
- component: {fileID: 114401677657256440}
- component: {fileID: 114032482133026322}
m_Layer: 5
m_Name: Timer
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &114032482133026322
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1382304722217016}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -900027084, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: 1}
m_EffectDistance: {x: 1, y: -1}
m_UseGraphicAlpha: 1
--- !u!114 &114401677657256440
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1382304722217016}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -900027084, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: 1}
m_EffectDistance: {x: 1, y: -1}
m_UseGraphicAlpha: 1
--- !u!114 &114813025803214224
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1382304722217016}
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: 50
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 5
m_MaxSize: 50
m_Alignment: 1
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 0:00
--- !u!222 &222474643737891492
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1382304722217016}
--- !u!224 &224836438208060128
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1382304722217016}
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: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 100}
m_Pivot: {x: 0.5, y: 1}
fileFormatVersion: 2
guid: 3250d15522aae754884637e591293e42
timeCreated: 1492735056
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
......@@ -27,41 +27,6 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1213563030062332
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224183741010064344}
- component: {fileID: 223259577501980542}
- component: {fileID: 114465074132951858}
- component: {fileID: 114662074409595724}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1358550398907514
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224209094075702104}
- component: {fileID: 222661001081291610}
- component: {fileID: 114712972450195582}
m_Layer: 5
m_Name: Timer
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4925115359248076
Transform:
m_ObjectHideFlags: 1
......@@ -71,48 +36,10 @@ Transform:
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:
- {fileID: 224183741010064344}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &114465074132951858
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1213563030062332}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!114 &114662074409595724
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1213563030062332}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &114705734518377386
MonoBehaviour:
m_ObjectHideFlags: 1
......@@ -124,100 +51,4 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: cad3061263b98c140a9a3a49d70204c9, type: 3}
m_Name:
m_EditorClassIdentifier:
waitTime: 0
timerText: {fileID: 114712972450195582}
--- !u!114 &114712972450195582
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1358550398907514}
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: 0.19607843, g: 1, b: 0, 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: Timer
--- !u!222 &222661001081291610
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1358550398907514}
--- !u!223 &223259577501980542
Canvas:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1213563030062332}
m_Enabled: 1
serializedVersion: 2
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &224183741010064344
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1213563030062332}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 224209094075702104}
m_Father: {fileID: 4925115359248076}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!224 &224209094075702104
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1358550398907514}
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: 224183741010064344}
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: -228.5, y: -120.5}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
waitTime: 1
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -9,18 +9,19 @@ public class GameManager : SingletonBehaviour<GameManager>
//Manages game state. Pause, death, win, changing levels, and level time.
public float waitTime;
private bool _isPaused;
private float _levelTimer;
public Text timerText;
private float _levelTimer;
private Text timerText;
private GameObject birb;
void Awake()
{
birb = GameObject.Find("Player");
birb = GameObject.FindGameObjectWithTag("Player");
DontDestroyOnLoad(this);
//isPaused = true;
}
public bool isPaused
public bool isPaused
{
get
{
......@@ -52,13 +53,20 @@ public class GameManager : SingletonBehaviour<GameManager>
public static void Fail()
{
Debug.Log("You have died");
GameManager.instance.Invoke("ReloadScene", GameManager.instance.waitTime);
if (!GameManager.instance.birb) {
GameManager.instance.birb = GameObject.FindGameObjectWithTag("Player");
}
if (!GameManager.instance.birb.GetComponent<Birb>().isDead) {
GameManager.instance.birb.SendMessage("Die");
}
GameManager.instance.Invoke("ReloadScene", GameManager.instance.waitTime);
}
void ReloadScene()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
public static void Win()
}
public static void Win()
{
Debug.Log("You won!");
}
......@@ -77,7 +85,10 @@ public class GameManager : SingletonBehaviour<GameManager>
//updates the text object
void Update()
{
string currentTime = formatTime(Time.time - levelTimer);
if (!timerText) {
timerText = GameObject.FindGameObjectWithTag("Timer").GetComponent<Text>();
}
string currentTime = formatTime(Time.time - levelTimer);
timerText.text = "Time: " + currentTime;
}
......
......@@ -18,7 +18,9 @@ public class enemyRanged : HorizontalEnemy
[Tooltip("Flips the collider and projectile")]
public bool isFacingRight; //modifies the velocity of the fired projectile according to direction
public float angleOfSpread; //the greatest possible angle from the center projectiles can randomly spread; ******entered in radians*******
public float angleOfSpread; //the greatest possible angle from the center projectiles can randomly spread; ******entered in radians*******
private GameObject player;
protected override void Start ()
{
......@@ -26,6 +28,8 @@ public class enemyRanged : HorizontalEnemy
fireTimer = 0;
if (isFacingRight) fieldOfView.gameObject.transform.localPosition = new Vector2(-fieldOfView.gameObject.transform.localPosition.x, fieldOfView.gameObject.transform.localPosition.y);
//fieldOfView.enabled = false;
player = GameObject.FindGameObjectWithTag("Player");
}
protected override void Update ()
......@@ -36,7 +40,8 @@ public class enemyRanged : HorizontalEnemy
{
isFacingRight = !isFacingRight;
}
if (fieldOfView.IsTouching(GameObject.Find("Player").GetComponent<Collider2D>())) //if the player is in view
//if (fieldOfView.IsTouching(GameObject.Find("Player").GetComponent<Collider2D>())) //if the player is in view
if(fieldOfView.bounds.Contains(player.transform.position))
{
if (fireTimer <= 0)
{
......@@ -60,13 +65,13 @@ public class enemyRanged : HorizontalEnemy
float generatedAngle = Random.Range(-angleOfSpread,angleOfSpread);
Vector2 directionModifier = new Vector2(Mathf.Cos(generatedAngle), Mathf.Sin(generatedAngle)); //unit vector for projectile spread
GameObject projectileInstance = Instantiate(projectile,gameObject.transform);
projectileInstance.transform.position = transform.position;
// Flip projectile
Vector3 locScale = projectileInstance.transform.localScale;
locScale.x *= isFacingRight ? -1 : 1;
projectileInstance.transform.localScale = locScale;
GameObject projectileInstance = Instantiate(projectile, transform.position, Quaternion.identity);
// Flip projectile
//Vector3 locScale = projectileInstance.transform.localScale;
//locScale.x *= isFacingRight ? -1 : 1;
//projectileInstance.transform.localScale = locScale;
projectileInstance.GetComponent<SpriteRenderer>().flipX = !isFacingRight;
if (isFacingRight)
......
......@@ -48,12 +48,15 @@ public class Birb : AbstractBehavior {
public void Die()
{
Debug.Log("die");
isDead = true;
animator.SetBool("is dead", true);
body.isKinematic = true;
body.velocity = Vector2.zero;
new WaitForSeconds(5);
GameManager.Fail ();
GetComponent<Collider2D>().enabled = false;
ToggleScripts(false);
//new WaitForSeconds(5);
//GameManager.Fail ();
}
// //Determines if the animation state must change.
......
......@@ -2,15 +2,20 @@
using System.Collections.Generic;
using UnityEngine;
public class Hazard : MonoBehaviour {
public class Hazard : MonoBehaviour {
void OnTriggerEnter2D(Collider2D other) {
if (other.CompareTag("Player")) {
void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Player"))
{
GameManager.Fail();
other.GetComponent<Birb>().Die ();
other.gameObject.SendMessage("Die", SendMessageOptions.DontRequireReceiver);
}
}
void OnCollisionEnter2D(Collision2D other) {
if (other.transform.CompareTag("Player")) {
GameManager.Fail();
}
}
......
......@@ -31,4 +31,4 @@ Physics2DSettings:
m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432}