Skip to content

Commit

Permalink
Merge pull request #175 from 2024FALL-SWPP/psy/fix/Anomaly11Manager
Browse files Browse the repository at this point in the history
Anomaly11 fixed
  • Loading branch information
psy020529 authored Dec 1, 2024
2 parents 4ae7beb + 2520c87 commit 9ead406
Show file tree
Hide file tree
Showing 5 changed files with 225 additions and 4 deletions.
78 changes: 78 additions & 0 deletions 302/Assets/Course Library/Anomalies/Anomaly11/WhiteFade.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6108600949248145026
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6108600949248145027}
- component: {fileID: 6108600949248145029}
- component: {fileID: 6108600949248145028}
m_Layer: 5
m_Name: WhiteFade
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6108600949248145027
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6108600949248145026}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
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: 1920, y: 1080}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6108600949248145029
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6108600949248145026}
m_CullTransparentMesh: 1
--- !u!114 &6108600949248145028
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6108600949248145026}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1

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

36 changes: 33 additions & 3 deletions 302/Assets/Course Library/Anomalies/Anomaly11/door_opened.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ GameObject:
- component: {fileID: 3648627735304209783}
- component: {fileID: 6174872053804984990}
- component: {fileID: 784451035890115203}
- component: {fileID: 3051000766094830709}
m_Layer: 3
m_Name: Cube.002
m_TagString: Untagged
Expand Down Expand Up @@ -85,6 +86,19 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!65 &3051000766094830709
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 629201705723675819}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.531273, y: 0.28869894, z: 0.17976432}
m_Center: {x: -0.12783314, y: 0.10885862, z: -0.0000000025093752}
--- !u!1 &8121868656660789279
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -132,8 +146,8 @@ BoxCollider:
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.47252256, y: 2.5318186, z: 1.2962291}
m_Center: {x: 0.00000014156103, y: 0.008325233, z: -0.42523104}
m_Size: {x: 0.41195282, y: 2.5318186, z: 1.4569993}
m_Center: {x: 0.37570688, y: 0.008325233, z: 0.81063145}
--- !u!114 &3234186859168601846
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -148,6 +162,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
promptMessage: "\uD074\uB9AD\uD558\uC5EC \uC0C1\uD638\uC791\uC6A9"
interactionRange: 2
fadeImage: {fileID: 6108600949248145028, guid: af86313d08cec4241a8b1edd8d8a29da, type: 3}
fadeSpeed: 2
closeSpeed: 1
--- !u!82 &-508133923779188934
AudioSource:
Expand All @@ -169,7 +185,7 @@ AudioSource:
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MinDistance: 1.0624509
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
Expand Down Expand Up @@ -256,6 +272,7 @@ GameObject:
- component: {fileID: 5732196933534513600}
- component: {fileID: 3923069776354938718}
- component: {fileID: 4861502511420887937}
- component: {fileID: 1925942271026717531}
m_Layer: 3
m_Name: Cube
m_TagString: Untagged
Expand Down Expand Up @@ -328,3 +345,16 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!65 &1925942271026717531
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8645687385858389802}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.2664935, y: 0.019999988, z: 0.019999998}
m_Center: {x: -0.057080418, y: -0.000000004048086, z: -0.0000000015110508}
56 changes: 55 additions & 1 deletion 302/Assets/Scenes/DefaultGameScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -23185,6 +23185,11 @@ Transform:
m_CorrespondingSourceObject: {fileID: 7236329420339151181, guid: 2ad42fc20dee64e4ca84470ffa3fb42e, type: 3}
m_PrefabInstance: {fileID: 1035048992}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1042280326 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: 2be5899b29c0449a7b0556426ceb422a, type: 3}
m_PrefabInstance: {fileID: 1481598551}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1043811486
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -28645,6 +28650,11 @@ Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: e8452d6febdb74d3baa023ccec6ad5d2, type: 3}
m_PrefabInstance: {fileID: 1282953938}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1284500733 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: 090a5def410e64bb6bfa646d6efd8082, type: 3}
m_PrefabInstance: {fileID: 1425937138}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1292540444
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -31719,6 +31729,19 @@ Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 090a5def410e64bb6bfa646d6efd8082, type: 3}
m_PrefabInstance: {fileID: 1425937138}
m_PrefabAsset: {fileID: 0}
--- !u!65 &1425937142
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1284500733}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.011465456, y: 0.013045215, z: 0.13114168}
m_Center: {x: -0.00003507018, y: 0.0025438168, z: 0.000000014832083}
--- !u!1 &1431275540
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -32861,6 +32884,19 @@ Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 2be5899b29c0449a7b0556426ceb422a, type: 3}
m_PrefabInstance: {fileID: 1481598551}
m_PrefabAsset: {fileID: 0}
--- !u!65 &1481598553
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1042280326}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1.438041, y: 2.279755, z: 2.0562773}
m_Center: {x: -0.21902043, y: 0.2507244, z: -0.038850203}
--- !u!1001 &1482182348
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -42803,6 +42839,24 @@ Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: e8452d6febdb74d3baa023ccec6ad5d2, type: 3}
m_PrefabInstance: {fileID: 1955445574}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1959791370 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: 8dae5750f1e6b487c83602dfdf5f01f7, type: 3}
m_PrefabInstance: {fileID: 1027390622}
m_PrefabAsset: {fileID: 0}
--- !u!65 &1959791373
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1959791370}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.011141357, y: 0.011285612, z: 0.13114166}
m_Center: {x: 0.000011472702, y: 0.0016640319, z: 0.000000009888056}
--- !u!1001 &1960839231
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -43088,7 +43142,7 @@ MonoBehaviour:
- {fileID: 5605359256125054964, guid: 48c8f10abe45bef4098efae902701f34, type: 3}
checkSpecificAnomaly: 1
checkIntersect: 0
SpecificAnomalyNum: 29
SpecificAnomalyNum: 11
currentAnomalyInstance: {fileID: 8678062959089499939, guid: 6aadfcd777444a24180cf51012c6e89c, type: 3}
--- !u!4 &1964216256
Transform:
Expand Down
52 changes: 52 additions & 0 deletions 302/Assets/Scripts/SpecificAnomalyManager/Anomaly11_openeddoor.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class Anomaly11_openeddoor : InteractableObject, IInteractable
{
[SerializeField] private Image fadeImage;
[SerializeField] private float fadeSpeed = 0.5f;
public float closeSpeed = 1.0f; // Door movement speed

private Transform movingPart; // Reference to Cube.002 child object
Expand Down Expand Up @@ -78,6 +81,55 @@ private IEnumerator CloseDoor()
}

