Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My branch 9 #14

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3a9e1a8
Removed All Events and Made Project Ready to Start
MalharDevasthali May 2, 2023
efaf2da
Potion Improved
MalharDevasthali May 2, 2023
9bee598
Cleaned PlayerController
MalharDevasthali May 2, 2023
76bc14e
Cleaned PlayerController
MalharDevasthali May 2, 2023
eab183c
Cleaned Camera
MalharDevasthali May 2, 2023
86eeb1e
LightSwitchTodo Setup
MalharDevasthali May 2, 2023
2019d02
Scripts Cleanup
MalharDevasthali May 2, 2023
14c8a77
Final Commit
MalharDevasthali May 2, 2023
991a1e8
Added Sound in MainMenu UI
MalharDevasthali May 2, 2023
b80def1
Added Light Switch Logic Using Delegate
MalharDevasthali May 6, 2023
2151d7c
Added Listerner in Player onLightSwitch
MalharDevasthali May 6, 2023
823019c
Added Listerner in Player onLightSwitch
MalharDevasthali May 6, 2023
de8ad2e
Removed getter
MalharDevasthali May 6, 2023
d3bbc42
Scene Changes
MalharDevasthali May 6, 2023
bb3d035
Final Commit
MalharDevasthali May 6, 2023
93702ae
Added Event Keyword
MalharDevasthali May 6, 2023
f22ab16
Converted event Delegate into event Action
MalharDevasthali May 6, 2023
5195b8d
Revert "Converted event Delegate into event Action"
MalharDevasthali May 6, 2023
0718b8d
Converted delegates into actions
MalharDevasthali May 6, 2023
d940963
Added Event Architecture
MalharDevasthali May 10, 2023
0694d29
Code Cleaning
MalharDevasthali May 10, 2023
818cbca
Added Bad Practice for Keys
MalharDevasthali May 10, 2023
7af302e
Code Cleanup
MalharDevasthali May 16, 2023
49ab3ad
MyBranch-8 Inproving Key Pickup using Generic Events
wirelessUser Feb 13, 2024
93c604b
MyBranch-9 Key Event Logic
wirelessUser Feb 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9,844 changes: 2,542 additions & 7,302 deletions Assets/Art/Prefabs/House.prefab

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions Assets/Scenes/GameScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1801,11 +1801,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5a0c66bf78d82c646a0daaf9ba705624, type: 3}
m_Name:
m_EditorClassIdentifier:
instructionsSO:
- {fileID: 11400000, guid: a67079eb10ed37c4881b56d00e1fd77b, type: 2}
- {fileID: 11400000, guid: 976eff6108d80554e8c16108f7dee769, type: 2}
- {fileID: 11400000, guid: 817f4db30166bfd45ac31f0c8901fdb4, type: 2}
instructionDisplayDuration: 6
rootViewPanel: {fileID: 574964454}
insanityImage: {fileID: 1506977975}
redVignette: {fileID: 1550849811}
Expand Down Expand Up @@ -1913,7 +1908,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
sanityLevel: 100
sanityDropRate: 0.2
sanityDropAmountPerEvent: 10
--- !u!114 &4600010124367288004
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -2342,7 +2336,12 @@ PrefabInstance:
propertyPath: soundService
value:
objectReference: {fileID: 203687011}
m_RemovedComponents: []
m_RemovedComponents:
- {fileID: 8410985324760981946, guid: d2470b45bfcea9e4780d1866d7cd0f8c, type: 3}
- {fileID: 6752750673610657977, guid: d2470b45bfcea9e4780d1866d7cd0f8c, type: 3}
- {fileID: 8410985324735834856, guid: d2470b45bfcea9e4780d1866d7cd0f8c, type: 3}
- {fileID: 3542250534102899431, guid: d2470b45bfcea9e4780d1866d7cd0f8c, type: 3}
- {fileID: 6752750674094668609, guid: d2470b45bfcea9e4780d1866d7cd0f8c, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: d2470b45bfcea9e4780d1866d7cd0f8c, type: 3}
--- !u!65 &8225950124344110251
BoxCollider:
Expand Down
162 changes: 162 additions & 0 deletions Assets/Scenes/MainMenu.unity
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,71 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1001 &466576513
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 9192946658940668405, guid: 5fb9d3aeda3456c4c884e223e16fb778, type: 3}
propertyPath: m_Name
value: SoundService
objectReference: {fileID: 0}
- target: {fileID: 9192946658940668406, guid: 5fb9d3aeda3456c4c884e223e16fb778, type: 3}
propertyPath: audioEffects
value:
objectReference: {fileID: 1040280548}
- target: {fileID: 9192946658940668406, guid: 5fb9d3aeda3456c4c884e223e16fb778, type: 3}
propertyPath: backgroundMusic
value:
objectReference: {fileID: 1040280548}
- target: {fileID: 9192946658940668407, guid: 5fb9d3aeda3456c4c884e223e16fb778, type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 9192946658940668407, guid: 5fb9d3aeda3456c4c884e223e16fb778, type: 3}
propertyPath: m_LocalPosition.x
value: 932.06714
objectReference: {fileID: 0}
- target: {fileID: 9192946658940668407, guid: 5fb9d3aeda3456c4c884e223e16fb778, type: 3}
propertyPath: m_LocalPosition.y
value: 523.13654
objectReference: {fileID: 0}
- target: {fileID: 9192946658940668407, guid: 5fb9d3aeda3456c4c884e223e16fb778, type: 3}
propertyPath: m_LocalPosition.z
value: 4.468608
objectReference: {fileID: 0}
- target: {fileID: 9192946658940668407, guid: 5fb9d3aeda3456c4c884e223e16fb778, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9192946658940668407, guid: 5fb9d3aeda3456c4c884e223e16fb778, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9192946658940668407, guid: 5fb9d3aeda3456c4c884e223e16fb778, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9192946658940668407, guid: 5fb9d3aeda3456c4c884e223e16fb778, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9192946658940668407, guid: 5fb9d3aeda3456c4c884e223e16fb778, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9192946658940668407, guid: 5fb9d3aeda3456c4c884e223e16fb778, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9192946658940668407, guid: 5fb9d3aeda3456c4c884e223e16fb778, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5fb9d3aeda3456c4c884e223e16fb778, type: 3}
--- !u!1 &678034816
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -365,6 +430,7 @@ GameObject:
- component: {fileID: 1040280544}
- component: {fileID: 1040280543}
- component: {fileID: 1040280547}
- component: {fileID: 1040280548}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
Expand Down Expand Up @@ -467,6 +533,102 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
playButton: {fileID: 1583849067}
--- !u!82 &1040280548
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1040280542}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: fd85da68db32afe4c990c066ed309ef1, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &1199653197
GameObject:
m_ObjectHideFlags: 0
Expand Down
53 changes: 1 addition & 52 deletions Assets/Scripts/Camera/CameraView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,8 @@ public class CameraView : MonoBehaviour

