コード例 #1
0
    private void OnTriggerEnter2D(Collider2D collider)
    {
        CameraSegmentMember member = collider.GetComponent <CameraSegmentMember>();

        if (member)
        {
            OnMemberEnter(member);
        }

        PlayerUnitController unit = InteractiveHelpers.GetPlayer(collider);

        if (!unit)
        {
            return;
        }

        PlayerUnitCamera playerCamera = unit.di.camera;

        if (playerCamera.CameraSegment == null)
        {
            unitsInside.Add(unit);
            playerCamera.CameraSegment = this;
        }
        else
        {
            CheckUnitForSegmentEnter(unit);
        }
    }
コード例 #2
0
    private void OnTriggerExit2D(Collider2D collider)
    {
        CameraSegmentMember member = collider.GetComponent <CameraSegmentMember>();

        if (member)
        {
            OnMemberExit(member);
        }

        PlayerUnitController unit = InteractiveHelpers.GetPlayer(collider);

        if (!unit)
        {
            return;
        }

        unitsInside.Remove(unit);

        // TODO: do we need to assign null here?
        //PlayerUnitCamera camera = unit.di.camera;
        //if (camera.CameraSegment == this)
        //  camera.CameraSegment = null;

        //camera.RemoveCameraSegment(this);
    }
コード例 #3
0
 private void OnMemberExit(CameraSegmentMember member)
 {
     members.Remove(member);
     if (member.Segment == this)
     {
         member.Segment = null;
     }
 }
コード例 #4
0
 private void OnMemberEnter(CameraSegmentMember member)
 {
     members.Add(member);
     member.Segment = this;
 }