parent
32b9ebea03
commit
fbf199bc6c
File diff suppressed because one or more lines are too long
|
@ -8,15 +8,15 @@ Material:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: hnhg_meidui01_d
|
||||
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||
m_Shader: {fileID: -6465566751694194690, guid: ac77f135d70cb3349b34c80bb2f09b86,
|
||||
type: 3}
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 6
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap:
|
||||
RenderType: Opaque
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
|
@ -124,7 +124,9 @@ Material:
|
|||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _EMISSION_WEIGHT: 1
|
||||
- _EnableOutLine: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 5
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
|
@ -151,7 +153,7 @@ Material:
|
|||
m_Colors:
|
||||
- _BASE_COLOR: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 0, g: 1, b: 0.14202738, a: 1}
|
||||
- _EMISSION_COLOR: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _REFLECTIONS_COLOR: {r: 0, g: 0, b: 0, a: 1}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0c61ab387175b2b4f89f20e47334d5c4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,139 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
[CustomEditor(typeof(MiniMapManager))]
|
||||
public class MiniMapManagerEditor : Editor
|
||||
{
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 保持玩家在小地图正中间
|
||||
///// </summary>
|
||||
//public bool KeepPlayerInMiniMapCenter;
|
||||
|
||||
///// <summary>
|
||||
///// 小地图相机
|
||||
///// </summary>
|
||||
//public Camera MiniCamera;
|
||||
///// <summary>
|
||||
///// 玩家
|
||||
///// </summary>
|
||||
//public Transform Player;
|
||||
///// <summary>
|
||||
///// 原点物体-提供原点坐标
|
||||
///// </summary>
|
||||
//public Transform OriginTransform;
|
||||
///// <summary>
|
||||
///// 小地图组件
|
||||
///// </summary>
|
||||
//public RectTransform MiniMap;
|
||||
///// <summary>
|
||||
///// 小地图玩家坐标
|
||||
///// </summary>
|
||||
//public RectTransform PlayerInMap;
|
||||
|
||||
///// <summary>
|
||||
///// 真实地图尺寸-宽度
|
||||
///// 若非规则图形,使用Plan测出大概尺寸
|
||||
///// </summary>
|
||||
//private float realMapWidth;
|
||||
///// <summary>
|
||||
///// 真实地图尺寸-高度
|
||||
///// 若非规则图形,使用Plan测出大概尺寸
|
||||
///// </summary>
|
||||
//private float realMapHeight;
|
||||
|
||||
///// <summary>
|
||||
///// 真实地图与小地图宽度比例,即小地图宽度比真实地图宽度
|
||||
///// </summary>
|
||||
//private float widthRate;
|
||||
///// <summary>
|
||||
///// 真实地图与小地图高度比例,即小地图高度比真实地图高度
|
||||
///// </summary>
|
||||
//private float heightRate;
|
||||
|
||||
///// <summary>
|
||||
///// 小地图满屏展示尺寸
|
||||
///// </summary>
|
||||
//public float FullScreenMiniMapOrthographicSize;
|
||||
///// <summary>
|
||||
///// 小地图相机正交比例
|
||||
///// </summary>
|
||||
//[HideInInspector]
|
||||
//public float orthographicSizeRate;
|
||||
|
||||
///// <summary>
|
||||
///// 左键拖拽小地图速度
|
||||
///// </summary>
|
||||
//[Range(0, 10)]
|
||||
//public float drag_speed = 0.5f;
|
||||
///// <summary>
|
||||
///// 滚轮缩放小地图速度
|
||||
///// </summary>
|
||||
//[Range(0, 10)]
|
||||
//public float ZoomSpeed = 1;
|
||||
///// <summary>
|
||||
///// 缩放尺寸限制
|
||||
///// 最小值应大于0
|
||||
///// </summary>
|
||||
//public Vector2 OrthographicSizeClamp = new Vector2(5, 15);
|
||||
|
||||
SerializedProperty KeepPlayerInMiniMapCenter;
|
||||
SerializedProperty MiniCamera;
|
||||
SerializedProperty Player;
|
||||
SerializedProperty OriginTransform;
|
||||
SerializedProperty MiniMap;
|
||||
SerializedProperty PlayerInMap;
|
||||
SerializedProperty FullScreenMiniMapOrthographicSize;
|
||||
SerializedProperty DragSpeed;
|
||||
SerializedProperty ZoomSpeed;
|
||||
SerializedProperty OrthographicSizeClamp;
|
||||
|
||||
bool use_chinese;
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
KeepPlayerInMiniMapCenter = serializedObject.FindProperty("KeepPlayerInMiniMapCenter");
|
||||
MiniCamera = serializedObject.FindProperty("MiniCamera");
|
||||
Player = serializedObject.FindProperty("Player");
|
||||
OriginTransform = serializedObject.FindProperty("OriginTransform");
|
||||
MiniMap = serializedObject.FindProperty("MiniMap");
|
||||
PlayerInMap = serializedObject.FindProperty("PlayerInMap");
|
||||
|
||||
FullScreenMiniMapOrthographicSize = serializedObject.FindProperty("FullScreenMiniMapOrthographicSize");
|
||||
|
||||
DragSpeed = serializedObject.FindProperty("DragSpeed");
|
||||
ZoomSpeed = serializedObject.FindProperty("ZoomSpeed");
|
||||
OrthographicSizeClamp = serializedObject.FindProperty("OrthographicSizeClamp");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
//base.OnInspectorGUI();
|
||||
serializedObject.Update();
|
||||
|
||||
use_chinese = EditorGUILayout.Toggle("使用中文参数名", use_chinese);
|
||||
|
||||
EditorGUILayout.PropertyField(KeepPlayerInMiniMapCenter, new GUIContent(use_chinese ? "保持玩家图标居中" : KeepPlayerInMiniMapCenter.name));
|
||||
EditorGUILayout.PropertyField(MiniCamera, new GUIContent(use_chinese ? "小地图相机" : MiniCamera.name));
|
||||
EditorGUILayout.PropertyField(Player, new GUIContent(use_chinese ? "玩家" : Player.name));
|
||||
EditorGUILayout.PropertyField(OriginTransform, new GUIContent(use_chinese ? "地图中心坐标" : OriginTransform.name));
|
||||
EditorGUILayout.PropertyField(MiniMap, new GUIContent(use_chinese ? "小地图" : MiniMap.name));
|
||||
EditorGUILayout.PropertyField(PlayerInMap, new GUIContent(use_chinese ? "小地图玩家图标" : PlayerInMap.name));
|
||||
|
||||
GUILayout.Space(5);
|
||||
GUILayout.Label("用户配置参数");
|
||||
GUILayout.Space(5);
|
||||
|
||||
EditorGUILayout.PropertyField(FullScreenMiniMapOrthographicSize, new GUIContent(use_chinese ? "小地图相机可视全地图时的正交尺寸大小" : FullScreenMiniMapOrthographicSize.name));
|
||||
EditorGUILayout.PropertyField(DragSpeed, new GUIContent(use_chinese ? "小地图拖拽速度" : DragSpeed.name));
|
||||
EditorGUILayout.PropertyField(ZoomSpeed, new GUIContent(use_chinese ? "小地图缩放速度" : ZoomSpeed.name));
|
||||
EditorGUILayout.PropertyField(OrthographicSizeClamp, new GUIContent(use_chinese ? "小地图缩放限制范围" : OrthographicSizeClamp.name));
|
||||
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b31da15c31c9f404ba76c3025b5c431d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,5 +1,96 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &2702277167771992516
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1672520607096677409}
|
||||
- component: {fileID: 6878183689156780372}
|
||||
- component: {fileID: 4358171087159319425}
|
||||
- component: {fileID: 7427168197812437161}
|
||||
m_Layer: 5
|
||||
m_Name: Mask
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1672520607096677409
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2702277167771992516}
|
||||
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:
|
||||
- {fileID: 3896793119557593033}
|
||||
m_Father: {fileID: 3896793119978184412}
|
||||
m_RootOrder: 0
|
||||
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: -10, y: -10}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6878183689156780372
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2702277167771992516}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &4358171087159319425
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2702277167771992516}
|
||||
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: 1}
|
||||
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 &7427168197812437161
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2702277167771992516}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ShowMaskGraphic: 0
|
||||
--- !u!1 &3896793119431439237
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -122,7 +213,7 @@ GameObject:
|
|||
- component: {fileID: 3896793119557593046}
|
||||
- component: {fileID: 3896793119557593044}
|
||||
m_Layer: 5
|
||||
m_Name: MiniMap
|
||||
m_Name: Map
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
@ -141,13 +232,13 @@ RectTransform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3896793120727956045}
|
||||
m_Father: {fileID: 3896793119978184412}
|
||||
m_Father: {fileID: 1672520607096677409}
|
||||
m_RootOrder: 0
|
||||
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: -10, y: -10}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3896793119557593047
|
||||
CanvasRenderer:
|
||||
|
@ -196,9 +287,6 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: d1616ef1655c92d4582abd6baa9bfc90, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
drag_speed: 0.5
|
||||
ZoomSpeed: 1
|
||||
OrthographicSizeClamp: {x: 5, y: 15}
|
||||
--- !u!1 &3896793119596260640
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -295,7 +383,7 @@ GameObject:
|
|||
- component: {fileID: 3896793119978184410}
|
||||
- component: {fileID: 3896793119978184408}
|
||||
m_Layer: 5
|
||||
m_Name: MapMask
|
||||
m_Name: MapFrame
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
@ -313,7 +401,7 @@ RectTransform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3896793119557593033}
|
||||
- {fileID: 1672520607096677409}
|
||||
m_Father: {fileID: 3896793120640402852}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
@ -529,6 +617,9 @@ MonoBehaviour:
|
|||
PlayerInMap: {fileID: 3896793120727956045}
|
||||
FullScreenMiniMapOrthographicSize: 15
|
||||
orthographicSizeRate: 0
|
||||
DragSpeed: 0.5
|
||||
ZoomSpeed: 1
|
||||
OrthographicSizeClamp: {x: 5, y: 15}
|
||||
--- !u!1 &3896793120727956044
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -1,92 +1,79 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class MiniMap : MonoBehaviour, IPointerDownHandler, IPointerMoveHandler, IPointerUpHandler, IPointerExitHandler, IScrollHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// 拖拽速度
|
||||
/// </summary>
|
||||
[Range(0, 10)]
|
||||
public float drag_speed = 0.5f;
|
||||
[Range(0, 10)]
|
||||
public float ZoomSpeed = 1;
|
||||
/// <summary>
|
||||
/// 管理脚本
|
||||
/// </summary>
|
||||
MiniMapManager m_MiniMapManager;
|
||||
/// <summary>
|
||||
/// 缩放尺寸限制
|
||||
/// 最小值应大于0
|
||||
/// </summary>
|
||||
public Vector2 OrthographicSizeClamp = new Vector2(5, 15);
|
||||
bool hold;
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
hold = eventData.button == PointerEventData.InputButton.Left;
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
hold = false;
|
||||
}
|
||||
|
||||
public void OnPointerMove(PointerEventData eventData)
|
||||
{
|
||||
if (hold)
|
||||
{
|
||||
m_MiniMapManager.MiniCamera.transform.position += new Vector3(-eventData.delta.x, 0, -eventData.delta.y) * drag_speed * 0.1f * m_MiniMapManager.orthographicSizeRate;
|
||||
//以上值还要乘相机orthographicSize比例
|
||||
|
||||
var clamp_value = m_MiniMapManager.MiniCamera.orthographicSize - m_MiniMapManager.FullScreenMiniMapOrthographicSize;
|
||||
|
||||
if (clamp_value > 0)//保证小地图缩小至小于全尺寸时地图处于正中心,且不可再移动
|
||||
{
|
||||
clamp_value = 0;
|
||||
}
|
||||
|
||||
m_MiniMapManager.MiniCamera.transform.position = new Vector3(
|
||||
Mathf.Clamp(m_MiniMapManager.MiniCamera.transform.position.x, clamp_value, -clamp_value),
|
||||
m_MiniMapManager.MiniCamera.transform.position.y,
|
||||
Mathf.Clamp(m_MiniMapManager.MiniCamera.transform.position.z, clamp_value, -clamp_value)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerUp(PointerEventData eventData)
|
||||
{
|
||||
hold = false;
|
||||
}
|
||||
|
||||
public void OnScroll(PointerEventData eventData)
|
||||
{
|
||||
m_MiniMapManager.MiniCamera.orthographicSize -= eventData.scrollDelta.y;
|
||||
m_MiniMapManager.MiniCamera.orthographicSize = Mathf.Clamp(m_MiniMapManager.MiniCamera.orthographicSize, OrthographicSizeClamp.x, OrthographicSizeClamp.y);
|
||||
|
||||
var clamp_value = m_MiniMapManager.MiniCamera.orthographicSize - m_MiniMapManager.FullScreenMiniMapOrthographicSize;
|
||||
|
||||
//缩放时如果坐标超出限制,控制坐标至限制值
|
||||
if (Mathf.Abs(m_MiniMapManager.MiniCamera.transform.position.x) > -clamp_value || Mathf.Abs(m_MiniMapManager.MiniCamera.transform.position.z) > -clamp_value)
|
||||
{
|
||||
m_MiniMapManager.MiniCamera.transform.position = new Vector3(
|
||||
Mathf.Clamp(m_MiniMapManager.MiniCamera.transform.position.x, clamp_value, -clamp_value),
|
||||
m_MiniMapManager.MiniCamera.transform.position.y,
|
||||
Mathf.Clamp(m_MiniMapManager.MiniCamera.transform.position.z, clamp_value, -clamp_value)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
m_MiniMapManager = GetComponentInParent<MiniMapManager>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class MiniMap : MonoBehaviour, IPointerDownHandler, IPointerMoveHandler, IPointerUpHandler, IPointerExitHandler, IScrollHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// 管理脚本
|
||||
/// </summary>
|
||||
MiniMapManager m_MiniMapManager;
|
||||
|
||||
bool hold;
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
hold = eventData.button == PointerEventData.InputButton.Left;
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
hold = false;
|
||||
}
|
||||
|
||||
public void OnPointerMove(PointerEventData eventData)
|
||||
{
|
||||
if (hold)
|
||||
{
|
||||
m_MiniMapManager.MiniCamera.transform.position += new Vector3(-eventData.delta.x, 0, -eventData.delta.y) * m_MiniMapManager.DragSpeed * 0.1f * m_MiniMapManager.orthographicSizeRate;
|
||||
//以上值还要乘相机orthographicSize比例
|
||||
|
||||
var clamp_value = m_MiniMapManager.MiniCamera.orthographicSize - m_MiniMapManager.FullScreenMiniMapOrthographicSize;
|
||||
|
||||
if (clamp_value > 0)//保证小地图缩小至小于全尺寸时地图处于正中心,且不可再移动
|
||||
{
|
||||
clamp_value = 0;
|
||||
}
|
||||
|
||||
m_MiniMapManager.MiniCamera.transform.position = new Vector3(
|
||||
Mathf.Clamp(m_MiniMapManager.MiniCamera.transform.position.x, clamp_value, -clamp_value),
|
||||
m_MiniMapManager.MiniCamera.transform.position.y,
|
||||
Mathf.Clamp(m_MiniMapManager.MiniCamera.transform.position.z, clamp_value, -clamp_value)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerUp(PointerEventData eventData)
|
||||
{
|
||||
hold = false;
|
||||
}
|
||||
|
||||
public void OnScroll(PointerEventData eventData)
|
||||
{
|
||||
m_MiniMapManager.MiniCamera.orthographicSize -= eventData.scrollDelta.y * m_MiniMapManager.ZoomSpeed;
|
||||
m_MiniMapManager.MiniCamera.orthographicSize = Mathf.Clamp(m_MiniMapManager.MiniCamera.orthographicSize, m_MiniMapManager.OrthographicSizeClamp.x, m_MiniMapManager.OrthographicSizeClamp.y);
|
||||
|
||||
var clamp_value = m_MiniMapManager.MiniCamera.orthographicSize - m_MiniMapManager.FullScreenMiniMapOrthographicSize;
|
||||
|
||||
//缩放时如果坐标超出限制,控制坐标至限制值
|
||||
if (Mathf.Abs(m_MiniMapManager.MiniCamera.transform.position.x) > -clamp_value || Mathf.Abs(m_MiniMapManager.MiniCamera.transform.position.z) > -clamp_value)
|
||||
{
|
||||
m_MiniMapManager.MiniCamera.transform.position = new Vector3(
|
||||
Mathf.Clamp(m_MiniMapManager.MiniCamera.transform.position.x, clamp_value, -clamp_value),
|
||||
m_MiniMapManager.MiniCamera.transform.position.y,
|
||||
Mathf.Clamp(m_MiniMapManager.MiniCamera.transform.position.z, clamp_value, -clamp_value)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
m_MiniMapManager = GetComponentInParent<MiniMapManager>();
|
||||
if (m_MiniMapManager == null)
|
||||
{
|
||||
this.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,119 +1,135 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
using UnityEngine;
|
||||
|
||||
public class MiniMapManager : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// 保持玩家在小地图正中间
|
||||
/// </summary>
|
||||
public bool KeepPlayerInMiniMapCenter;
|
||||
|
||||
/// <summary>
|
||||
/// 小地图相机
|
||||
/// </summary>
|
||||
public Camera MiniCamera;
|
||||
/// <summary>
|
||||
/// 玩家
|
||||
/// </summary>
|
||||
public Transform Player;
|
||||
/// <summary>
|
||||
/// 原点物体-提供原点坐标
|
||||
/// </summary>
|
||||
public Transform OriginTransform;
|
||||
/// <summary>
|
||||
/// 小地图组件
|
||||
/// </summary>
|
||||
public RectTransform MiniMap;
|
||||
/// <summary>
|
||||
/// 小地图玩家坐标
|
||||
/// </summary>
|
||||
public RectTransform PlayerInMap;
|
||||
|
||||
/// <summary>
|
||||
/// 真实地图尺寸-宽度
|
||||
/// 若非规则图形,使用Plan测出大概尺寸
|
||||
/// </summary>
|
||||
private float realMapWidth;
|
||||
/// <summary>
|
||||
/// 真实地图尺寸-高度
|
||||
/// 若非规则图形,使用Plan测出大概尺寸
|
||||
/// </summary>
|
||||
private float realMapHeight;
|
||||
|
||||
/// <summary>
|
||||
/// 真实地图与小地图宽度比例,即小地图宽度比真实地图宽度
|
||||
/// </summary>
|
||||
private float widthRate;
|
||||
/// <summary>
|
||||
/// 真实地图与小地图高度比例,即小地图高度比真实地图高度
|
||||
/// </summary>
|
||||
private float heightRate;
|
||||
|
||||
/// <summary>
|
||||
/// 小地图满屏展示尺寸
|
||||
/// </summary>
|
||||
public float FullScreenMiniMapOrthographicSize;
|
||||
/// <summary>
|
||||
/// 小地图相机正交比例
|
||||
/// </summary>
|
||||
[HideInInspector]
|
||||
public float orthographicSizeRate;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
if (Player == null)
|
||||
{
|
||||
Player = Camera.main.transform;
|
||||
}
|
||||
|
||||
if (FullScreenMiniMapOrthographicSize <= 0)
|
||||
{
|
||||
Debug.Log("全屏正交尺寸值设置错误!");
|
||||
}
|
||||
|
||||
if (transform.position != Vector3.zero)
|
||||
{
|
||||
var pos = transform.position;
|
||||
MiniCamera.transform.localPosition = new Vector3(pos.x, MiniCamera.transform.position.y, pos.z);
|
||||
transform.position = Vector3.zero;
|
||||
}
|
||||
|
||||
//规范情况下,真实地图的尺寸和正交相机正交尺寸成比例
|
||||
realMapWidth = realMapHeight = FullScreenMiniMapOrthographicSize * 2;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (Player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (FullScreenMiniMapOrthographicSize <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerInMap.rotation = Quaternion.Euler(0, 0, -Player.eulerAngles.y);
|
||||
|
||||
if (KeepPlayerInMiniMapCenter)
|
||||
{
|
||||
var pos = MiniCamera.transform.position;
|
||||
pos.x = Player.position.x;
|
||||
pos.z = Player.position.z;
|
||||
MiniCamera.transform.position = pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
widthRate = (Player.position.z - OriginTransform.position.z - MiniCamera.transform.position.z) / realMapWidth;
|
||||
heightRate = (Player.position.x - OriginTransform.position.x - MiniCamera.transform.position.x) / realMapHeight;
|
||||
|
||||
//相机正交比例-当前正交尺寸比小地图满屏展示尺寸
|
||||
orthographicSizeRate = MiniCamera.orthographicSize / FullScreenMiniMapOrthographicSize;
|
||||
|
||||
PlayerInMap.anchoredPosition = new Vector2(MiniMap.rect.height * heightRate, MiniMap.rect.width * widthRate) / orthographicSizeRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
using UnityEngine;
|
||||
|
||||
public class MiniMapManager : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// 保持玩家在小地图正中间
|
||||
/// </summary>
|
||||
public bool KeepPlayerInMiniMapCenter;
|
||||
|
||||
/// <summary>
|
||||
/// 小地图相机
|
||||
/// </summary>
|
||||
public Camera MiniCamera;
|
||||
/// <summary>
|
||||
/// 玩家
|
||||
/// </summary>
|
||||
public Transform Player;
|
||||
/// <summary>
|
||||
/// 原点物体-提供原点坐标
|
||||
/// </summary>
|
||||
public Transform OriginTransform;
|
||||
/// <summary>
|
||||
/// 小地图组件
|
||||
/// </summary>
|
||||
public RectTransform MiniMap;
|
||||
/// <summary>
|
||||
/// 小地图玩家坐标
|
||||
/// </summary>
|
||||
public RectTransform PlayerInMap;
|
||||
|
||||
/// <summary>
|
||||
/// 真实地图尺寸-宽度
|
||||
/// 若非规则图形,使用Plan测出大概尺寸
|
||||
/// </summary>
|
||||
private float realMapWidth;
|
||||
/// <summary>
|
||||
/// 真实地图尺寸-高度
|
||||
/// 若非规则图形,使用Plan测出大概尺寸
|
||||
/// </summary>
|
||||
private float realMapHeight;
|
||||
|
||||
/// <summary>
|
||||
/// 真实地图与小地图宽度比例,即小地图宽度比真实地图宽度
|
||||
/// </summary>
|
||||
private float widthRate;
|
||||
/// <summary>
|
||||
/// 真实地图与小地图高度比例,即小地图高度比真实地图高度
|
||||
/// </summary>
|
||||
private float heightRate;
|
||||
|
||||
/// <summary>
|
||||
/// 小地图满屏展示尺寸
|
||||
/// </summary>
|
||||
public float FullScreenMiniMapOrthographicSize;
|
||||
/// <summary>
|
||||
/// 小地图相机正交比例
|
||||
/// </summary>
|
||||
[HideInInspector]
|
||||
public float orthographicSizeRate;
|
||||
|
||||
/// <summary>
|
||||
/// 左键拖拽小地图速度
|
||||
/// </summary>
|
||||
[Range(0, 10)]
|
||||
public float DragSpeed = 0.5f;
|
||||
/// <summary>
|
||||
/// 滚轮缩放小地图速度
|
||||
/// </summary>
|
||||
[Range(0, 10)]
|
||||
public float ZoomSpeed = 1;
|
||||
/// <summary>
|
||||
/// 缩放尺寸限制
|
||||
/// 最小值应大于0
|
||||
/// </summary>
|
||||
public Vector2 OrthographicSizeClamp = new Vector2(5, 15);
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
if (Player == null)
|
||||
{
|
||||
Player = Camera.main.transform;
|
||||
}
|
||||
|
||||
if (FullScreenMiniMapOrthographicSize <= 0)
|
||||
{
|
||||
Debug.Log("全屏正交尺寸值设置错误!");
|
||||
}
|
||||
|
||||
if (transform.position != Vector3.zero)
|
||||
{
|
||||
var pos = transform.position;
|
||||
MiniCamera.transform.localPosition = new Vector3(pos.x, MiniCamera.transform.position.y, pos.z);
|
||||
transform.position = Vector3.zero;
|
||||
}
|
||||
|
||||
//规范情况下,真实地图的尺寸和正交相机正交尺寸成比例
|
||||
realMapWidth = realMapHeight = FullScreenMiniMapOrthographicSize * 2;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (Player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (FullScreenMiniMapOrthographicSize <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerInMap.rotation = Quaternion.Euler(0, 0, -Player.eulerAngles.y);
|
||||
|
||||
if (KeepPlayerInMiniMapCenter)
|
||||
{
|
||||
var pos = MiniCamera.transform.position;
|
||||
pos.x = Player.position.x;
|
||||
pos.z = Player.position.z;
|
||||
MiniCamera.transform.position = pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
widthRate = (Player.position.z - OriginTransform.position.z - MiniCamera.transform.position.z) / realMapWidth;
|
||||
heightRate = (Player.position.x - OriginTransform.position.x - MiniCamera.transform.position.x) / realMapHeight;
|
||||
|
||||
//相机正交比例-当前正交尺寸比小地图满屏展示尺寸
|
||||
orthographicSizeRate = MiniCamera.orthographicSize / FullScreenMiniMapOrthographicSize;
|
||||
|
||||
PlayerInMap.anchoredPosition = new Vector2(MiniMap.rect.height * heightRate, MiniMap.rect.width * widthRate) / orthographicSizeRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1113,7 +1113,7 @@ Transform:
|
|||
m_Children:
|
||||
- {fileID: 151840903}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &550376134
|
||||
MonoBehaviour:
|
||||
|
@ -1550,7 +1550,7 @@ Transform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||
--- !u!114 &659875677
|
||||
MonoBehaviour:
|
||||
|
@ -3088,8 +3088,65 @@ Transform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1216416867
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1216416869}
|
||||
- component: {fileID: 1216416868}
|
||||
- component: {fileID: 1216416870}
|
||||
m_Layer: 0
|
||||
m_Name: Main
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1216416868
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1216416867}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e8693d8a8bb5b38409abfbac6b3a4d31, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!4 &1216416869
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1216416867}
|
||||
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: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1216416870
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1216416867}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: cdbc66ddc55c7004b8ccf9960b650941, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1237664139
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -4584,7 +4641,7 @@ Transform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1701869334
|
||||
MonoBehaviour:
|
||||
|
@ -5647,7 +5704,7 @@ Transform:
|
|||
- {fileID: 1850210587}
|
||||
- {fileID: 1180343853}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 6
|
||||
m_RootOrder: 7
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1946398638
|
||||
MonoBehaviour:
|
||||
|
@ -5991,6 +6048,7 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
RoamAnchorRoot: {fileID: 0}
|
||||
MainCamera: {fileID: 0}
|
||||
--- !u!4 &2105364401
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -6004,7 +6062,7 @@ Transform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &2123437047
|
||||
GameObject:
|
||||
|
@ -6196,6 +6254,16 @@ PrefabInstance:
|
|||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 1672520607096677409, guid: ed7444d8edc56e741ae55811aa53b43b,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: -7
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1672520607096677409, guid: ed7444d8edc56e741ae55811aa53b43b,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -1.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3896793119431439233, guid: ed7444d8edc56e741ae55811aa53b43b,
|
||||
type: 3}
|
||||
propertyPath: orthographic size
|
||||
|
@ -6209,12 +6277,12 @@ PrefabInstance:
|
|||
- target: {fileID: 3896793119557593033, guid: ed7444d8edc56e741ae55811aa53b43b,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: -7
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3896793119557593033, guid: ed7444d8edc56e741ae55811aa53b43b,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -1.5
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3896793119557593044, guid: ed7444d8edc56e741ae55811aa53b43b,
|
||||
type: 3}
|
||||
|
@ -6280,7 +6348,7 @@ PrefabInstance:
|
|||
- target: {fileID: 3896793120661545786, guid: ed7444d8edc56e741ae55811aa53b43b,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 7
|
||||
value: 8
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3896793120661545786, guid: ed7444d8edc56e741ae55811aa53b43b,
|
||||
type: 3}
|
||||
|
@ -6347,16 +6415,31 @@ PrefabInstance:
|
|||
propertyPath: realMapHeight
|
||||
value: 240
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3896793120661545787, guid: ed7444d8edc56e741ae55811aa53b43b,
|
||||
type: 3}
|
||||
propertyPath: OrthographicSizeClamp.x
|
||||
value: 20
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3896793120661545787, guid: ed7444d8edc56e741ae55811aa53b43b,
|
||||
type: 3}
|
||||
propertyPath: OrthographicSizeClamp.y
|
||||
value: 450
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3896793120661545787, guid: ed7444d8edc56e741ae55811aa53b43b,
|
||||
type: 3}
|
||||
propertyPath: FullScreenMiniMapOrthographicSize
|
||||
value: 118
|
||||
value: 450
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3896793120661545789, guid: ed7444d8edc56e741ae55811aa53b43b,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: MiniMapRoot
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3896793120661545789, guid: ed7444d8edc56e741ae55811aa53b43b,
|
||||
type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3896793120727956042, guid: ed7444d8edc56e741ae55811aa53b43b,
|
||||
type: 3}
|
||||
propertyPath: m_Color.b
|
||||
|
@ -7436,7 +7519,7 @@ Transform:
|
|||
- {fileID: 6429264745446262328}
|
||||
- {fileID: 1382332820527393840}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 5
|
||||
m_RootOrder: 6
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &543496184770070494
|
||||
GameObject:
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,19 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class MainScene : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
SceneManager.LoadScene(2, LoadSceneMode.Additive);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e8693d8a8bb5b38409abfbac6b3a4d31
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,24 +1,23 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ModelRoot : Singleton<ModelRoot>
|
||||
{
|
||||
/// <summary>
|
||||
/// 漫游锚点父物体
|
||||
/// </summary>
|
||||
public GameObject RoamAnchorRoot;
|
||||
|
||||
public override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
RoamAnchorRoot = GameObject.Find("RoamAnchorRoot");
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ModelRoot : Singleton<ModelRoot>
|
||||
{
|
||||
/// <summary>
|
||||
/// 漫游锚点父物体
|
||||
/// </summary>
|
||||
public GameObject RoamAnchorRoot;
|
||||
/// <summary>
|
||||
/// 主相机
|
||||
/// </summary>
|
||||
public Camera MainCamera;
|
||||
|
||||
public override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
RoamAnchorRoot = GameObject.Find("RoamAnchorRoot");
|
||||
MainCamera = Camera.main;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PhysicManager
|
||||
{
|
||||
public void PhysicRay(Ray _ray)
|
||||
{
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(_ray, out hit)) ;
|
||||
}
|
||||
}
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PhysicManager : MonoBehaviour
|
||||
{
|
||||
public void PhysicRay(Ray _ray)
|
||||
{
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(_ray, out hit))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 879562c68efcc68489ec9a7604a56bc9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,76 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Helper : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// 每组数量
|
||||
/// </summary>
|
||||
public float GroupLengtn = 4;
|
||||
|
||||
public string GroupName = "";
|
||||
|
||||
[ContextMenu("分类")]
|
||||
void Tod()
|
||||
{
|
||||
if (GroupLengtn <= 0)
|
||||
{
|
||||
Debug.Log("未正确设置每组元素数量");
|
||||
return;
|
||||
}
|
||||
|
||||
var gg = new GameObject("煤堆分类");
|
||||
gg.transform.position = transform.position;
|
||||
gg.transform.parent = transform.parent;
|
||||
gg.transform.localScale = Vector3.one;
|
||||
|
||||
int index = 0;
|
||||
int count = 0;
|
||||
Vector3 CalculatePos = Vector3.zero;
|
||||
GameObject go = null;
|
||||
|
||||
Dictionary<GameObject, List<GameObject>> dic = new Dictionary<GameObject, List<GameObject>>();
|
||||
for (int i = 0; i < transform.childCount; i++)
|
||||
{
|
||||
if (index < GroupLengtn)
|
||||
{
|
||||
if (go == null)
|
||||
{
|
||||
go = new GameObject(GroupName + "_" + count);
|
||||
go.transform.parent = gg.transform;
|
||||
dic.Add(go, new List<GameObject>());
|
||||
}
|
||||
index++;
|
||||
CalculatePos += transform.GetChild(i).GetComponent<Renderer>().bounds.center;
|
||||
dic[go].Add(transform.GetChild(i).gameObject);
|
||||
//最后一组
|
||||
if (i == transform.childCount - 1)
|
||||
{
|
||||
go.transform.position = CalculatePos / GroupLengtn;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
go.transform.position = CalculatePos / GroupLengtn;
|
||||
|
||||
CalculatePos = Vector3.zero;
|
||||
index = 0;
|
||||
go = null;
|
||||
i--;
|
||||
count++;
|
||||
|
||||
//新开一组
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in dic)
|
||||
{
|
||||
for (int i = 0; i < item.Value.Count; i++)
|
||||
{
|
||||
item.Value[i].transform.parent = item.Key.transform;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7a204645429180c49b04724c7bb62f0d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,61 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &-8728986613423957304
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 11
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
version: 5
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Shader Graphs_ShaderGraph_OutLine
|
||||
m_Shader: {fileID: -6465566751694194690, guid: ac77f135d70cb3349b34c80bb2f09b86,
|
||||
type: 3}
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 2
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: 81240d89f735df44e88dd1aebf98791a, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_LightmapsInd:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_ShadowMasks:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _EnableOutLine: 0
|
||||
- _FresnelPower: 2
|
||||
- _QueueControl: 0
|
||||
- _QueueOffset: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 0, g: 4, b: 0.4705882, a: 1}
|
||||
m_BuildTextureStacks: []
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c5b3c5f9f1ed4dd4ea4c8109113c6ddc
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ac77f135d70cb3349b34c80bb2f09b86
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 87a3cc1c046d5504a95048a6906dcb0e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -5,8 +5,11 @@ PluginImporter:
|
|||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fdb838d2b33194ff99b99b8e723fba28
|
||||
timeCreated: 1459789990
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue