summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/Walls/XCameraWall.cs
blob: 75485b68d0162f5bcf53c1a653bbb6ab6ff4daac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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);
        }
    }
}