You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
973 B
44 lines
973 B
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using AX.MessageSystem; |
|
using AX.InputSystem; |
|
|
|
[RequireComponent(typeof(CameraManager))] |
|
public class CameraScale : MonoBehaviour |
|
{ |
|
private CameraManager cameraManager; |
|
|
|
// Use this for initialization |
|
void Start() |
|
{ |
|
cameraManager = GetComponent<CameraManager>(); |
|
} |
|
|
|
// Update is called once per frame |
|
void Update() |
|
{ |
|
|
|
} |
|
|
|
void OnEnable() |
|
{ |
|
MessageDispatcher.AddListener("MIDDLE_MOUSE_SCROLL_COMMAND", Execute); |
|
} |
|
|
|
void OnDisable() |
|
{ |
|
MessageDispatcher.RemoveListener("MIDDLE_MOUSE_SCROLL_COMMAND", Execute); |
|
} |
|
|
|
void OnDestroy() |
|
{ |
|
MessageDispatcher.RemoveListener("MIDDLE_MOUSE_SCROLL_COMMAND", Execute); |
|
} |
|
|
|
private void Execute(IMessage obj) |
|
{ |
|
var data = (CameraCmdArgs)obj.Data; |
|
cameraManager.UpdateCameraScaleData(data.mouseScroll,data.distance); |
|
} |
|
}
|
|
|