83 lines
4.4 KiB
C#
83 lines
4.4 KiB
C#
using NodeCanvas.Framework;
|
|
using ParadoxNotion.Design;
|
|
using Reset.Core;
|
|
using Unity.Cinemachine;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace NodeCanvas.Tasks.Actions {
|
|
[Category("Reset")]
|
|
[Description("Change Cinemachine camera settings for the player")]
|
|
public class ChangeCameraSettings : ActionTask{
|
|
[ParadoxNotion.Design.Header("Main Settings")]
|
|
public FloatValueGroup fieldOfView = new (newLabel: "FOV");
|
|
|
|
[ParadoxNotion.Design.Header("Orbit Follow Ring Settings"), Space (5)]
|
|
public Vector3ValueGroup orbitTargetOffset = new(newLabel: "Target Offset");
|
|
[Space(5)]public Vector3ValueGroup orbitPositionDamping = new(newLabel: "Position Damping");
|
|
|
|
public OrbitalFollowValueGroup orbitFollowTop = new (newLabel: "Top");
|
|
public OrbitalFollowValueGroup orbitFollowCenter = new (newLabel: "Center");
|
|
public OrbitalFollowValueGroup orbitFollowBottom = new (newLabel: "Bottom");
|
|
|
|
public BoolValueGroup enableXAxis = new (newLabel: "Input Axis X Enabled");
|
|
public BoolValueGroup enableYAxis = new (newLabel: "Input Axis Y Enabled");
|
|
|
|
public FloatValueGroup axisLookXGain = new (newLabel: "Look Orbit X Gain");
|
|
public FloatValueGroup axisLookYGain = new (newLabel: "Look Orbit Y Gain");
|
|
|
|
[ParadoxNotion.Design.Header("Rotation Composer Settings")]
|
|
public Vector2ValueGroup screenPosition = new (newLabel: "Screen Position");
|
|
|
|
[ParadoxNotion.Design.Header("Camera Offset Settings")]
|
|
public Vector3ValueGroup cameraOffset = new (newLabel: "Offset");
|
|
|
|
//Use for initialization. This is called only once in the lifetime of the task.
|
|
//Return null if init was successfull. Return an error string otherwise
|
|
protected override string OnInit(){
|
|
return null;
|
|
}
|
|
|
|
//This is called once each time the task is enabled.
|
|
//Call EndAction() to mark the action as finished, either in success or failure.
|
|
//EndAction can be called from anywhere.
|
|
protected override void OnExecute(){
|
|
OrbitalFollowValueGroup.UpdateValue(orbitFollowTop, ref CameraSettingsProcessor.data.orbitFollowTopHeight.targetValue, ref CameraSettingsProcessor.original.orbitFollowTopRadius.targetValue);
|
|
OrbitalFollowValueGroup.UpdateValue(orbitFollowCenter, ref CameraSettingsProcessor.data.orbitFollowCenterHeight.targetValue, ref CameraSettingsProcessor.original.orbitFollowCenterRadius.targetValue);
|
|
OrbitalFollowValueGroup.UpdateValue(orbitFollowBottom, ref CameraSettingsProcessor.data.orbitFollowBottomHeight.targetValue, ref CameraSettingsProcessor.original.orbitFollowBottomRadius.targetValue);
|
|
|
|
Vector3ValueGroup.UpdateValue(cameraOffset, ref CameraSettingsProcessor.data.cameraOffsetOffset.targetValue, ref CameraSettingsProcessor.original.cameraOffsetOffset.targetValue);
|
|
|
|
Vector3ValueGroup.UpdateValue(orbitPositionDamping, ref CameraSettingsProcessor.data.orbitPositionDamping.targetValue, ref CameraSettingsProcessor.original.cameraOffsetOffset.targetValue);
|
|
Vector3ValueGroup.UpdateValue(orbitTargetOffset, ref CameraSettingsProcessor.data.orbitTargetOffset.targetValue, ref CameraSettingsProcessor.original.cameraOffsetOffset.targetValue);
|
|
|
|
Vector2ValueGroup.UpdateValue(screenPosition, ref CameraSettingsProcessor.data.rotationComposerScreenPos.targetValue, ref CameraSettingsProcessor.original.rotationComposerScreenPos.targetValue);
|
|
FloatValueGroup.UpdateValue(fieldOfView, ref CameraSettingsProcessor.data.mainFieldOfView.targetValue, ref CameraSettingsProcessor.original.mainFieldOfView.targetValue);
|
|
|
|
FloatValueGroup.UpdateValue(axisLookXGain, ref CameraSettingsProcessor.data.axisLookGainX.targetValue, ref CameraSettingsProcessor.original.axisLookGainX.targetValue);
|
|
FloatValueGroup.UpdateValue(axisLookYGain, ref CameraSettingsProcessor.data.axisLookGainY.targetValue, ref CameraSettingsProcessor.original.axisLookGainY.targetValue);
|
|
|
|
BoolValueGroup.UpdateValue(enableXAxis, ref CameraSettingsProcessor.data.axisLookEnabledX.targetValue, ref CameraSettingsProcessor.original.axisLookEnabledX.targetValue);
|
|
BoolValueGroup.UpdateValue(enableYAxis, ref CameraSettingsProcessor.data.axisLookEnabledY.targetValue, ref CameraSettingsProcessor.original.axisLookEnabledY.targetValue);
|
|
|
|
EndAction(true);
|
|
}
|
|
|
|
|
|
|
|
//Called once per frame while the action is active.
|
|
protected override void OnUpdate() {
|
|
|
|
}
|
|
|
|
//Called when the task is disabled.
|
|
protected override void OnStop() {
|
|
|
|
}
|
|
|
|
//Called when the task is paused.
|
|
protected override void OnPause() {
|
|
|
|
}
|
|
}
|
|
} |