From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/Walls/XCameraWall.cs | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Client/Assets/Scripts/Walls/XCameraWall.cs (limited to 'Client/Assets/Scripts/Walls/XCameraWall.cs') diff --git a/Client/Assets/Scripts/Walls/XCameraWall.cs b/Client/Assets/Scripts/Walls/XCameraWall.cs new file mode 100644 index 00000000..75485b68 --- /dev/null +++ b/Client/Assets/Scripts/Walls/XCameraWall.cs @@ -0,0 +1,50 @@ +using UnityEngine; +using XUtliPoolLib; + +[ExecuteInEditMode] +public class XCameraWall : XWall +{ + public XCameraWall Associated = null; + public XCurve Curve = null; + + public bool BeginWith = false; + public float Angle = 0; + public bool VerticalOnly = false; + public float VerticalShiftAngle = 0; + + protected override void OnTriggered() + { + float sector = Vector3.Angle(transform.forward, Associated.transform.forward); + Vector3 rotate = transform.rotation.eulerAngles; rotate.y = 0; + Vector3 dir = Quaternion.AngleAxis(rotate.z, transform.forward) * XCommon.singleton.HorizontalRotateVetor3(transform.forward, 90, true); + + if (_forward_collision) + { + if (!VerticalOnly) + { + if (BeginWith) + { + _interface.CameraWallEnter(Curve.Curve, transform.parent.transform.position, dir, sector, Angle, Associated.Angle, BeginWith); + } + else + _interface.CameraWallExit(Angle); + } + + _interface.CameraWallVertical(VerticalShiftAngle); + } + else + { + if (!VerticalOnly) + { + if (BeginWith) + _interface.CameraWallExit(Angle); + else + { + _interface.CameraWallEnter(Curve.Curve, transform.parent.transform.position, dir, sector, Angle, Associated.Angle, BeginWith); + } + } + + _interface.CameraWallVertical(-VerticalShiftAngle); + } + } +} -- cgit v1.1-26-g67d0