Skip to content

Commit

Permalink
Merge pull request #21 from MatthewGlenn/MG-RecordEnding
Browse files Browse the repository at this point in the history
Mg record ending
  • Loading branch information
MatthewGlenn authored Jan 27, 2019
2 parents fd54b72 + 74b1143 commit be29d93
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 45 deletions.
3 changes: 2 additions & 1 deletion Assets/Prefabs/AudioManager.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
efxSource: {fileID: 7556121528414028830}
BackgroundMusic: {fileID: 0}
roomAudioSrc: {fileID: 1043193366}
lowPitchRange: 0.95
highPitchRange: 1.05
Expand All @@ -61,7 +62,7 @@ AudioSource:
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 0
m_Volume: 0.010424996
m_Volume: 0.77936083
m_Pitch: 1
Loop: 0
Mute: 0
Expand Down
45 changes: 27 additions & 18 deletions Assets/Scenes/RTScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,11 @@ PrefabInstance:
propertyPath: roomAudioSrc
value:
objectReference: {fileID: 1043193366}
- target: {fileID: 7556121528414028825, guid: a1ef97c18c4983e45acdd7ed2729b217,
type: 3}
propertyPath: BackgroundMusic
value:
objectReference: {fileID: 999982144}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a1ef97c18c4983e45acdd7ed2729b217, type: 3}
--- !u!1 &109848341
Expand Down Expand Up @@ -1083,15 +1088,14 @@ PrefabInstance:
propertyPath: m_LocalPosition.y
value: -3.9
objectReference: {fileID: 0}
- target: {fileID: 1628204757, guid: f30afaa21e84a4832a0e3bd8f10c7f4b, type: 3}
propertyPath: playerObject
value:
objectReference: {fileID: 380454585}
- target: {fileID: 1628204757, guid: f30afaa21e84a4832a0e3bd8f10c7f4b, type: 3}
propertyPath: audioObject
value:
objectReference: {fileID: 7556121528414028831, guid: a1ef97c18c4983e45acdd7ed2729b217,
type: 3}
- target: {fileID: 1628204753, guid: f30afaa21e84a4832a0e3bd8f10c7f4b, type: 3}
propertyPath: m_TagString
value: Record
objectReference: {fileID: 0}
- target: {fileID: 371150386, guid: f30afaa21e84a4832a0e3bd8f10c7f4b, type: 3}
propertyPath: m_SortingOrder
value: -2500
objectReference: {fileID: 0}
- target: {fileID: 410923706, guid: f30afaa21e84a4832a0e3bd8f10c7f4b, type: 3}
propertyPath: playerObject
value:
Expand Down Expand Up @@ -1121,10 +1125,15 @@ PrefabInstance:
propertyPath: m_Size.y
value: 0.29527855
objectReference: {fileID: 0}
- target: {fileID: 371150386, guid: f30afaa21e84a4832a0e3bd8f10c7f4b, type: 3}
propertyPath: m_SortingOrder
value: -2500
objectReference: {fileID: 0}
- target: {fileID: 1628204757, guid: f30afaa21e84a4832a0e3bd8f10c7f4b, type: 3}
propertyPath: playerObject
value:
objectReference: {fileID: 380454585}
- target: {fileID: 1628204757, guid: f30afaa21e84a4832a0e3bd8f10c7f4b, type: 3}
propertyPath: audioObject
value:
objectReference: {fileID: 7556121528414028831, guid: a1ef97c18c4983e45acdd7ed2729b217,
type: 3}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f30afaa21e84a4832a0e3bd8f10c7f4b, type: 3}
--- !u!4 &262580990 stripped
Expand Down Expand Up @@ -2789,6 +2798,11 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4701830803569978032, guid: fc7a14f17e469b8479bbf316b92e41f3,
type: 3}
propertyPath: m_Name
value: Journal
objectReference: {fileID: 0}
- target: {fileID: 4701830803569978033, guid: fc7a14f17e469b8479bbf316b92e41f3,
type: 3}
propertyPath: m_LocalPosition.x
Expand Down Expand Up @@ -2859,11 +2873,6 @@ PrefabInstance:
propertyPath: m_LocalScale.z
value: 0.21411443
objectReference: {fileID: 0}
- target: {fileID: 4701830803569978032, guid: fc7a14f17e469b8479bbf316b92e41f3,
type: 3}
propertyPath: m_Name
value: Journal
objectReference: {fileID: 0}
- target: {fileID: 4701830803569978045, guid: fc7a14f17e469b8479bbf316b92e41f3,
type: 3}
propertyPath: m_SortingOrder
Expand Down
25 changes: 25 additions & 0 deletions Assets/Scripts/AudioManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
public class AudioManager : MonoBehaviour
{
public AudioSource efxSource;
public AudioSource BackgroundMusic;
public AudioSource roomAudioSrc;
private AudioClip roomAudio;

Expand Down Expand Up @@ -51,4 +52,28 @@ public void removeRoomAudio()
roomAudioSrc.Stop();
}