private float sensitivity = 1f;
private const float rotationLimit = 0.5f;
private Coroutine shakeCorroutine;

private void OnEnable()
{
EventService.Instance.LightsOffByGhostEvent.AddListener(Shake);
EventService.Instance.PlayerDeathEvent.AddListener(Shake);
EventService.Instance.RatRushEvent.AddListener(Shake);
EventService.Instance.SkullDropEvent.AddListener(Shake);
}

private void OnDisable()
{
EventService.Instance.LightsOffByGhostEvent.RemoveListener(Shake);
EventService.Instance.PlayerDeathEvent.RemoveListener(Shake);
EventService.Instance.RatRushEvent.RemoveListener(Shake);
EventService.Instance.SkullDropEvent.RemoveListener(Shake);
}

private void Start()
{
originalPosition = transform.localPosition;
}
private void Start() => originalPosition = transform.localPosition;

private void Update()
{
Expand All @@ -49,35 +29,4 @@ private void cameraMovement()
transform.Rotate(-velocity, 0, 0);
}
}

private void Shake()
{
if (shakeCorroutine != null)
stopCoroutine(shakeCorroutine);
shakeCorroutine = StartCoroutine(ShakeCoroutine(defaultShakeDuration, defaultShakeMagnitude));
}

private IEnumerator ShakeCoroutine(float shakeDuration, float shakeMagnitude)
{
float elapsedTime = 0f;

while (elapsedTime < shakeDuration)
{
float x = Random.Range(-shakeMagnitude, shakeMagnitude);
float y = Random.Range(-shakeMagnitude, shakeMagnitude);
transform.localPosition = new Vector3(originalPosition.x + x, originalPosition.y, originalPosition.z);
elapsedTime += Time.deltaTime;

yield return null;
}

transform.localPosition = originalPosition;
stopCoroutine(shakeCorroutine);
}

private void stopCoroutine(Coroutine coroutine)
{
StopCoroutine(coroutine);
coroutine = null;
}
}
2 changes: 1 addition & 1 deletion Assets/Scripts/Events.meta

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

32 changes: 21 additions & 11 deletions Assets/Scripts/Events/EventController.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
using System;

public class GameEventController<T>
public class EventController
{
public event Action<T> baseEvent;
public void InvokeEvent(T type) => baseEvent?.Invoke(type);
public void AddListener(Action<T> listener) => baseEvent += listener;
public void RemoveListener(Action<T> listener) => baseEvent -= listener;
public Action baseEvent;
public void AddListener(Action listener) => baseEvent += listener;
public void RemoveListener(Action listener) => baseEvent -= listener;
public void InvokeEvent() => baseEvent?.Invoke();
}

public class GameEventController
public class EventController<T>
{
public event Action baseEvent;
public void InvokeEvent() => baseEvent?.Invoke();
public void AddListener(Action listener) => baseEvent += listener;
public void RemoveListener(Action listener) => baseEvent -= listener;
public Action<T> baseClaasEvent;

}

public void AddLister(Action<T> lister) => baseClaasEvent += lister;

public void RemoveLister(Action<T> lister) => baseClaasEvent -= lister;


public void InvokeEvent(T type)
{

if (baseClaasEvent != null) baseClaasEvent.Invoke(type);

}

}
2 changes: 1 addition & 1 deletion Assets/Scripts/Events/EventController.cs.meta

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

17 changes: 0 additions & 17 deletions Assets/Scripts/Events/LightsOffByGhostEvent.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Assets/Scripts/Events/LightsOffByGhostEvent.cs.meta

This file was deleted.

15 changes: 0 additions & 15 deletions Assets/Scripts/Events/PlayerEscapedEvent.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Assets/Scripts/Events/PlayerEscapedEvent.cs.meta

This file was deleted.

Loading