Browse Source

邻接池bug

pull/75/head
45 1 year ago
parent
commit
6ea71a6ad5
  1. 36
      ColorlessWorld-2024-4-2/Assets/Prefab/MapNodePrefab/MapUnity _2.prefab
  2. 23
      ColorlessWorld-2024-4-2/Assets/Scripts/MapUnity.cs

36
ColorlessWorld-2024-4-2/Assets/Prefab/MapNodePrefab/MapUnity _2.prefab

@ -532,6 +532,7 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 4579690416932963536} - {fileID: 4579690416932963536}
- {fileID: 8168328524498649588}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &257831059648324247 --- !u!114 &257831059648324247
@ -611,6 +612,10 @@ MonoBehaviour:
- {fileID: 5915798895085418112} - {fileID: 5915798895085418112}
- {fileID: 6231958258312834866} - {fileID: 6231958258312834866}
rangeBorder: [] rangeBorder: []
touchLayerMask:
serializedVersion: 2
m_Bits: 64
touchRayStartPoint: {fileID: 8168328524498649588}
--- !u!114 &7941956919028205299 --- !u!114 &7941956919028205299
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2103,6 +2108,37 @@ MeshRenderer:
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0} m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &4669314452435949498
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8168328524498649588}
m_Layer: 0
m_Name: TouchStartPoint
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8168328524498649588
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4669314452435949498}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2384686249825617783}
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!1 &5056190353898925075 --- !u!1 &5056190353898925075
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

23
ColorlessWorld-2024-4-2/Assets/Scripts/MapUnity.cs

@ -2,6 +2,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI; using UnityEngine.UI;
public class MapUnity : MonoBehaviour public class MapUnity : MonoBehaviour
@ -86,6 +87,11 @@ public class MapUnity : MonoBehaviour
[Header("·¶Î§±ß½ç")] [Header("·¶Î§±ß½ç")]
public List<MeshRenderer> rangeBorder = new List<MeshRenderer>(); public List<MeshRenderer> rangeBorder = new List<MeshRenderer>();
[Header ("临接池射线图层")]
public LayerMask touchLayerMask;
[Header("临接池射线起始点")]
public Transform touchRayStartPoint;
public void StartRegiste() public void StartRegiste()
{ {
if (compalte == false) if (compalte == false)
@ -159,6 +165,8 @@ public class MapUnity : MonoBehaviour
{ {
RefreshWhoColor(); RefreshWhoColor();
}*/ }*/
//Debug.DrawRay(touchRayStartPoint .position,touchRayStartPoint .right, Color.green ,2f);
} }
public void switchColor(int newColor) public void switchColor(int newColor)
@ -216,7 +224,16 @@ public class MapUnity : MonoBehaviour
} }
public void ConnectUnit() public void ConnectUnit()
{ {
if (locationX % 2 == 0) for (int i = 0; i < 6; i++)
{
if (Physics.Raycast(touchRayStartPoint.position, touchRayStartPoint.right, out RaycastHit raycastHit, 2f, touchLayerMask.value))
{
unitPool [i] = raycastHit.transform.GetComponent<MapUnity>();
}
touchRayStartPoint.localEulerAngles += new Vector3(0, 60, 0);
}
/* if (locationX % 2 == 0)
{ {
try try
{ {
@ -316,8 +333,8 @@ public class MapUnity : MonoBehaviour
catch (Exception e) catch (Exception e)
{ {
} }*/
}
/* if (locationX % 2 == 0)//żÊý /* if (locationX % 2 == 0)//żÊý
{ {

Loading…
Cancel
Save