public void Update()
{

}

public void StopAllMusic(){
// if( GameObject.FindGameObjectsWithTag("Record").Length == 0 || GameObject.FindGameObjectsWithTag("Item").Length < 9 )
// {
// Debug.Log("Stop all the music");
// //On Game End Pause Music
// roomAudioSrc.Stop();
// efxSource.Stop();
// BackgroundMusic.Stop();

// //Play Cinder
// }

Debug.Log("Stop all the music");
//On Game End Pause Music
roomAudioSrc.Stop();
efxSource.Stop();
BackgroundMusic.Stop();
}

}
6 changes: 5 additions & 1 deletion Assets/Scripts/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ void Update()
hasPlayerChoosen = true;
}
}

if( GameObject.FindGameObjectsWithTag("Record").Length == 0 )
{
Debug.Log("Should Fade to black");
FadeToBlack();
}
}

public void FadeToBlack() {
Expand Down
79 changes: 55 additions & 24 deletions Assets/Scripts/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void Start()
**/
private void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Item" || other.tag == "Interactable" || other.tag == "Trash" )
if (other.tag == "Item" || other.tag == "Interactable" || other.tag == "Trash" || other.tag == "Record")
{
isTouching = true;
touchingObject = other;
Expand Down Expand Up @@ -142,13 +142,40 @@ private void Interact()
}
//If the object is an Item, add it to player's "heldItem"
//and remove it from play
else if( touchingObject.tag == "Item" )
else if( touchingObject.tag == "Item" && holdingItem == false )
{
if (tutorialArrow){
Destroy(tutorialArrow);
tutorialArrow = null;
}
AudioManager.instance.PlaySingle(pickup);

tossItem();

}
//If the object is an Interactable decoration, make it do a special animation
else if(touchingObject.tag == "Interactable")
{
animator.SetTrigger("StandStill");

}else if( touchingObject.tag == "Record" && holdingItem == false )
{
int itemsLeftToPickUp = GameObject.FindGameObjectsWithTag("Item").Length;
Debug.Log("Items Left: " + itemsLeftToPickUp);
if(itemsLeftToPickUp == 0){
Debug.Log("Throw away Record Player");
tossItem();
// TODO: Game Ending
}else{
Debug.Log("Print Record Player Message");
heldItem = touchingObject.gameObject.GetComponent<Item>();
memory = heldItem.memory;
printTextMemory();
}
}
}

void tossItem(){
AudioManager.instance.PlaySingle(pickup);
animator.SetTrigger("StandStillWithItem");

heldItem = touchingObject.gameObject.GetComponent<Item>();
Expand All @@ -160,23 +187,21 @@ private void Interact()
holdingItem = true;
// touchingObject.gameObject.SetActive(false);
// touchingObject = null;
}
//If the object is an Interactable decoration, make it do a special animation
else if(touchingObject.tag == "Interactable")
{
animator.SetTrigger("StandStill");

}



}

void Update() {
// Z-index fix
spriteRenderer.sortingOrder = (int) (_playerTransform.position.y * -100);
}

void printTextMemory(){
var tempColor = _textBackgroundImage.color;
tempColor.a = 0.75f;
_textBackgroundImage.color = tempColor;
txtAdv++;
printMemory.text = memory.Substring(0, (txtAdv / 2));
}

//FixedUpdate is called at a fixed interval and is independent of frame rate. Put physics code here.
void FixedUpdate()
{
Expand All @@ -187,18 +212,24 @@ void FixedUpdate()

if (holdingItem && (txtAdv <= memory.Length * 2))
{
var tempColor = _textBackgroundImage.color;
tempColor.a = 0.75f;
_textBackgroundImage.color = tempColor;
txtAdv++;
printMemory.text = memory.Substring(0, (txtAdv / 2));
printTextMemory();
}else if (touchingObject != null && memory != null && isTouching == true)
{
if (touchingObject.tag == "Record" && (txtAdv <= memory.Length * 2))
{
printTextMemory();
}else{
// printMemory.text = "";
// memory = "";
// var tempColor = _textBackgroundImage.color;
// tempColor.a = 0.0f;
// _textBackgroundImage.color = tempColor;
}
}
else
{
txtAdv = 0;
}
// else
// {
// var tempColor = _textBackgroundImage.color;
// tempColor.a = 0.0f;
// _textBackgroundImage.color = tempColor;
// }

//check if player has hit Space Bar
if (Input.GetKeyDown("space"))
Expand Down
3 changes: 2 additions & 1 deletion ProjectSettings/TagManager.asset
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ TagManager:
- ZSort
- Undefined
- Trash
- Record
layers:
- Default
- TransparentFX
Expand Down Expand Up @@ -53,4 +54,4 @@ TagManager:
locked: 0
- name: Unit
uniqueID: 697606553
locked: 0
locked: 0

0 comments on commit be29d93

Please sign in to comment.