杀手击杀房间变黑

This commit is contained in:
GL 2024-11-23 15:28:39 +08:00
parent c411e0705c
commit c59cfddcdb
5 changed files with 84 additions and 19 deletions

View File

@ -327,8 +327,8 @@ MonoBehaviour:
DoorIsOpen: 0
woniuMovePos: {fileID: 177818106}
otherWonius: []
DarkMask: {fileID: 0}
Lightlinp: {fileID: 0}
DarkMask: {fileID: 384489351}
Lightlinp: {fileID: 836005725}
--- !u!114 &20259222
MonoBehaviour:
m_ObjectHideFlags: 0
@ -3172,6 +3172,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
fadeDuration: 1.5
LightLinp: {fileID: 1170434599}
--- !u!1 &245899059
GameObject:
m_ObjectHideFlags: 0
@ -4712,6 +4713,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
fadeDuration: 1.5
LightLinp: {fileID: 836005725}
--- !u!1 &385193886
GameObject:
m_ObjectHideFlags: 0
@ -7982,8 +7984,8 @@ MonoBehaviour:
DoorIsOpen: 0
woniuMovePos: {fileID: 177818106}
otherWonius: []
DarkMask: {fileID: 0}
Lightlinp: {fileID: 0}
DarkMask: {fileID: 232960016}
Lightlinp: {fileID: 1170434599}
--- !u!114 &708679842
MonoBehaviour:
m_ObjectHideFlags: 0
@ -8312,8 +8314,8 @@ MonoBehaviour:
DoorIsOpen: 0
woniuMovePos: {fileID: 177818106}
otherWonius: []
DarkMask: {fileID: 0}
Lightlinp: {fileID: 0}
DarkMask: {fileID: 1654170159}
Lightlinp: {fileID: 1465281021}
--- !u!114 &715869105
MonoBehaviour:
m_ObjectHideFlags: 0
@ -9877,6 +9879,7 @@ GameObject:
- component: {fileID: 880521874}
- component: {fileID: 880521876}
- component: {fileID: 880521875}
- component: {fileID: 880521877}
m_Layer: 5
m_Name: DarkImage
m_TagString: Untagged
@ -9918,7 +9921,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 0}
m_RaycastTarget: 1
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
@ -9942,6 +9945,20 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 880521873}
m_CullTransparentMesh: 1
--- !u!114 &880521877
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 880521873}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5637cca8b3d8c264ea70d77a686f86e8, type: 3}
m_Name:
m_EditorClassIdentifier:
fadeDuration: 1.5
LightLinp: {fileID: 1528141811}
--- !u!1 &890679608
GameObject:
m_ObjectHideFlags: 0
@ -10300,8 +10317,8 @@ MonoBehaviour:
DoorIsOpen: 0
woniuMovePos: {fileID: 177818106}
otherWonius: []
DarkMask: {fileID: 0}
Lightlinp: {fileID: 0}
DarkMask: {fileID: 1374180393}
Lightlinp: {fileID: 197030554}
--- !u!114 &898215880
MonoBehaviour:
m_ObjectHideFlags: 0
@ -12173,8 +12190,8 @@ MonoBehaviour:
DoorIsOpen: 0
woniuMovePos: {fileID: 177818106}
otherWonius: []
DarkMask: {fileID: 0}
Lightlinp: {fileID: 0}
DarkMask: {fileID: 1052466736}
Lightlinp: {fileID: 1302221003}
--- !u!114 &1049673033
MonoBehaviour:
m_ObjectHideFlags: 0
@ -12481,6 +12498,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
fadeDuration: 1.5
LightLinp: {fileID: 1302221003}
--- !u!1 &1054507117
GameObject:
m_ObjectHideFlags: 0
@ -15922,6 +15940,7 @@ GameObject:
- component: {fileID: 1374180390}
- component: {fileID: 1374180392}
- component: {fileID: 1374180391}
- component: {fileID: 1374180393}
m_Layer: 5
m_Name: DarkImage
m_TagString: Untagged
@ -15987,6 +16006,20 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1374180389}
m_CullTransparentMesh: 1
--- !u!114 &1374180393
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1374180389}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5637cca8b3d8c264ea70d77a686f86e8, type: 3}
m_Name:
m_EditorClassIdentifier:
fadeDuration: 1.5
LightLinp: {fileID: 197030554}
--- !u!1 &1377318865
GameObject:
m_ObjectHideFlags: 0
@ -19678,6 +19711,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
fadeDuration: 1.5
LightLinp: {fileID: 1465281021}
--- !u!1 &1667346432
GameObject:
m_ObjectHideFlags: 0
@ -24847,8 +24881,8 @@ MonoBehaviour:
DoorIsOpen: 0
woniuMovePos: {fileID: 177818106}
otherWonius: []
DarkMask: {fileID: 0}
Lightlinp: {fileID: 0}
DarkMask: {fileID: 880521877}
Lightlinp: {fileID: 1528141811}
--- !u!114 &2143530051
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -247,11 +247,13 @@ public class AllHouseContro : MonoBehaviour
battleRoyaleGameDetails();
roomNo = -1;//玩家房间号改为默认-1
LoadPanel.instance.ShowPanel();
player.gameObject.SetActive(true);
CanMoveWoniu();//允许蜗牛移动
ClearText();
//ReHouseText();
BoosReturn();
ReturnDarkToWhite();//恢复灯光
player.gameObject.SetActive(true);
player.ReturnStartPos();
allother.HideJiaWoniu();
// allother.Reflash();//假蜗牛随机
@ -534,4 +536,14 @@ public class AllHouseContro : MonoBehaviour
}
}
public void ReturnDarkToWhite()//恢复房间亮灯状态
{
foreach (HouseBtn houseBtn in HouseBtnList)
{
houseBtn.DarkMask.ReturnWhite();
//houseBtn.Lightlinp.color = new Color(0, 0, 0, 1);
}
}
}