movingPart.localPosition = targetPosition; // Ensure the final position is exact
BoxCollider boxCollider = gameObject.GetComponent<BoxCollider>();
if (boxCollider != null)
{
boxCollider.enabled = false;
}
Debug.Log("Anomaly11_openeddoor: Door moved successfully.");
}

private void OnCollisionEnter(Collision collision)
{
if (collision.collider.CompareTag("Player"))
{
Debug.Log("Collided with Player! Fake ending entered...");
StartCoroutine(StartFakeEnding(collision.collider.gameObject));
}
}

private IEnumerator StartFakeEnding(GameObject player)
{
Canvas canvas = FindObjectOfType<Canvas>();
if (canvas == null)
{
Debug.LogError("No Canvas found in the scene! Please add a Canvas.");
yield break;
}

// Instantiate Image and attach to Canvas
Image instantiatedImage = Instantiate(fadeImage, canvas.transform);
yield return new WaitForSeconds(0.5f);

float alpha = 0;
while (alpha < 1f)
{
alpha += Time.deltaTime * fadeSpeed;
if (instantiatedImage != null)
{
Color c = instantiatedImage.color;
c.a = alpha;
instantiatedImage.color = c;
}
yield return null;
}

yield return new WaitForSeconds(0.5f);

PlayerController playerController = player.GetComponent<PlayerController>();
if (playerController != null)
{
playerController.GameOver();
}
}
}

0 comments on commit 9ead406

Please sign in to comment.