Skip to content

Commit

Permalink
Win menu hack
Browse files Browse the repository at this point in the history
  • Loading branch information
danqiye1 committed Dec 18, 2020
1 parent 2688a98 commit 8409176
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
7 changes: 6 additions & 1 deletion Assets/Scenes/Play Level.unity
Original file line number Diff line number Diff line change
Expand Up @@ -358711,7 +358711,7 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1882031589}
m_LocalRotation: {x: 0.1064902, y: -0.0022560386, z: 0.00024162054, w: 0.99431115}
m_LocalRotation: {x: 0.1064902, y: -0.0022560388, z: 0.00024162055, w: 0.99431115}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
Expand Down Expand Up @@ -409024,6 +409024,11 @@ PrefabInstance:
propertyPath: GodModeIndicator
value:
objectReference: {fileID: 250873899}
- target: {fileID: 1220512134839435321, guid: b5fe2a65e2bbb491da9870f9767ebdc6,
type: 3}
propertyPath: flag
value:
objectReference: {fileID: 1412293294}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b5fe2a65e2bbb491da9870f9767ebdc6, type: 3}
--- !u!1001 &6575436717421826410
Expand Down
26 changes: 9 additions & 17 deletions Assets/Scripts/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class Player : MonoBehaviour
// Winning Mechanics
public GameObject WinMenu;
public GameObject LoseMenu;
public GameObject flag;

public bool GodMode = true;
public GameObject GodModeIndicator;
Expand Down Expand Up @@ -61,12 +62,6 @@ void Update()
moveSpeed = 2.0f;
}

// Death
// if (Input.GetKey("mouse 1"))
// {
// anim.SetInteger(deathHash, Random.Range(1, 4));
// }

if (direction.magnitude >= 0.1f && isDead == false)
{
// Player Rotation.
Expand Down Expand Up @@ -108,6 +103,14 @@ void Update()
GodModeIndicator.SetActive(GodMode);
}

// Toggle Win
Vector3 DistToFlag = transform.position - flag.transform.position;
if (DistToFlag.magnitude <= 1){
// Win
WinMenu.SetActive(true);
GodMode = true;
}


}

Expand All @@ -129,15 +132,4 @@ void OnCollisionEnter(Collision collision){
}
}

// Death from hitting a bullet
void OnCollisionTrigger(Collision collision){

if(collision.transform.CompareTag("Flag"))
{
// Win
WinMenu.SetActive(true);
Debug.Log("Win");
}
}

}

0 comments on commit 8409176

Please sign in to comment.