View File

@ -6,6 +6,7 @@ public class FadeToBlack : MonoBehaviour
{
public float fadeDuration = 1.5f; // 渐变时间
private Image blackImage;
public GameObject LightLinp;//灯光
void Start()
{
@ -16,6 +17,7 @@ public class FadeToBlack : MonoBehaviour
// 外部调用:渐变变黑
public void StartFade()
{
LightLinp.SetActive(false);
StartCoroutine(FadeToBlackCoroutine());
}
@ -25,20 +27,31 @@ public class FadeToBlack : MonoBehaviour
blackImage.color = new Color(0, 0, 0, 1f); // 设置为全黑
}
public void ReturnWhite()
{
LightLinp.SetActive(true);
blackImage.color = new Color(0, 0, 0, 0f); // 设置为全白
}
// 协程:控制渐变过程
private IEnumerator FadeToBlackCoroutine()
{
float elapsedTime = 0f;
// 目标透明度
float targetAlpha = 0.6f;
while (elapsedTime < fadeDuration)
{
elapsedTime += Time.deltaTime;
float alpha = Mathf.Clamp01(elapsedTime / fadeDuration); // 计算透明度
// 计算当前透明度从0逐渐到目标透明度0.6
float alpha = Mathf.Lerp(0f, targetAlpha, elapsedTime / fadeDuration);
blackImage.color = new Color(0, 0, 0, alpha);
yield return null; // 等待下一帧
}
// 确保最终完全变黑
blackImage.color = new Color(0, 0, 0, 0.6f);
// 确保最终达到目标透明度
blackImage.color = new Color(0, 0, 0, targetAlpha);
}
}

View File

@ -21,7 +21,7 @@ public class HouseBtn : MonoBehaviour
public PlayerMovePos woniuMovePos;
public List<otherWoniu> otherWonius;
public FadeToBlack DarkMask;//·¿¼äºÚÉ«ÕÚÕÖ
public GameObject Lightlinp;//房间灯光
public Image Lightlinp;//·¿¼äµÆ¹â
// Start is called before the first frame update
void Start()
{

View File

@ -370,7 +370,7 @@ public class PlayerMove : MonoBehaviour
IEnumerator BoosAttack()
{
GetComponent<BossContro>().BossAni.SetInteger("State", 2);
yield return new WaitForSeconds(3f);
yield return new WaitForSeconds(2.1f);
GetComponent<BossContro>().BossAni.SetInteger("State", 0);
if (allHouseContro.KillNos.Count>0)
{
@ -392,6 +392,12 @@ public class PlayerMove : MonoBehaviour
StartCoroutine( GetComponent<BossContro>().allother.ReturnstartPos(houseBtn.roomNo));
}
if (houseBtn.roomNo == nos)
{
houseBtn.DarkMask.StartFade();
//houseBtn.Lightlinp.color = new Color(0, 0, 0, 0);
}
}
}
allHouseContro.KillNos.Clear();