Enemy1行动路径优化
This commit is contained in:
@@ -15,21 +15,21 @@ using Random = UnityEngine.Random;
|
||||
/// </summary>
|
||||
public enum GamePlace
|
||||
{
|
||||
Test=-1,
|
||||
Company1Floor=0,
|
||||
LiaoningAnShan=1,
|
||||
HangZhouLongHuTianJie=2,
|
||||
Nanjing_Yuhua_Wanxiang=3,
|
||||
Nanjing_Xianlin_WanDaMao=4,
|
||||
Yangzhou_Hanjiang_Tansuozhongxin=5,
|
||||
Yangzhou_Hanjiang_TansuoZhongxin_wai=-5,
|
||||
Zhejiang_Jinhua_KeJiGuan=6,
|
||||
Guangzhou_Panyv_Zhanting=7,
|
||||
Anhui_Wuhu_Guanwei=8,
|
||||
Shandong_Jining_Shangchang = 9 ,
|
||||
Shandong_Jining_Shangchang_nei=-9,
|
||||
ShanDong_Langfang_QingzhouTaihuacheng =10,
|
||||
Hubei_Xiangyang_Kejiguan=11,
|
||||
Test = -1,
|
||||
Company1Floor = 0,
|
||||
LiaoningAnShan = 1,
|
||||
HangZhouLongHuTianJie = 2,
|
||||
Nanjing_Yuhua_Wanxiang = 3,
|
||||
Nanjing_Xianlin_WanDaMao = 4,
|
||||
Yangzhou_Hanjiang_Tansuozhongxin = 5,
|
||||
Yangzhou_Hanjiang_TansuoZhongxin_wai = -5,
|
||||
Zhejiang_Jinhua_KeJiGuan = 6,
|
||||
Guangzhou_Panyv_Zhanting = 7,
|
||||
Anhui_Wuhu_Guanwei = 8,
|
||||
Shandong_Jining_Shangchang = 9,
|
||||
Shandong_Jining_Shangchang_nei = -9,
|
||||
ShanDong_Langfang_QingzhouTaihuacheng = 10,
|
||||
Hubei_Xiangyang_Kejiguan = 11,
|
||||
}
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
@@ -41,35 +41,35 @@ public class GameManager : MonoBehaviour
|
||||
public bool isTimeEnd = true;
|
||||
// json数据库
|
||||
private JsonLiteDB DB;
|
||||
|
||||
|
||||
// Enemy子弹数据
|
||||
public Dictionary<int, BulletData> EnemyBulletDataDic = new Dictionary<int, BulletData>();
|
||||
|
||||
|
||||
// Player子弹数据
|
||||
public Dictionary<int, BulletData> PlayerBulletDataDic = new Dictionary<int, BulletData>();
|
||||
|
||||
|
||||
public Dictionary<int, PropData> PropDataDic = new Dictionary<int, PropData>();
|
||||
|
||||
public Dictionary<int,BossPosData> BossPosDataDic = new Dictionary<int, BossPosData>();
|
||||
|
||||
|
||||
public List<Enemy> curEnemyList=new List<Enemy>();
|
||||
|
||||
public Dictionary<int, BossPosData> BossPosDataDic = new Dictionary<int, BossPosData>();
|
||||
|
||||
|
||||
public List<Enemy> curEnemyList = new List<Enemy>();
|
||||
public Dictionary<int, EnemyData> EnemyDataDic = new Dictionary<int, EnemyData>();
|
||||
|
||||
|
||||
[Header("道具")]
|
||||
public GameObject EnergyPumpPre;
|
||||
public GameObject gameStartPointPre;
|
||||
public GameObject enemyDoorPre;
|
||||
|
||||
[Header("敌人")]
|
||||
[Header("敌人")]
|
||||
public GameObject[] enemyPre;
|
||||
|
||||
public GameObject callEffectPre;//召唤特效
|
||||
|
||||
[Header("玩家")]
|
||||
[Header("玩家")]
|
||||
public GameObject playerPre;
|
||||
public GameObject player;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 血包
|
||||
/// </summary>
|
||||
@@ -88,7 +88,7 @@ public class GameManager : MonoBehaviour
|
||||
public bool GameStart = false;
|
||||
|
||||
public bool isGameEnd = false;
|
||||
|
||||
|
||||
public int EnergyPumpTag = 0;
|
||||
|
||||
public float EnergyPumpFillAmount = 0;
|
||||
@@ -97,13 +97,13 @@ public class GameManager : MonoBehaviour
|
||||
|
||||
public float buffAtk = 0f;
|
||||
public float buffDef = 0f;
|
||||
|
||||
public LoginInfo loginInfo=new LoginInfo();
|
||||
|
||||
|
||||
public LoginInfo loginInfo = new LoginInfo();
|
||||
|
||||
public Enemy curBoss;
|
||||
|
||||
public int curLevel = 0;
|
||||
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Ins = this;
|
||||
@@ -147,14 +147,14 @@ public class GameManager : MonoBehaviour
|
||||
request.AddHeader("Content-Type", "application/json");
|
||||
request.Send();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 更新配置表
|
||||
/// </summary>
|
||||
public void InitData()
|
||||
{
|
||||
string text = "";
|
||||
string text0 = Resources.Load<TextAsset>(string.Format("zh/{0}Data",GameInit.Ins.gamePlace)).text;
|
||||
string text0 = Resources.Load<TextAsset>(string.Format("zh/{0}Data", GameInit.Ins.gamePlace)).text;
|
||||
GetReaderJson(text0);
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ public class GameManager : MonoBehaviour
|
||||
DateTime dateTime = DateTimeOffset.FromUnixTimeSeconds(timestamp).DateTime;
|
||||
return dateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
|
||||
|
||||
public void GetReaderJson(string text)
|
||||
{
|
||||
DB = new JsonLiteDB();
|
||||
@@ -178,23 +178,23 @@ public class GameManager : MonoBehaviour
|
||||
EnemyData info = new EnemyData(infoReader);
|
||||
EnemyDataDic.Add(info.Id, info);
|
||||
}
|
||||
|
||||
|
||||
// 敌人子弹数据
|
||||
TableReader EnemyBulletReader = DB["EnemyBulletData"].GetReader();
|
||||
EnemyBulletDataDic.Clear();
|
||||
while (EnemyBulletReader.Read())
|
||||
{
|
||||
BulletData data = new BulletData(EnemyBulletReader);
|
||||
EnemyBulletDataDic.Add(data.ID,data);
|
||||
EnemyBulletDataDic.Add(data.ID, data);
|
||||
}
|
||||
|
||||
|
||||
// 玩家子弹数据
|
||||
TableReader PlayerBulletReader = DB["PlayerBulletData"].GetReader();
|
||||
PlayerBulletDataDic.Clear();
|
||||
while (PlayerBulletReader.Read())
|
||||
{
|
||||
BulletData data = new BulletData(PlayerBulletReader);
|
||||
PlayerBulletDataDic.Add(data.ID,data);
|
||||
PlayerBulletDataDic.Add(data.ID, data);
|
||||
}
|
||||
|
||||
// 道具表
|
||||
@@ -203,26 +203,26 @@ public class GameManager : MonoBehaviour
|
||||
while (PropReader.Read())
|
||||
{
|
||||
PropData data = new PropData(PropReader);
|
||||
PropDataDic.Add(data.PropId,data);
|
||||
PropDataDic.Add(data.PropId, data);
|
||||
}
|
||||
|
||||
|
||||
// Boss位置
|
||||
TableReader BossPosReader = DB["BossPosData"].GetReader();
|
||||
BossPosDataDic.Clear();
|
||||
while (BossPosReader.Read())
|
||||
{
|
||||
BossPosData data = new BossPosData(BossPosReader);
|
||||
BossPosDataDic.Add(data.ID,data);
|
||||
BossPosDataDic.Add(data.ID, data);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get sn
|
||||
/// </summary>
|
||||
public string GetPicoSn()
|
||||
public string GetPicoSn()
|
||||
{
|
||||
string res = "UnityEditor";
|
||||
|
||||
|
||||
#if !UNITY_EDITOR && UNITY_ANDROID && PICO
|
||||
res = PXR_Enterprise.StateGetDeviceInfo(SystemInfoEnum.EQUIPMENT_SN);
|
||||
#endif
|
||||
@@ -257,9 +257,9 @@ public class GameManager : MonoBehaviour
|
||||
CurEnemyDie();
|
||||
GameEndPanel.Show(isWin);
|
||||
}
|
||||
public GameObject CreateEnemy(int id,Vector3 pos,Vector3 eulerAngles,bool isBoss)
|
||||
public GameObject CreateEnemy(int id, Vector3 pos, Vector3 eulerAngles, bool isBoss)
|
||||
{
|
||||
GameObject go=Instantiate(enemyPre[id],pos,Quaternion.identity);
|
||||
GameObject go = Instantiate(enemyPre[id], pos, Quaternion.identity);
|
||||
go.transform.localEulerAngles = eulerAngles;
|
||||
Enemy enemy = go.GetComponent<Enemy>();
|
||||
enemy.Init();
|
||||
@@ -269,58 +269,58 @@ public class GameManager : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
curEnemyList.Add(enemy);
|
||||
}
|
||||
curEnemyList.Add(enemy);
|
||||
}
|
||||
return go;
|
||||
}
|
||||
|
||||
public GameObject CreateCallEnemyEffect(Vector3 pos)
|
||||
{
|
||||
GameObject go=Instantiate(callEffectPre,pos,quaternion.identity);
|
||||
GameObject go = Instantiate(callEffectPre, pos, quaternion.identity);
|
||||
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
|
||||
{
|
||||
Destroy(go);
|
||||
},3f);
|
||||
}, 3f);
|
||||
return go;
|
||||
}
|
||||
|
||||
|
||||
void Destroy()
|
||||
{
|
||||
|
||||
|
||||
#if !UNITY_EDITOR
|
||||
PXR_Enterprise.UnBindEnterpriseService();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
public void CreateEnergyPump(Vector3 pos)
|
||||
{
|
||||
isGamePlay = false;
|
||||
GameObject EnergyPump = Instantiate(EnergyPumpPre);
|
||||
//EnergyPump.transform.position = pos;
|
||||
EnergyPump.transform.position = new Vector3(2,0,2);
|
||||
EnergyPump.transform.position = new Vector3(2, 0, 2);
|
||||
if (GameInit.Ins.gamePlace == GamePlace.Nanjing_Xianlin_WanDaMao)
|
||||
{
|
||||
EnergyPump.transform.position = new Vector3(-1.2f,0,1.5f);
|
||||
EnergyPump.transform.position = new Vector3(-1.2f, 0, 1.5f);
|
||||
}
|
||||
if (GameInit.Ins.gamePlace == GamePlace.Nanjing_Yuhua_Wanxiang)
|
||||
{
|
||||
EnergyPump.transform.position = new Vector3(-3,0,2);
|
||||
EnergyPump.transform.position = new Vector3(-3, 0, 2);
|
||||
}
|
||||
if (GameInit.Ins.gamePlace == GamePlace.Yangzhou_Hanjiang_Tansuozhongxin)
|
||||
{
|
||||
EnergyPump.transform.position = new Vector3(-1.2f,0,0f);
|
||||
EnergyPump.transform.position = new Vector3(-1.2f, 0, 0f);
|
||||
}
|
||||
if (GameInit.Ins.gamePlace == GamePlace.Yangzhou_Hanjiang_TansuoZhongxin_wai)
|
||||
{
|
||||
EnergyPump.transform.position = new Vector3(0,0,2f);
|
||||
EnergyPump.transform.position = new Vector3(0, 0, 2f);
|
||||
}
|
||||
if (GameInit.Ins.gamePlace == GamePlace.Zhejiang_Jinhua_KeJiGuan)
|
||||
{
|
||||
EnergyPump.transform.position = new Vector3(0,0,2f);
|
||||
EnergyPump.transform.position = new Vector3(0, 0, 2f);
|
||||
}
|
||||
if (GameInit.Ins.gamePlace == GamePlace.Guangzhou_Panyv_Zhanting)
|
||||
{
|
||||
EnergyPump.transform.position = new Vector3(0,0,2f);
|
||||
EnergyPump.transform.position = new Vector3(0, 0, 2f);
|
||||
}
|
||||
if (GameInit.Ins.gamePlace == GamePlace.ShanDong_Langfang_QingzhouTaihuacheng)
|
||||
{
|
||||
@@ -348,16 +348,16 @@ public class GameManager : MonoBehaviour
|
||||
{
|
||||
point.transform.position = Vector3.zero;
|
||||
}
|
||||
|
||||
|
||||
CoroutineTaskManager.Instance.WaitSecondTodo(() =>
|
||||
{
|
||||
if(isGamePlay)
|
||||
if (isGamePlay)
|
||||
return;
|
||||
Destroy(point.gameObject);
|
||||
GamePlay();
|
||||
}, 5f);
|
||||
}
|
||||
public GameObject CreateEnemyDoor(Vector3 pos, Vector3 angle,Vector3 scale)
|
||||
public GameObject CreateEnemyDoor(Vector3 pos, Vector3 angle, Vector3 scale)
|
||||
{
|
||||
GameObject crack = Instantiate(enemyDoorPre);
|
||||
crack.transform.position = new Vector3(pos.x, pos.y, pos.z);
|
||||
@@ -375,7 +375,7 @@ public class GameManager : MonoBehaviour
|
||||
GameObject atkBuff = Instantiate(AtkBuffPre);
|
||||
atkBuff.transform.position = new Vector3(pos.x, 0, pos.z);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建防御BUFF
|
||||
/// </summary>
|
||||
@@ -402,28 +402,28 @@ public class GameManager : MonoBehaviour
|
||||
{
|
||||
GameObject prop = Instantiate(weaponItemPre);
|
||||
prop.GetComponent<WeaponProp>().Init(type);
|
||||
prop.transform.position = new Vector3(pos.x,1f,pos.z);
|
||||
prop.transform.position = new Vector3(pos.x, 1f, pos.z);
|
||||
}
|
||||
|
||||
|
||||
public bool isFirstGetWeapon;
|
||||
public void EnemyDisGetWeapon(Vector3 pos)
|
||||
{
|
||||
|
||||
|
||||
bool isGet = Random.Range(0, 100) > 70;
|
||||
if (!isGet) return;
|
||||
|
||||
|
||||
int index = Random.Range(0, 100);
|
||||
int id = 2;
|
||||
if (index <= 10)
|
||||
id = Random.Range(8, 10);
|
||||
if(index is > 10 and <= 50)
|
||||
id= Random.Range(5, 8);
|
||||
if(index is > 50)
|
||||
id= Random.Range(2, 5);
|
||||
if (index is > 10 and <= 50)
|
||||
id = Random.Range(5, 8);
|
||||
if (index is > 50)
|
||||
id = Random.Range(2, 5);
|
||||
CreatePlayerWeapon((PlayerWeaponType)id, pos);
|
||||
if (!isFirstGetWeapon)
|
||||
{
|
||||
GameInit.Ins.PlayAudio("1.5",GameInit.Ins.self.transform,true);
|
||||
GameInit.Ins.PlayAudio("1.5", GameInit.Ins.self.transform, true);
|
||||
isFirstGetWeapon = true;
|
||||
}
|
||||
}
|
||||
@@ -432,7 +432,7 @@ public class GameManager : MonoBehaviour
|
||||
{
|
||||
foreach (var enemy in curEnemyList)
|
||||
{
|
||||
if(enemy!=null)
|
||||
if (enemy != null)
|
||||
enemy.Dead();
|
||||
}
|
||||
curEnemyList.Clear();
|
||||
@@ -443,7 +443,7 @@ public class GameManager : MonoBehaviour
|
||||
int count = 0;
|
||||
foreach (var enemy in curEnemyList)
|
||||
{
|
||||
if(enemy!=null)
|
||||
if (enemy != null)
|
||||
count++;
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ public class GameManager : MonoBehaviour
|
||||
|
||||
public void CreatePlayer()
|
||||
{
|
||||
player=Instantiate(playerPre);
|
||||
player = Instantiate(playerPre);
|
||||
}
|
||||
|
||||
public bool IsAllBossPetDie()
|
||||
@@ -477,57 +477,57 @@ public class GameManager : MonoBehaviour
|
||||
{
|
||||
BossPosData data = BossPosDataDic[curLevel];
|
||||
GameObject door = null;
|
||||
if(curLevel!=0)
|
||||
door=CreateEnemyDoor(data.DoorPos, data.DoorAng,Vector3.one*data.DoorScale);
|
||||
if (curLevel != 0)
|
||||
door = CreateEnemyDoor(data.DoorPos, data.DoorAng, Vector3.one * data.DoorScale);
|
||||
switch (curLevel)
|
||||
{
|
||||
case 0:
|
||||
CreateEnemy(0, data.BossPos, Vector3.zero,true);
|
||||
CreateEnemy(0, data.BossPos, Vector3.zero, true);
|
||||
break;
|
||||
case 1:
|
||||
//舰载机
|
||||
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
|
||||
{
|
||||
door.GetComponent<EnemyDoor>().desTime = 6;
|
||||
door.GetComponent<EnemyDoor>().InitData();
|
||||
},1f);
|
||||
door.GetComponent<EnemyDoor>().desTime = 6;
|
||||
door.GetComponent<EnemyDoor>().InitData();
|
||||
}, 1f);
|
||||
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
|
||||
{
|
||||
CreateEnemy(2, data.BossPos,data.BossAng,true);
|
||||
},3f);
|
||||
CreateEnemy(2, data.BossPos, data.BossAng, true);
|
||||
}, 3f);
|
||||
break;
|
||||
case 2:
|
||||
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
|
||||
{
|
||||
door.GetComponent<EnemyDoor>().desTime = 10;
|
||||
door.GetComponent<EnemyDoor>().InitData();
|
||||
},1f);
|
||||
}, 1f);
|
||||
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
|
||||
{
|
||||
CreateEnemy(3, data.BossPos,data.BossAng,true);
|
||||
},3f);
|
||||
CreateEnemy(3, data.BossPos, data.BossAng, true);
|
||||
}, 3f);
|
||||
break;
|
||||
case 3:
|
||||
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
|
||||
{
|
||||
door.GetComponent<EnemyDoor>().desTime = 10;
|
||||
door.GetComponent<EnemyDoor>().InitData();
|
||||
},1f);
|
||||
}, 1f);
|
||||
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
|
||||
{
|
||||
CreateEnemy(5, data.BossPos,data.BossAng,true);
|
||||
},3f);
|
||||
CreateEnemy(5, data.BossPos, data.BossAng, true);
|
||||
}, 3f);
|
||||
break;
|
||||
case 4:
|
||||
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
|
||||
{
|
||||
door.GetComponent<EnemyDoor>().desTime = 6;
|
||||
door.GetComponent<EnemyDoor>().InitData();
|
||||
},1f);
|
||||
}, 1f);
|
||||
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
|
||||
{
|
||||
CreateEnemy(7, data.BossPos,data.BossAng,true);
|
||||
},1f);
|
||||
CreateEnemy(7, data.BossPos, data.BossAng, true);
|
||||
}, 1f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -536,7 +536,7 @@ public class GameManager : MonoBehaviour
|
||||
{
|
||||
isGameEnd = true;
|
||||
ShowEndGameUI(true);
|
||||
GameInit.Ins.PlayAudio("1.17",GameInit.Ins.self.transform,true);
|
||||
GameInit.Ins.PlayAudio("1.17", GameInit.Ins.self.transform, true);
|
||||
AudioManager.Ins?.SoundPlay("bgm4", true);
|
||||
}
|
||||
|
||||
@@ -554,4 +554,4 @@ public class GameManager : MonoBehaviour
|
||||
CurEnemyDie();
|
||||
AudioManager.Ins?.SoundPlay("bgm4", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user