Merge branch 'develop' of https://git.brew.monster/Unity/perfect-world-unity into develop
This commit is contained in:
@@ -0,0 +1,230 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &4998203355105501952
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1628544740079825057}
|
||||
- component: {fileID: 2396821685412871444}
|
||||
- component: {fileID: 7258523983903280597}
|
||||
- component: {fileID: 2200587088708437140}
|
||||
- component: {fileID: 8677225758390490087}
|
||||
m_Layer: 0
|
||||
m_Name: FreeLook Camera
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1628544740079825057
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4998203355105501952}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.23378472, y: -1.6779091e-15, z: 8.341431e-16, w: 0.9722884}
|
||||
m_LocalPosition: {x: -736.68787, y: 50.89, z: -269.46097}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &2396821685412871444
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4998203355105501952}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Priority:
|
||||
Enabled: 0
|
||||
m_Value: 0
|
||||
OutputChannel: 1
|
||||
StandbyUpdate: 2
|
||||
m_StreamingVersion: 20241001
|
||||
m_LegacyPriority: 0
|
||||
Target:
|
||||
TrackingTarget: {fileID: 0}
|
||||
LookAtTarget: {fileID: 0}
|
||||
CustomLookAtTarget: 0
|
||||
Lens:
|
||||
FieldOfView: 60.000004
|
||||
OrthographicSize: 5
|
||||
NearClipPlane: 0.3
|
||||
FarClipPlane: 200
|
||||
Dutch: 0
|
||||
ModeOverride: 0
|
||||
PhysicalProperties:
|
||||
GateFit: 2
|
||||
SensorSize: {x: 21.946, y: 16.002}
|
||||
LensShift: {x: 0, y: 0}
|
||||
FocusDistance: 10
|
||||
Iso: 200
|
||||
ShutterSpeed: 0.005
|
||||
Aperture: 16
|
||||
BladeCount: 5
|
||||
Curvature: {x: 2, y: 11}
|
||||
BarrelClipping: 0.25
|
||||
Anamorphism: 0
|
||||
BlendHint: 0
|
||||
--- !u!114 &7258523983903280597
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4998203355105501952}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3b5d7c088409d9a40b7b09aa707777f8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
TargetOffset: {x: 0, y: 4, z: 0}
|
||||
TrackerSettings:
|
||||
BindingMode: 4
|
||||
PositionDamping: {x: 1, y: 1, z: 1}
|
||||
AngularDampingMode: 0
|
||||
RotationDamping: {x: 1, y: 1, z: 1}
|
||||
QuaternionDamping: 1.52
|
||||
OrbitStyle: 1
|
||||
Radius: 1
|
||||
Orbits:
|
||||
Top:
|
||||
Radius: 0.03
|
||||
Height: 7.26
|
||||
Center:
|
||||
Radius: 8.33
|
||||
Height: 5.99
|
||||
Bottom:
|
||||
Radius: 4.29
|
||||
Height: -4.04
|
||||
SplineCurvature: 0
|
||||
RecenteringTarget: 2
|
||||
HorizontalAxis:
|
||||
Value: 208
|
||||
Center: 0
|
||||
Range: {x: -360, y: 360}
|
||||
Wrap: 0
|
||||
Recentering:
|
||||
Enabled: 0
|
||||
Wait: 1
|
||||
Time: 2
|
||||
Restrictions: 0
|
||||
VerticalAxis:
|
||||
Value: -268
|
||||
Center: 20
|
||||
Range: {x: -360, y: 360}
|
||||
Wrap: 1
|
||||
Recentering:
|
||||
Enabled: 0
|
||||
Wait: 1
|
||||
Time: 2
|
||||
Restrictions: 0
|
||||
RadialAxis:
|
||||
Value: 1
|
||||
Center: 1
|
||||
Range: {x: 1, y: 1}
|
||||
Wrap: 0
|
||||
Recentering:
|
||||
Enabled: 0
|
||||
Wait: 1
|
||||
Time: 2
|
||||
Restrictions: 0
|
||||
--- !u!114 &2200587088708437140
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4998203355105501952}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f38bda98361e1de48a4ca2bd86ea3c17, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Composition:
|
||||
ScreenPosition: {x: 0, y: 0}
|
||||
DeadZone:
|
||||
Enabled: 0
|
||||
Size: {x: 0.2, y: 0.2}
|
||||
HardLimits:
|
||||
Enabled: 0
|
||||
Size: {x: 0.8, y: 0.8}
|
||||
Offset: {x: 0, y: 0}
|
||||
CenterOnActivate: 1
|
||||
TargetOffset: {x: 0, y: 1.5, z: 0}
|
||||
Damping: {x: 0.5, y: 0.5}
|
||||
Lookahead:
|
||||
Enabled: 0
|
||||
Time: 0
|
||||
Smoothing: 0
|
||||
IgnoreY: 0
|
||||
--- !u!114 &8677225758390490087
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4998203355105501952}
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 89875cdc57c54474a8a74efd9b2a3b5d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
ScanRecursively: 1
|
||||
SuppressInputWhileBlending: 1
|
||||
IgnoreTimeScale: 0
|
||||
m_ControllerManager:
|
||||
Controllers:
|
||||
- Name: Look Orbit X
|
||||
Owner: {fileID: 7258523983903280597}
|
||||
Enabled: 1
|
||||
Input:
|
||||
InputAction: {fileID: -5630151704836100654, guid: 1d6e640e716dc4ff6989b73d02023f2b, type: 3}
|
||||
Gain: 1
|
||||
LegacyInput:
|
||||
LegacyGain: 1
|
||||
CancelDeltaTime: 0
|
||||
InputValue: 0
|
||||
Driver:
|
||||
AccelTime: 0.2
|
||||
DecelTime: 0.2
|
||||
- Name: Look Orbit Y
|
||||
Owner: {fileID: 7258523983903280597}
|
||||
Enabled: 1
|
||||
Input:
|
||||
InputAction: {fileID: -5630151704836100654, guid: 1d6e640e716dc4ff6989b73d02023f2b, type: 3}
|
||||
Gain: -1
|
||||
LegacyInput:
|
||||
LegacyGain: 1
|
||||
CancelDeltaTime: 0
|
||||
InputValue: 0
|
||||
Driver:
|
||||
AccelTime: 0.2
|
||||
DecelTime: 0.2
|
||||
- Name: Orbit Scale
|
||||
Owner: {fileID: 7258523983903280597}
|
||||
Enabled: 1
|
||||
Input:
|
||||
InputAction: {fileID: -423771258819551211, guid: 1d6e640e716dc4ff6989b73d02023f2b, type: 3}
|
||||
Gain: -1
|
||||
LegacyInput:
|
||||
LegacyGain: 1
|
||||
CancelDeltaTime: 0
|
||||
InputValue: 0
|
||||
Driver:
|
||||
AccelTime: 0
|
||||
DecelTime: 0
|
||||
PlayerIndex: -1
|
||||
AutoEnableInputs: 0
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc901dd976e0838499b18a0b802b81d7
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,98 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1907375868528687128
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3488899534283412697}
|
||||
- component: {fileID: 7907247812297230186}
|
||||
- component: {fileID: 4758101108332602619}
|
||||
- component: {fileID: 1387587181254949733}
|
||||
m_Layer: 0
|
||||
m_Name: AreaTouchCam
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3488899534283412697
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1907375868528687128}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3233441867675090637}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7907247812297230186
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1907375868528687128}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &4758101108332602619
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1907375868528687128}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 0}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &1387587181254949733
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1907375868528687128}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: cbda204e0e5552e4692f0f5e234f062d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_cinemachineCamera: {fileID: 0}
|
||||
orbital: {fileID: 0}
|
||||
minSwipeDistance: 10
|
||||
speedX: 300
|
||||
speedY: 500
|
||||
--- !u!1 &2486392142327362049
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -30,7 +123,8 @@ RectTransform:
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Children:
|
||||
- {fileID: 3488899534283412697}
|
||||
m_Father: {fileID: 2780428059708698453}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
@@ -59,7 +153,7 @@ Canvas:
|
||||
m_AdditionalShaderChannelsFlag: 0
|
||||
m_UpdateRectTransformForStandalone: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 100
|
||||
m_SortingOrder: -1
|
||||
m_TargetDisplay: 0
|
||||
--- !u!114 &1184637750286334292
|
||||
MonoBehaviour:
|
||||
@@ -152,3 +246,4 @@ MonoBehaviour:
|
||||
currentTargetNPCID: 0
|
||||
dialogResouce: {fileID: 11400000, guid: 540bc8e61556ba4479407a2d68e17580, type: 2}
|
||||
canvasDlg: {fileID: 7894129013412138377}
|
||||
cDlgQuickBar: {fileID: 0}
|
||||
|
||||
@@ -1,11 +1,45 @@
|
||||
using Unity.Cinemachine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace BrewMonster
|
||||
{
|
||||
public class CameraController : MonoBehaviour
|
||||
public class CameraController : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IDragHandler
|
||||
{
|
||||
[SerializeField]private CinemachineCamera _cinemachineCamera;
|
||||
[SerializeField]private CinemachineOrbitalFollow orbital;
|
||||
private Vector2 currentPos;
|
||||
private bool fingerDown = false;
|
||||
Vector2 delta = Vector2.zero;
|
||||
public float minSwipeDistance = 10f;
|
||||
public float speedX = 1f;
|
||||
public float speedY = 1f;
|
||||
|
||||
public void OnDrag(PointerEventData eventData)
|
||||
{
|
||||
delta = eventData.position - currentPos;
|
||||
|
||||
if (delta.magnitude >= minSwipeDistance)
|
||||
{
|
||||
orbital.HorizontalAxis.Value += delta.normalized.x * speedX * Time.deltaTime;
|
||||
//orbital.HorizontalAxis.Value = Mathf.Clamp(orbital.HorizontalAxis.Value, -360f, 360f);
|
||||
orbital.VerticalAxis.Value += delta.normalized.y * speedY * Time.deltaTime;
|
||||
orbital.VerticalAxis.Value = Mathf.Clamp(orbital.VerticalAxis.Value, -360f, 360f);
|
||||
}
|
||||
currentPos = eventData.position;
|
||||
}
|
||||
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
currentPos = eventData.position;
|
||||
fingerDown = true;
|
||||
}
|
||||
|
||||
public void OnPointerUp(PointerEventData eventData)
|
||||
{
|
||||
fingerDown = false;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
//todo: should not always update
|
||||
@@ -13,6 +47,8 @@ namespace BrewMonster
|
||||
{
|
||||
_cinemachineCamera.Follow = CECGameRun.Instance.GetHostPlayer().transform;
|
||||
_cinemachineCamera.ForceCameraPosition(CECGameRun.Instance.GetHostPlayer().transform.position, Quaternion.identity);
|
||||
orbital.HorizontalAxis.Value = 208;
|
||||
orbital.VerticalAxis.Value = -268;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,19 @@ namespace BrewMonster.Scripts
|
||||
DEST_STANDJUMP = 4,
|
||||
DEST_AUTOPF = 5; // Movement type
|
||||
}
|
||||
const float A3D_PI = 3.1415926535f;
|
||||
static float DEG2RAD(float deg) => ((deg) * A3D_PI / 180.0f);
|
||||
static float pitch_ang_wing => DEG2RAD(45.0f);
|
||||
static float pitch_ang_fly_sword => DEG2RAD(25.0f);
|
||||
static float lean_max_ang => DEG2RAD(45.0f);
|
||||
static float ang_vel_fly => 1.0f / DEG2RAD(60.0f);
|
||||
static float ang_vel_swim => 1.0f / DEG2RAD(180.0f);
|
||||
static float pitch_co_wing => pitch_ang_wing / A3D_PI;
|
||||
static float pitch_co_fly_sword => pitch_ang_fly_sword / A3D_PI;
|
||||
const float sidle_co = .5f;
|
||||
static float sidle_co_r => 1.0f - sidle_co;
|
||||
static float push_pitch_vel_wing => pitch_ang_wing / 0.5f;
|
||||
static float push_pitch_vel_fly_sword => pitch_ang_fly_sword / 0.5f;
|
||||
|
||||
private const uint MoveInputMask = 0x0F; // MD_FORWARD | MD_RIGHT | MD_BACK | MD_LEFT
|
||||
|
||||
@@ -865,8 +878,300 @@ namespace BrewMonster.Scripts
|
||||
else
|
||||
m_pHost.m_MoveCtrl.SendMoveCmd(vCurPos, 0, m_vMoveDest, vVel2, iMoveMode | (int)GPMoveMode.GP_MOVE_RUN);
|
||||
}
|
||||
else if (m_iDestType == DestTypes.DEST_2D)
|
||||
{
|
||||
Vector3 vPushDir = Vector3.zero;
|
||||
m_pHost.GetPushDir(ref vPushDir, (uint)MOVE_DIR.MD_ALL, 0f);
|
||||
vPushDir.x = vPushDir.z = 0.0f;
|
||||
|
||||
float fSpeed1H = m_pHost.m_vVelocity.MagnitudeH();
|
||||
float fSpeed1V = m_pHost.m_vVelocity.y;
|
||||
|
||||
A3DVECTOR3 vMoveDirH = m_vMoveDest - vCurPos;
|
||||
vMoveDirH.y = 0.0f;
|
||||
float fDistH = vMoveDirH.Normalize();
|
||||
|
||||
float pa = 0.0f;
|
||||
|
||||
// Calculate the distance to reduce velocity to 0
|
||||
float s = -0.5f * fSpeed1H * fSpeed1H / na;
|
||||
if (fDistH > s - 0.01f)
|
||||
pa = CECHostMove.EC_PUSH_ACCE;
|
||||
|
||||
float fSpeed2H = fSpeed1H + (pa + na) * fDeltaTime;
|
||||
if (Math.Abs(pa - 0f) < float.Epsilon && fSpeed2H < 0.0f)
|
||||
fSpeed2H = 0.0f; // Only resistance couldn't generate negative speed
|
||||
else if (fSpeed2H > fMaxSpeed)
|
||||
fSpeed2H = fMaxSpeed;
|
||||
|
||||
Glide(fDistH / fMaxSpeed, vMoveDirH, fDeltaTime, bInAir);
|
||||
|
||||
vMoveDirH = m_pHost.GetModelMoveDir();
|
||||
vMoveDirH.y = 0;
|
||||
vMoveDirH.Normalize();
|
||||
|
||||
// Vertical speed
|
||||
float fSpeed2V = CalcFlySwimVertSpeed(fSpeed1V, vPushDir.y, CECHostMove.EC_PUSH_ACCE, fDeltaTime);
|
||||
A3DVECTOR3 vVel2 = vMoveDirH * fSpeed2H + GPDataTypeHelper.g_vAxisY * fSpeed2V;
|
||||
|
||||
// Air/water move
|
||||
vCurPos = m_pHost.m_MoveCtrl.AirWaterMove(vVel2, fDeltaTime, bInAir);
|
||||
|
||||
if (m_pHost.m_MoveCtrl.MoveBlocked() >= 3)
|
||||
{
|
||||
vVel2.Clear();
|
||||
Finish();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reached destination ?
|
||||
A3DVECTOR3 vMoveDelta = vCurPos - m_pHost.GetPos();
|
||||
vMoveDelta.y = 0.0f;
|
||||
float fMoveDistH = vMoveDelta.Normalize();
|
||||
if (fMoveDistH >= fDistH)
|
||||
{
|
||||
vVel2.x = vVel2.z = 0.0f;
|
||||
if (Math.Abs(vVel2.y - 0f) < float.Epsilon)
|
||||
{
|
||||
Finish();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_bUseAutoMoveDialog)
|
||||
{
|
||||
Finish();
|
||||
vVel2.y = 0.0f;
|
||||
}
|
||||
|
||||
m_iDestType = DestTypes.DEST_PUSH;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_pHost.SetPos(EC_Utility.ToVector3(vCurPos));
|
||||
m_pHost.m_vVelocity = vVel2;
|
||||
|
||||
if (m_bFinished)
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), vVel2.Magnitude(), iMoveMode | (int)GPMoveMode.GP_MOVE_RUN);
|
||||
else
|
||||
m_pHost.m_MoveCtrl.SendMoveCmd(vCurPos, 0, m_vMoveDest, vVel2, iMoveMode | (int)GPMoveMode.GP_MOVE_RUN);
|
||||
}
|
||||
else if (m_iDestType == DestTypes.DEST_3D)
|
||||
{
|
||||
float fSpeed1 = m_pHost.m_vVelocity.Magnitude();
|
||||
A3DVECTOR3 vMoveDir = m_vMoveDest - vCurPos;
|
||||
float fDist = vMoveDir.Normalize();
|
||||
|
||||
float pa = 0.0f;
|
||||
|
||||
// Calculate the distance to reduce velocity to 0
|
||||
float s = -0.5f * fSpeed1 * fSpeed1 / na;
|
||||
if (fDist > s - 0.01f)
|
||||
pa = CECHostMove.EC_PUSH_ACCE;
|
||||
|
||||
float fSpeed2 = fSpeed1 + (pa + na) * fDeltaTime;
|
||||
if (Math.Abs(pa - 0f) < float.Epsilon && fSpeed2 < 0.0f)
|
||||
fSpeed2 = 0.0f; // Only resistance couldn't generate negative speed
|
||||
|
||||
AAssist.a_Clamp(ref fSpeed2, -fMaxSpeed, fMaxSpeed);
|
||||
|
||||
Vector3 vMoveDirH = new Vector3(vMoveDir.x, 0.0f, vMoveDir.z);
|
||||
if (vMoveDirH != Vector3.zero)
|
||||
{
|
||||
//m_pHost.StartModelMove(vMoveDirH, g_vAxisY, 100);
|
||||
//m_pHost.ChangeModelTargetDirAndUp(vMoveDirH, g_vAxisY);
|
||||
m_pHost.SetRotationHP(vMoveDirH);
|
||||
}
|
||||
|
||||
// Air/water move
|
||||
// A3DVECTOR3 vVel1 = vMoveDir * fSpeed1;
|
||||
A3DVECTOR3 vVel2 = vMoveDir * fSpeed2;
|
||||
vCurPos = m_pHost.m_MoveCtrl.AirWaterMove(vMoveDir, fSpeed2, fDeltaTime, bInAir, false);
|
||||
|
||||
if (m_pHost.m_MoveCtrl.MoveBlocked() >= 3)
|
||||
{
|
||||
vVel2.Clear();
|
||||
Finish();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reached destination ?
|
||||
A3DVECTOR3 vMoveDelta = vCurPos - m_pHost.GetPos();
|
||||
float fMoveDist = vMoveDelta.Normalize();
|
||||
if (fMoveDist >= fDist)
|
||||
{
|
||||
vVel2.Clear();
|
||||
Finish();
|
||||
m_bUseAutoMoveDialog = false;
|
||||
}
|
||||
}
|
||||
|
||||
m_pHost.SetPos(EC_Utility.ToVector3(vCurPos));
|
||||
m_pHost.m_vVelocity = vVel2;
|
||||
|
||||
if (m_bFinished)
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), fMaxSpeed, iMoveMode | (int)GPMoveMode.GP_MOVE_RUN);
|
||||
else
|
||||
m_pHost.m_MoveCtrl.SendMoveCmd(vCurPos, 1, m_vMoveDest, vVel2, iMoveMode | (int)GPMoveMode.GP_MOVE_RUN);
|
||||
}
|
||||
else if (m_iDestType == DestTypes.DEST_PUSH)
|
||||
{
|
||||
Vector3 vPushDir = Vector3.zero, vUp;
|
||||
bool bPush = m_pHost.GetPushDir(ref vPushDir, (uint)(MOVE_DIR.MD_FORWARD | MOVE_DIR.MD_BACK | MOVE_DIR.MD_LEFT | MOVE_DIR.MD_RIGHT), fDeltaTime);
|
||||
|
||||
if (!bPush)
|
||||
{
|
||||
//vPushDir = m_pHost.GetCameraCoord().GetDir();
|
||||
vPushDir.y = 0;
|
||||
vPushDir.Normalize();
|
||||
}
|
||||
|
||||
int nPitchDir = 0;
|
||||
if ((m_pHost.m_dwMoveRelDir & (int)(MOVE_DIR.MD_LEFT | MOVE_DIR.MD_RIGHT)) == 0)
|
||||
{
|
||||
A3DVECTOR3 vOldDir = m_pHost.GetModelMoveDir();
|
||||
vOldDir.y = 0;
|
||||
vOldDir.Normalize();
|
||||
|
||||
A3DVECTOR3 vNewDir = EC_Utility.ToA3DVECTOR3(vPushDir);
|
||||
vNewDir.y = 0;
|
||||
vNewDir.Normalize();
|
||||
|
||||
float fAngle = A3DVECTOR3.DotProduct(vOldDir, vNewDir);
|
||||
if (fAngle < 1.0f - 1e-4)
|
||||
{
|
||||
A3DVECTOR3 vUp_fAngle = A3DVECTOR3.CrossProduct(vOldDir, vNewDir);
|
||||
if (vUp_fAngle.y > 0) nPitchDir = 1;
|
||||
else nPitchDir = -1;
|
||||
if ((m_pHost.m_dwMoveRelDir & (uint)MOVE_DIR.MD_BACK) != 0)
|
||||
nPitchDir = -nPitchDir;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_pHost.m_dwMoveRelDir != 0)
|
||||
{
|
||||
if ((m_pHost.m_dwMoveRelDir & ~(uint)(MOVE_DIR.MD_ABSDOWN | MOVE_DIR.MD_ABSUP)) != 0)
|
||||
{
|
||||
float fPitchDelta = (/*m_pHost.UsingWing()*/m_pHost.GetWingType() == enumWingType.WINGTYPE_WING ? push_pitch_vel_wing : push_pitch_vel_fly_sword) * fDeltaTime;
|
||||
|
||||
if ((m_pHost.m_dwMoveRelDir & (uint)MOVE_DIR.MD_LEFT) != 0 || nPitchDir == -1)
|
||||
{
|
||||
if ((m_pHost.m_dwMoveRelDir & (uint)MOVE_DIR.MD_BACK) != 0)
|
||||
m_fPushPitch -= fPitchDelta;
|
||||
else
|
||||
m_fPushPitch += fPitchDelta;
|
||||
}
|
||||
else if ((m_pHost.m_dwMoveRelDir & (uint)MOVE_DIR.MD_RIGHT) != 0 || nPitchDir == 1)
|
||||
{
|
||||
if ((m_pHost.m_dwMoveRelDir & (uint)MOVE_DIR.MD_BACK) != 0)
|
||||
m_fPushPitch += fPitchDelta;
|
||||
else
|
||||
m_fPushPitch -= fPitchDelta;
|
||||
}
|
||||
else if (m_fPushPitch > fPitchDelta)
|
||||
m_fPushPitch -= fPitchDelta;
|
||||
else if (m_fPushPitch < -fPitchDelta)
|
||||
m_fPushPitch += fPitchDelta;
|
||||
else
|
||||
m_fPushPitch = 0;
|
||||
// TO DO: fix after
|
||||
//A3DVECTOR3 vRight = m_pHost.GetCameraCoord().GetRight();
|
||||
//float fLean = -Math.Asin(m_pHost.GetCameraCoord().GetDir().y);
|
||||
//AAssist.a_Clamp(ref fLean, -lean_max_ang, lean_max_ang);
|
||||
|
||||
//if (Math.Abs(fLean) > DEG2RAD(3.0f))
|
||||
//{
|
||||
// vPushDir = a3d_RotatePosAroundAxis(vPushDir, vRight, fLean);
|
||||
// vUp = a3d_RotatePosAroundAxis(g_vAxisY, vRight, fLean);
|
||||
//}
|
||||
//else
|
||||
// vUp = EC_Utility.ToVector3(GPDataTypeHelper.g_vAxisY);
|
||||
|
||||
//float pitch_ang = /*m_pHost.UsingWing()*/ m_pHost.GetWingType() == enumWingType.WINGTYPE_WING ? pitch_ang_wing : pitch_ang_fly_sword;
|
||||
//AAssist.a_Clamp(ref m_fPushPitch, -pitch_ang, pitch_ang);
|
||||
|
||||
//if (Math.Abs(m_fPushPitch) > DEG2RAD(4.0f))
|
||||
// vUp = a3d_RotatePosAroundAxis(vUp, vPushDir, m_fPushPitch);
|
||||
|
||||
//m_pHost.StartModelMove(vPushDir, vUp, 0);
|
||||
}
|
||||
|
||||
// if (bPush)
|
||||
if (bPush || (m_pHost.m_dwMoveRelDir & (uint)(MOVE_DIR.MD_ABSDOWN | MOVE_DIR.MD_ABSUP)) != 0)
|
||||
{
|
||||
// float pa = bPush ? EC_PUSH_ACCE : 0.0f;
|
||||
float pa = CECHostMove.EC_PUSH_ACCE;
|
||||
float na1 = m_pHost.m_iMoveEnv == (int)MoveEnvironment.MOVEENV_AIR ? CECHostMove.EC_NACCE_AIR : CECHostMove.EC_NACCE_WATER;
|
||||
float fAccel = pa + na1;
|
||||
|
||||
float fSpeed1 = m_pHost.m_vVelocity.Magnitude();
|
||||
float fSpeed2 = fSpeed1 + fAccel * fDeltaTime;
|
||||
AAssist.a_Clamp(ref fSpeed2, 0.0f, fMaxSpeed);
|
||||
|
||||
// Air/water move
|
||||
Vector3 vVelDir = Vector3.zero;
|
||||
if (bPush)
|
||||
vVelDir = vPushDir;
|
||||
|
||||
if ((m_pHost.m_dwMoveRelDir & (uint)MOVE_DIR.MD_ABSDOWN) != 0)
|
||||
{
|
||||
vVelDir += -EC_Utility.ToVector3(GPDataTypeHelper.g_vAxisY);
|
||||
vVelDir.Normalize();
|
||||
}
|
||||
else if ((m_pHost.m_dwMoveRelDir & (uint)MOVE_DIR.MD_ABSUP) != 0)
|
||||
{
|
||||
vVelDir += EC_Utility.ToVector3(GPDataTypeHelper.g_vAxisY);
|
||||
vVelDir.Normalize();
|
||||
}
|
||||
|
||||
// A3DVECTOR3 vVel = vPushDir * fSpeed2;
|
||||
Vector3 vVel = vVelDir * fSpeed2;
|
||||
vCurPos = m_pHost.m_MoveCtrl.AirWaterMove(EC_Utility.ToA3DVECTOR3(vVel), fDeltaTime, bInAir);
|
||||
|
||||
if (m_pHost.m_MoveCtrl.MoveBlocked() >= 3)
|
||||
{
|
||||
Finish();
|
||||
m_pHost.m_vVelocity.Clear();
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), fMaxSpeed, iMoveMode | (int)GPMoveMode.GP_MOVE_RUN);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pHost.SetPos(EC_Utility.ToVector3(vCurPos));
|
||||
if (m_bUseAutoMoveDialog)
|
||||
{
|
||||
m_fAutoHeight = vCurPos.y / 10.0f;
|
||||
}
|
||||
m_pHost.m_vVelocity = EC_Utility.ToA3DVECTOR3(vVel);
|
||||
m_pHost.m_MoveCtrl.SendMoveCmd(vCurPos, 2, GPDataTypeHelper.g_vOrigin, EC_Utility.ToA3DVECTOR3(vVel), iMoveMode | (int)GPMoveMode.GP_MOVE_RUN);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_bUseAutoMoveDialog)
|
||||
Finish();
|
||||
else
|
||||
m_iDestType = DestTypes.DEST_2D;
|
||||
|
||||
m_fPushPitch = 0;
|
||||
m_pHost.m_vVelocity.Clear();
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), fMaxSpeed, iMoveMode | (int)GPMoveMode.GP_MOVE_RUN);
|
||||
}
|
||||
}
|
||||
else if (m_iDestType == DestTypes.DEST_STANDJUMP)
|
||||
{
|
||||
// If host player fly off when jumping up, code will go here. In the
|
||||
// case, just stop move work is well.
|
||||
Finish();
|
||||
}
|
||||
else if (IsAutoPF())
|
||||
{
|
||||
//CECIntelligentRoute::Instance().ResetSearch();
|
||||
m_bSwitchTo2D = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Start gliding
|
||||
protected void Glide(float fMoveTime, A3DVECTOR3 vMoveDirH, float fDeltaTime, bool bFly)
|
||||
{
|
||||
|
||||
@@ -363,7 +363,7 @@ namespace BrewMonster {
|
||||
}
|
||||
|
||||
// Air/Water move
|
||||
A3DVECTOR3 AirWaterMove(A3DVECTOR3 vDir, float fSpeed, float fTime, bool bInAir, bool bTrace/* false */)
|
||||
public A3DVECTOR3 AirWaterMove(A3DVECTOR3 vDir, float fSpeed, float fTime, bool bInAir, bool bTrace/* false */)
|
||||
{
|
||||
|
||||
A3DVECTOR3 vRealDir = vDir;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using BrewMonster.Scripts.World;
|
||||
using BrewMonster.Network;
|
||||
using BrewMonster.Scripts.World;
|
||||
using CSNetwork.GPDataType;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
@@ -11,8 +12,76 @@ namespace BrewMonster.Scripts
|
||||
// Cho phép CECHostMove gán mask theo scene (giữ linh hoạt nhưng không phá cấu trúc)
|
||||
public static LayerMask BrushMask { get; set; } = 1<<7;
|
||||
public static LayerMask TerrainMask { get; set; } = 1<<6;
|
||||
public static LayerMask WaterMask { get; set; } = 1<<8;
|
||||
|
||||
const float LOCAL_EPSILON = 1e-5f;
|
||||
const float FLY_MAX_HEIGHT = 800.0f; // ·ÉÐеÄ×î´ó¸ß¶È£¡
|
||||
|
||||
// change this array when some new submap can go!
|
||||
static uint[,] available_maps =
|
||||
{
|
||||
{0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{0, 1, 1, 1, 1, 1, 1, 1},
|
||||
{0, 1, 1, 1, 1, 1, 1, 1},
|
||||
{0, 1, 1, 1, 1, 1, 1, 0},
|
||||
{0, 1, 1, 1, 1, 1, 1, 0},
|
||||
{0, 1, 1, 1, 1, 1, 1, 0},
|
||||
{0, 1, 1, 1, 1, 1, 1, 0},
|
||||
{0, 1, 1, 1, 1, 1, 1, 0},
|
||||
{0, 1, 1, 1, 1, 1, 1, 0},
|
||||
{0, 0, 0, 0, 0, 1, 1, 0},
|
||||
{1, 1, 0, 0, 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
static uint[,] available_maps4x4 =
|
||||
{
|
||||
{0, 0, 0, 0},
|
||||
{0, 1, 1, 0},
|
||||
{0, 1, 1, 0},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
static uint[,] available_maps3x3 =
|
||||
{
|
||||
{0, 0, 0},
|
||||
{0, 1, 0},
|
||||
{0, 0, 0},
|
||||
};
|
||||
|
||||
static uint[,] available_maps2x2 =
|
||||
{
|
||||
{1, 1},
|
||||
{0, 0},
|
||||
};
|
||||
|
||||
static uint[,] available_maps_137 =
|
||||
{
|
||||
{0, 0, 0, 0, 0, 0},
|
||||
{0, 1, 1, 1, 0, 0},
|
||||
{0, 0, 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
static uint[,] available_maps_161=
|
||||
{
|
||||
{0, 0, 0, 0},
|
||||
{0, 1, 1, 0},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
static uint[,] available_maps_162 =
|
||||
{
|
||||
{0, 0, 0, 0},
|
||||
{0, 1, 1, 0},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
static uint[,] available_maps_163 =
|
||||
{
|
||||
{0, 0, 0, 0},
|
||||
{0, 1, 1, 0},
|
||||
{0, 1, 0, 0},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
//[Flags]
|
||||
public class CDR_EVN
|
||||
@@ -22,7 +91,7 @@ namespace BrewMonster.Scripts
|
||||
CDR_WATER = 0x4;
|
||||
}
|
||||
|
||||
static LayerMask UsedMask_Ground() => BrushMask | TerrainMask;
|
||||
static LayerMask UsedMask_Ground() => BrushMask | TerrainMask | WaterMask;
|
||||
|
||||
static bool CollideWithEnv(env_trace_t pEnvTrc)
|
||||
{
|
||||
@@ -569,13 +638,195 @@ namespace BrewMonster.Scripts
|
||||
|
||||
static void AirMove(ref ON_AIR_CDR_INFO awmInfo)
|
||||
{
|
||||
float DIST_EPSILON = 1e-4f;
|
||||
int MAX_TRY = 1;
|
||||
float VEL_REFLECT = 0.0f;
|
||||
float fTime = awmInfo.t;
|
||||
//@todo : is it necessary to clamp the speed? By Kuiwu[20/9/2005]
|
||||
float fSpeed = awmInfo.fSpeed;
|
||||
if (fSpeed * fTime < DIST_EPSILON)
|
||||
{
|
||||
//@todo : set the output param. By Kuiwu[20/9/2005]
|
||||
return;
|
||||
}
|
||||
|
||||
A3DVECTOR3 vStart = new A3DVECTOR3(awmInfo.vCenter);
|
||||
A3DVECTOR3 vExt = new A3DVECTOR3(awmInfo.vExtent);
|
||||
A3DVECTOR3 vVelDir = new A3DVECTOR3(awmInfo.vVelDir);
|
||||
float dtp = 0f;
|
||||
A3DVECTOR3 vVelocity = new A3DVECTOR3(vVelDir* fSpeed);
|
||||
|
||||
if ((dtp = A3DVECTOR3.DotProduct(vVelDir, awmInfo.vTPNormal)) < 0.0f)
|
||||
{
|
||||
|
||||
//vVelocity = (vVelDir - awmInfo.vTPNormal * dtp - awmInfo.vTPNormal*dtp * 0.01f) * fSpeed;
|
||||
vVelocity = (vVelDir - awmInfo.vTPNormal * dtp) * fSpeed;
|
||||
}
|
||||
|
||||
A3DVECTOR3 vDelta = new A3DVECTOR3(vVelocity* fTime),
|
||||
vNormal = new A3DVECTOR3(),
|
||||
vFinalPos = new A3DVECTOR3(vStart);
|
||||
int nTry = 0;
|
||||
bool bClear = true;
|
||||
env_trace_t trcInfo;
|
||||
trcInfo.bWaterSolid = true;
|
||||
trcInfo.dwCheckFlag = CDR_EVN.CDR_TERRAIN | CDR_EVN.CDR_BRUSH | CDR_EVN.CDR_WATER;
|
||||
trcInfo.vExt = vExt;
|
||||
RaycastHit hit;
|
||||
while (nTry < MAX_TRY)
|
||||
{
|
||||
if (vDelta.SquaredMagnitude() < DIST_EPSILON)
|
||||
{
|
||||
break;
|
||||
}
|
||||
trcInfo.vStart = vStart;
|
||||
trcInfo.vDelta = vDelta;
|
||||
trcInfo.vTerStart = vStart;
|
||||
trcInfo.vTerStart.y -= vExt.y;
|
||||
trcInfo.vWatStart = vStart;
|
||||
trcInfo.vWatStart.y -= vExt.y;
|
||||
//bClear = !CollideWithEnv(&trcInfo);
|
||||
bClear = !Physics.BoxCast(EC_Utility.ToVector3(vStart),
|
||||
EC_Utility.ToVector3(vExt),
|
||||
EC_Utility.ToVector3(vStart + vVelDir).normalized,
|
||||
out hit,
|
||||
Quaternion.identity,
|
||||
EC_Utility.ToVector3(vDelta).magnitude,
|
||||
UsedMask_Ground());
|
||||
++nTry;
|
||||
if (bClear)
|
||||
{
|
||||
vFinalPos = vStart + vDelta;
|
||||
}
|
||||
else
|
||||
{
|
||||
vFinalPos = EC_Utility.ToA3DVECTOR3(hit.point);
|
||||
vNormal = EC_Utility.ToA3DVECTOR3(hit.normal);
|
||||
}
|
||||
//vStart += vDelta * trcInfo.fFraction;
|
||||
//vFinalPos = vStart;
|
||||
//fTime -= fTime * trcInfo.fFraction;
|
||||
//vNormal = trcInfo.vHitNormal;
|
||||
//fSpeed = A3DVECTOR3.Normalize(vVelocity,out vVelDir);
|
||||
//fSpeed *= (1 - nTry * 0.1f);
|
||||
//dtp = A3DVECTOR3.DotProduct(vNormal, vVelDir);
|
||||
//vVelocity = (vVelDir - vNormal * dtp - vNormal * dtp * VEL_REFLECT) * fSpeed;
|
||||
//vDelta = vVelocity * fTime;
|
||||
|
||||
}
|
||||
|
||||
//@note : prevent moving to the invalid area. By Kuiwu[20/9/2005]
|
||||
if (!IsPosInAvailableMap(vFinalPos))
|
||||
{
|
||||
//@todo : set some flag to notify the caller? By Kuiwu[20/9/2005]
|
||||
return;
|
||||
}
|
||||
//too high
|
||||
if (vFinalPos.y > FLY_MAX_HEIGHT - 2.0f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//see if meet height thresh
|
||||
Vector3 posVStart = EC_Utility.ToVector3(vFinalPos);
|
||||
float fDeltaY = awmInfo.fHeightThresh + 0.1f;
|
||||
|
||||
if (!Physics.Raycast(posVStart,
|
||||
(posVStart + Vector3.down * fDeltaY).normalized,
|
||||
out hit,
|
||||
fDeltaY,
|
||||
UsedMask_Ground()))
|
||||
{
|
||||
awmInfo.vCenter = vFinalPos;
|
||||
awmInfo.vTPNormal = vNormal;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
vFinalPos = EC_Utility.ToA3DVECTOR3(hit.point);
|
||||
vNormal = EC_Utility.ToA3DVECTOR3(hit.normal);
|
||||
awmInfo.vCenter = vFinalPos;
|
||||
awmInfo.vTPNormal = vNormal;
|
||||
}
|
||||
}
|
||||
|
||||
static void WaterMove(ref ON_AIR_CDR_INFO awmInfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Note by wenfeng, 05-09-16
|
||||
// This function is only for the Big world but not applicable for the
|
||||
// Instance world!
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static bool IsPosInAvailableMap(A3DVECTOR3 vPos)
|
||||
{
|
||||
float x, z;
|
||||
int su, sv;
|
||||
|
||||
//bool bFlag = true;
|
||||
CECWorld pWorld = EC_Game.GetGameRun().GetWorld();
|
||||
if(pWorld != null)
|
||||
{
|
||||
int idInst = pWorld.GetInstanceID();
|
||||
CECInstance pInst = EC_Game.GetGameRun().GetInstance(idInst);
|
||||
if (pInst == null)
|
||||
return false;
|
||||
|
||||
x = vPos.x + pInst.GetColNum() * 512.0f;
|
||||
z = pInst.GetRowNum() * 512.0f - vPos.z;
|
||||
su = (int) (x / 1024.0f);
|
||||
sv = (int) (z / 1024.0f);
|
||||
|
||||
if (su >= pInst.GetColNum() || su< 0 ||
|
||||
|
||||
sv >= pInst.GetRowNum() || sv< 0)
|
||||
return false;
|
||||
|
||||
switch (idInst)
|
||||
{
|
||||
case 1:
|
||||
return available_maps[sv, su] != 0 && vPos.x <= 3877.0f; // ½ûÖ¹ëÊ×åÁÙ½ü¿´µ½µØÍ¼±ßÔµ
|
||||
|
||||
case 121:
|
||||
case 122:
|
||||
|
||||
return available_maps4x4[sv, su] != 0? true : false;
|
||||
|
||||
case 118:
|
||||
case 119:
|
||||
case 120:
|
||||
case 123:
|
||||
case 125:
|
||||
|
||||
return available_maps3x3[sv, su] != 0? true : false;
|
||||
|
||||
case 134:
|
||||
|
||||
return available_maps2x2[sv, su] != 0 ? true : false;
|
||||
|
||||
case 137:
|
||||
return available_maps_137[sv, su] != 0 ? true : false;
|
||||
|
||||
case 161:
|
||||
return available_maps_161[sv, su] != 0;
|
||||
|
||||
case 162:
|
||||
return available_maps_162[sv, su] != 0 ? true : false;
|
||||
|
||||
case 163:
|
||||
return available_maps_163[sv, su] != 0 ? true : false;
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public struct OtherPlayer_Move_Info
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace BrewMonster.Scripts.World
|
||||
protected A3DTerrain2 m_pA3DTerrain;
|
||||
CECOrnamentMan m_pOnmtMan;
|
||||
uint m_dwBornStamp = 0;
|
||||
int m_idInst = 161; // id of instance
|
||||
|
||||
public uint GetBornStamp() { return m_dwBornStamp++; }
|
||||
|
||||
@@ -26,5 +27,8 @@ namespace BrewMonster.Scripts.World
|
||||
{
|
||||
return m_pOnmtMan;
|
||||
}
|
||||
}
|
||||
|
||||
// Get id of instance
|
||||
public int GetInstanceID(){ return m_idInst; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
using BrewMonster.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BrewMonster.Scripts
|
||||
{
|
||||
public class CECInstance
|
||||
{
|
||||
int m_id = 161; // Instance ID
|
||||
ushort[] m_strName; // Instance name
|
||||
string m_strPath; // Path
|
||||
int m_iRowNum = 3; // Number of map row
|
||||
int m_iColNum = 4; // Number of map column
|
||||
bool m_bLimitJump = false; // ÊÇ·ñÏÞÌø
|
||||
List<string> m_routeFiles;
|
||||
|
||||
public CECInstance()
|
||||
{
|
||||
m_id = 161;
|
||||
m_iRowNum = 3;
|
||||
m_iColNum = 4;
|
||||
m_bLimitJump = false;
|
||||
}
|
||||
|
||||
// Get instance ID
|
||||
public int GetID() { return m_id; }
|
||||
// Get instance name
|
||||
public ushort[] GetName() { return m_strName; }
|
||||
// Get instance data path
|
||||
public string GetPath() { return m_strPath; }
|
||||
// Get row and column number of map
|
||||
public int GetRowNum(){ return m_iRowNum; }
|
||||
public int GetColNum(){ return m_iColNum; }
|
||||
public bool GetLimitJump(){ return m_bLimitJump; }
|
||||
public List<string> GetRouteFiles(){ return m_routeFiles; }
|
||||
public bool GetPositionRelatedTexture(float x, float z, string filePath)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Load instance information from file
|
||||
public bool Load(AWScriptFile psf)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d943e5add12fde4dbb6e3bea3dc4d65
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:94045fc7eb49643c229531f88aa7ac1d8a6f59d3e0d2bfb5a4939f9b3fb0ed04
|
||||
size 200173095
|
||||
oid sha256:8003b60a4af29a6f7767b8b3f782a1f7fd576ce667bdbcfd0124f3071e3e5c0d
|
||||
size 200174193
|
||||
|
||||
@@ -5,6 +5,7 @@ using CSNetwork;
|
||||
using CSNetwork.GPDataType;
|
||||
using CSNetwork.GPDataType;
|
||||
using CSNetwork.Protocols.RPCData;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading.Tasks;
|
||||
using Unity.Cinemachine;
|
||||
@@ -27,6 +28,7 @@ public partial class CECGameRun
|
||||
|
||||
public CECWorld GetWorld() { return m_pWorld; }
|
||||
|
||||
private static Dictionary<int, CECInstance> m_InstTab = new Dictionary<int, CECInstance>();
|
||||
public void Init()
|
||||
{
|
||||
Application.targetFrameRate = 60;
|
||||
@@ -40,6 +42,13 @@ public partial class CECGameRun
|
||||
// LoadPrefabs();
|
||||
EC_ManMessage.RegisterHandler(this);
|
||||
|
||||
// Load instance information
|
||||
//if (!LoadInstanceInfo("Configs\\instance.txt"))
|
||||
//{
|
||||
// glb_ErrorOutput(ECERR_FAILEDTOCALL, "CECGameRun::Init", __LINE__);
|
||||
// return false;
|
||||
//}
|
||||
m_InstTab.Add(161, new CECInstance());
|
||||
AddressableManager.Instance.OnDispose += Dispose;
|
||||
}
|
||||
|
||||
@@ -317,4 +326,15 @@ public partial class CECGameRun
|
||||
}
|
||||
return m_pUIManager;
|
||||
}
|
||||
|
||||
|
||||
// Get instance by ID
|
||||
public CECInstance GetInstance(int id)
|
||||
{
|
||||
if (m_InstTab.TryGetValue(id, out CECInstance value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user