monsterSpawn实现一部分

This commit is contained in:
sin365 2023-01-13 18:29:48 +08:00
parent 53952b2e99
commit 1c85a1383c
14 changed files with 264 additions and 1 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 556dae285be068c45bfa3a7a455d47cd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3e7a5463a745c5c41ab56d149de61443
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a27bf6b0744bdd14097dfbcf54140eda
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
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: f0eceb9759f416443ae2939b267ca38e, type: 3}
m_Name: 1
m_EditorClassIdentifier:
MapID: 1
StepList:
- StepID: 1
SpawnPoints:
- SpawnPointID: 1
MonsterCfgID: 1
Pos: {x: 0, y: 0, z: 0}
MonsterCount: 5

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b5c84ae9cee049942850f5a0918294ba
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7870abac182c82c44a0061b8be5e8b5f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,20 @@
using UnityEditor;
using UnityEngine;
public class MapSpawnMenu : EditorWindow
{
[MenuItem("地图/刷怪点编辑")]
private static void ShowWindow()
{
//第一种
EditorWindow window = CreateWindow<MapSpawnTool>();
window.Show();
window.Focus();
//GameObject go = new GameObject();
//go.name = "SpawnTools";
//go.transform.position = Vector3.zero;
//go.AddComponent<MapSpawnTool>();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: db6c3ef94c1f7964b991c74b08395648
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,102 @@
using UnityEditor;
using UnityEngine;
public class MapSpawnTool : EditorWindow
{
MapMonsterCfg mapMonsterCfg;
bool bInit = false;
private void OnGUI()
{
if (GUILayout.Button("新建"))
{
//按下按钮后执行的方法
mapMonsterCfg = new MapMonsterCfg();
bInit = true;
}
if (GUILayout.Button("载入"))
{
//按下按钮后执行的方法
}
if (!bInit)
return;
mapMonsterCfg.MapID = EditorGUILayout.IntField("地图ID", mapMonsterCfg.MapID);
if (GUILayout.Button("保存到文件"))
{
AssetDatabase.CreateAsset(mapMonsterCfg, $"Assets/GameAssets/ScriptableObjectCfg/SpawnPoint/{mapMonsterCfg.MapID}.asset");
}
EditorGUILayout.LabelField("本地图Step数量:"+ mapMonsterCfg.StepList.Count);
if (GUILayout.Button($" 新增Step"))
{ mapMonsterCfg.StepList.Add(new MapMonsterCfg_Step()); return; }
(Color, Color) bcStep = (GUI.backgroundColor, GUI.color);
GUI.backgroundColor = Color.blue;
GUI.color = Color.blue;
foreach (var step in mapMonsterCfg.StepList)
{
EditorGUILayout.LabelField($"-- Step {step.StepID} Start --");
step.StepID = EditorGUILayout.IntField("----StepID", step.StepID);
EditorGUILayout.LabelField($"---- Step {step.StepID} 数量:" + step.SpawnPoints.Count);
//GUI.color = Color.white;
if (GUILayout.Button($"删除Step:{step.StepID}"))
{ mapMonsterCfg.StepList.Remove(step); return; }
(Color, Color) bcPoint = (GUI.backgroundColor, GUI.color);
GUI.backgroundColor = Color.green;
GUI.color = Color.green;
if (GUILayout.Button($"在Step{step.StepID} 中创建一个刷怪点"))
{ step.SpawnPoints.Add(new MapMonsterCfg_Spawn()); }
foreach (var point in step.SpawnPoints)
{
EditorGUILayout.LabelField($"Point {point.SpawnPointID} Start");
//GUI.color = Color.green;
if (GUILayout.Button($"删除Point:{point.SpawnPointID}"))
{ step.SpawnPoints.Remove(point); return; }
point.SpawnPointID = EditorGUILayout.IntField($"Point {point.SpawnPointID}->SpawnPointID:", point.SpawnPointID);
point.MonsterCfgID = EditorGUILayout.IntField($"Point {point.SpawnPointID}->MonsterCfgID:", point.MonsterCfgID);
point.MonsterCount = EditorGUILayout.IntField($"Point {point.SpawnPointID}->MonsterCount:", point.MonsterCount);
point.Pos = EditorGUILayout.Vector3Field("Point {point.SpawnPointID}:->Pos", point.Pos);
EditorGUILayout.LabelField($"Point {point.SpawnPointID} End");
}
GUI.backgroundColor = bcPoint.Item1;
GUI.color = bcPoint.Item2;
//GUI.color = Color.white;
EditorGUILayout.LabelField("-- Step 1 End--");
}
GUI.backgroundColor = bcStep.Item1;
GUI.color = bcStep.Item2;
#region
foreach (var step in mapMonsterCfg.StepList)
{
foreach (var point in step.SpawnPoints)
{
Gizmos.DrawCube(point.Pos, new Vector3(1, 1, 1));
}
}
#endregion
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4d0afedb12e418744bafbb659ad0ebdc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 69da13409014cbd40b578a4d3bdff3a4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,38 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "BulletData", menuName = "ScriptableObject/×Óµ¯Êý¾Ý", order = 0)]
public class MapMonsterCfg : ScriptableObject
{
public int MapID;
public List<MapMonsterCfg_Step> StepList;
public MapMonsterCfg()
{
StepList = new List<MapMonsterCfg_Step>();
}
}
[Serializable]
public class MapMonsterCfg_Step
{
public int StepID;
public List<MapMonsterCfg_Spawn> SpawnPoints;
public MapMonsterCfg_Step()
{
SpawnPoints = new List<MapMonsterCfg_Spawn>();
}
}
[Serializable]
public class MapMonsterCfg_Spawn
{
public int SpawnPointID;
public int MonsterCfgID;
public Vector3 Pos;
public int MonsterCount;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f0eceb9759f416443ae2939b267ca38e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -154,7 +154,7 @@ namespace Game
{
//如果超过移动时间
if(MoveTime > ConstClass.ToFastModeTime
&& PlayData.skill.hadskillid.Contains(5)//判断是否有加速技能
//&& PlayData.skill.hadskillid.Contains(5)//判断是否有加速技能
)
IsFastSkillMode = true;
else