尝试改成2D
This commit is contained in:
parent
366bc4276e
commit
145674a9fa
@ -96,7 +96,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 936570104554441001}
|
m_GameObject: {fileID: 936570104554441001}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -2.19, y: 5.16, z: -2.09}
|
m_LocalPosition: {x: -2.19, y: 5.16, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1377482919428722225}
|
m_Father: {fileID: 1377482919428722225}
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
using System.Runtime.CompilerServices;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
namespace Game
|
namespace Game
|
||||||
@ -52,5 +53,21 @@ namespace Game
|
|||||||
{
|
{
|
||||||
return new Vector3(100 * Mathf.Cos(angle * Mathf.PI / 180),100 * Mathf.Sin(angle * Mathf.PI / 180),0).normalized;
|
return new Vector3(100 * Mathf.Cos(angle * Mathf.PI / 180),100 * Mathf.Sin(angle * Mathf.PI / 180),0).normalized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public Vector2Int GetCellXYforV3(Vector3 worldPos)
|
||||||
|
{
|
||||||
|
Vector2Int cell = new Vector2Int();
|
||||||
|
cell.x = (int)(worldPos.x / ConstClass.CellSize);
|
||||||
|
cell.y = (int)(worldPos.y / ConstClass.CellSize);
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public Vector3 GetCellCenterPos(Vector2Int CellXY)
|
||||||
|
{
|
||||||
|
Vector3 pos= new Vector3();
|
||||||
|
pos.x = (CellXY.x * ConstClass.CellSize) + (ConstClass.CellSize * 0.5f);
|
||||||
|
pos.y = (CellXY.y * ConstClass.CellSize) + (ConstClass.CellSize * 0.5f);
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,13 +1,5 @@
|
|||||||
using Axibug.Runtime;
|
using Axibug.Runtime;
|
||||||
using Bright.Serialization;
|
|
||||||
using System.IO;
|
|
||||||
using Game.Config;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using static Axibug.Utility;
|
|
||||||
using UnityEditor;
|
|
||||||
using Axibug.Resources;
|
|
||||||
using Axibug;
|
using Axibug;
|
||||||
using Axibug.Event;
|
using Axibug.Event;
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using Axibug.Resources;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.SymbolStore;
|
using System.Diagnostics.SymbolStore;
|
||||||
using System.Runtime.Remoting.Metadata.W3cXsd2001;
|
using System.Runtime.Remoting.Metadata.W3cXsd2001;
|
||||||
|
using UnityEngine.Rendering;
|
||||||
|
|
||||||
namespace Game
|
namespace Game
|
||||||
{
|
{
|
||||||
@ -12,6 +13,8 @@ namespace Game
|
|||||||
{
|
{
|
||||||
public bool bLoadFinish { get;private set; } = false;
|
public bool bLoadFinish { get;private set; } = false;
|
||||||
|
|
||||||
|
public bool ShowMapObsMesh = false;
|
||||||
|
|
||||||
public int mMapId { get; private set; } = 0;
|
public int mMapId { get; private set; } = 0;
|
||||||
List<GameObject> MapGoList = new List<GameObject>();
|
List<GameObject> MapGoList = new List<GameObject>();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -49,6 +52,7 @@ namespace Game
|
|||||||
for (int j = 0; j < mapMonsterCfg.StepList[i].SpawnPoints.Count; j++)
|
for (int j = 0; j < mapMonsterCfg.StepList[i].SpawnPoints.Count; j++)
|
||||||
{
|
{
|
||||||
MapMonsterCfg_Spawn Point = mapMonsterCfg.StepList[i].SpawnPoints[j];
|
MapMonsterCfg_Spawn Point = mapMonsterCfg.StepList[i].SpawnPoints[j];
|
||||||
|
Point.Pos.z = 0;
|
||||||
GamePlayEntry.RoleMgr.CreateMonster("SlimeGreen", Point.Pos);
|
GamePlayEntry.RoleMgr.CreateMonster("SlimeGreen", Point.Pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,6 +103,33 @@ namespace Game
|
|||||||
}
|
}
|
||||||
return go;
|
return go;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void OnDrawGizmos()
|
||||||
|
{
|
||||||
|
if (!ShowMapObsMesh)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!GamePlayEntry.MainPlayer.InGame)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Vector2Int srcXY = Common.GetCellXYforV3(GamePlayEntry.MainPlayer.Player.transform.position);
|
||||||
|
Vector2Int targetXY = Vector2Int.zero;
|
||||||
|
Vector3 drawCubeSize = Vector3.one * ConstClass.CellSize;
|
||||||
|
drawCubeSize.z = 0f;
|
||||||
|
for (int x = -20; x < 20; x++)
|
||||||
|
{
|
||||||
|
for (int y = -20; y < 20; y++)
|
||||||
|
{
|
||||||
|
targetXY.x = srcXY.x + x;
|
||||||
|
targetXY.y = srcXY.y + y;
|
||||||
|
Gizmos.color = Color.green;
|
||||||
|
Vector3 centerpos = Common.GetCellCenterPos(targetXY);
|
||||||
|
Gizmos.DrawWireCube(centerpos, drawCubeSize);
|
||||||
|
Gizmos.DrawSphere(centerpos, 0.1f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,4 +10,7 @@ public class ConstClass
|
|||||||
public const float ToFastModeTime = 2f;
|
public const float ToFastModeTime = 2f;
|
||||||
public static float FastRunSpeedMultiplier = 3f;
|
public static float FastRunSpeedMultiplier = 3f;
|
||||||
public static float FastModeShadowCreateIntervalTime = 0.25f;
|
public static float FastModeShadowCreateIntervalTime = 0.25f;
|
||||||
|
|
||||||
|
|
||||||
|
public const float CellSize = 1f;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,5 +85,10 @@ namespace Game
|
|||||||
tmp_MP.text = GamePlayEntry.MainPlayer.Player.BaseData.life.curMP + "/" + GamePlayEntry.MainPlayer.Player.BaseData.life.maxMP;
|
tmp_MP.text = GamePlayEntry.MainPlayer.Player.BaseData.life.curMP + "/" + GamePlayEntry.MainPlayer.Player.BaseData.life.maxMP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
tmpName.text = Common.GetCellXYforV3(GamePlayEntry.MainPlayer.Player.transform.position).ToString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user