fix:优化游戏流程,添加多个打击目标,添加芜湖场景

This commit is contained in:
bzx
2025-07-03 18:38:53 +08:00
parent 29812717e4
commit eebb454751
23 changed files with 20513 additions and 20299 deletions

View File

@@ -30,6 +30,7 @@ public class Boss : Enemy
base.Init();
bigXl.SetActive(false);
mzObj.SetActive(false);
_isShow = true;
damagableObj.SetActive(false);
player = GameManager.Ins.player;
foreach (var item in components)
@@ -250,18 +251,16 @@ public class Boss : Enemy
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2f);
}
if (enemyState == EnemyState.TwoState || enemyState == EnemyState.ThreeState)
curEnemyTime-=Time.deltaTime;
if (curEnemyTime <=0 )
{
curEnemyTime+=Time.deltaTime;
if (curEnemyTime >= enemyTime)
{
if(GameManager.Ins.GetCurEnemyListCount()<=8)
ShowEnemy();
curEnemyTime = 0;
}
curEnemyTime = enemyTime;
}
}
private float enemyTime=60f;
private float enemyTime=45f;
private float curEnemyTime;
public void ShowEnemy()
{
@@ -278,7 +277,7 @@ public class Boss : Enemy
{
int index = Random.Range(0, 3);
Vector3 curEnemyPos = new Vector3(enemyPos[i].position.x, 0, enemyPos[i].position.z);
var go = GameManager.Ins.CreateEnemy(enemyList[index], curEnemyPos, Vector3.zero, false);
GameManager.Ins.CreateEnemy(enemyList[index], curEnemyPos, Vector3.zero, false);
}
}, 2f);
}

View File

@@ -87,7 +87,11 @@ public class DropShip : Enemy
public override void TwoAttackMode()
{
base.TwoAttackMode();
Debug.LogError("召唤卫兵");
ShowEnemy();
}
public void ShowEnemy()
{
for (int i = 0; i < enemyPos.Length; i++)
{
Vector3 curEnemyPos=new Vector3(enemyPos[i].position.x,0,enemyPos[i].position.z);
@@ -98,7 +102,7 @@ public class DropShip : Enemy
for (int i = 0; i < enemyPos.Length; i++)
{
Vector3 curEnemyPos=new Vector3(enemyPos[i].position.x,0,enemyPos[i].position.z);
var go=GameManager.Ins.CreateEnemy(1,curEnemyPos,Vector3.zero,false);
GameManager.Ins.CreateEnemy(1,curEnemyPos,Vector3.zero,false);
}
},2f);
}
@@ -168,6 +172,8 @@ public class DropShip : Enemy
endValue = -7f;
if(GameInit.Ins.gamePlace== GamePlace.Anhui_Wuhu_Guanwei)
endValue = 13f;
if(GameInit.Ins.gamePlace== GamePlace.Zhejiang_Jinhua_KeJiGuan)
endValue = 17f;
if (GameInit.Ins.gamePlace == GamePlace.HangZhouLongHuTianJie||GameInit.Ins.gamePlace== GamePlace.Guangzhou_Panyv_Zhanting)
{
transform.DOMoveX(endValue, 4).OnComplete(() =>
@@ -228,7 +234,7 @@ public class DropShip : Enemy
isAttack = true;
});
}
else if(GameInit.Ins.gamePlace == GamePlace.Anhui_Wuhu_Guanwei)
else if(GameInit.Ins.gamePlace == GamePlace.Anhui_Wuhu_Guanwei|| GameInit.Ins.gamePlace == GamePlace.Zhejiang_Jinhua_KeJiGuan)
{
transform.DOMove(transform.position + new Vector3(0, -2, 0), 3).OnComplete(() =>
{
@@ -308,7 +314,9 @@ public class DropShip : Enemy
base.ChangeHp(value, info, _sender);
damagableObj.SetActive(health/maxHealth<=0.5f);
}
private float enemyTime=45f;
private float curEnemyTime;
public override void Update()
{
base.Update();
@@ -321,7 +329,16 @@ public class DropShip : Enemy
{
Quaternion targetRotation = Quaternion.LookRotation(targetDir);
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2f);
}
//GameInit.Ins.PlayAudio("1.11",GameInit.Ins.self.transform,true);
}
curEnemyTime-=Time.deltaTime;
if (curEnemyTime <= 0)
{
if (GameManager.Ins.GetCurEnemyListCount() <= 8)
{
ShowEnemy();
}
curEnemyTime = enemyTime;
}
}
}

View File

@@ -9,7 +9,7 @@ public class EnemyTa : Enemy,IDamagable
public Transform[] enemyPos;
public Transform bossPos;
public Transform bossDoorPos;
public override void Init()
{
base.Init();
@@ -25,6 +25,7 @@ public class EnemyTa : Enemy,IDamagable
{
isShield = false;
},6f);
isDie = false;
}
public override void ChangeHp(float value, object info, Transform _sender)
@@ -32,9 +33,20 @@ public class EnemyTa : Enemy,IDamagable
base.ChangeHp(value, info, _sender);
}
public bool isDie;
public override void Update()
{
base.Update();
if (GameManager.Ins.GetCurEnemyListCount() <= 0&& !isDie)
{
Dead();
}
}
public override void Dead()
{
base.Dead();
isDie = true;
GameManager.Ins.CurLevelWin();
GameInit.Ins.PlayAudio("1.7",GameInit.Ins.self.transform,true);
}

View File

@@ -137,6 +137,11 @@ public class Leviathan : Enemy
public override void TwoAttackMode()
{
base.TwoAttackMode();
ShowEnemy();
}
public void ShowEnemy()
{
for (int i = 0; i < enemyPos.Length; i++)
{
Vector3 curEnemyPos=new Vector3(enemyPos[i].position.x,0,enemyPos[i].position.z);
@@ -147,7 +152,7 @@ public class Leviathan : Enemy
for (int i = 0; i < enemyPos.Length; i++)
{
Vector3 curEnemyPos=new Vector3(enemyPos[i].position.x,0,enemyPos[i].position.z);
var go=GameManager.Ins.CreateEnemy(4,curEnemyPos,Vector3.zero,false);
GameManager.Ins.CreateEnemy(4,curEnemyPos,Vector3.zero,false);
}
},2f);
}
@@ -286,6 +291,8 @@ public class Leviathan : Enemy
}
private bool _isShow;
private float enemyTime=45f;
private float curEnemyTime;
public override void Update()
{
base.Update();
@@ -301,6 +308,14 @@ public class Leviathan : Enemy
Quaternion targetRotation = Quaternion.LookRotation(targetDir);
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2f);
}
curEnemyTime-=Time.deltaTime;
if (curEnemyTime <= 0)
{
if(GameManager.Ins.GetCurEnemyListCount()<=8)
ShowEnemy();
curEnemyTime = enemyTime;
}
}
}

View File

@@ -241,6 +241,11 @@ public class MachineDragon : Enemy
public override void TwoAttackMode()
{
base.TwoAttackMode();
ShowEnemy();
}
public void ShowEnemy()
{
for (int i = 0; i < enemyPos.Length; i++)
{
Vector3 curEnemyPos = new Vector3(enemyPos[i].position.x, 0, enemyPos[i].position.z);
@@ -251,7 +256,7 @@ public class MachineDragon : Enemy
for (int i = 0; i < enemyPos.Length; i++)
{
Vector3 curEnemyPos = new Vector3(enemyPos[i].position.x, 0, enemyPos[i].position.z);
var go = GameManager.Ins.CreateEnemy(6, curEnemyPos, Vector3.zero, false);
GameManager.Ins.CreateEnemy(6, curEnemyPos, Vector3.zero, false);
}
}, 2f);
}
@@ -288,6 +293,8 @@ public class MachineDragon : Enemy
attackMode = 0;
}
private float enemyTime=45f;
private float curEnemyTime;
public override void Update()
{
base.Update();
@@ -306,6 +313,14 @@ public class MachineDragon : Enemy
Quaternion targetRotation = Quaternion.LookRotation(targetDir);
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2f);
}
curEnemyTime-=Time.deltaTime;
if (curEnemyTime <= 0)
{
if(GameManager.Ins.GetCurEnemyListCount()<=8)
ShowEnemy();
curEnemyTime = enemyTime;
}
}
public override void Dead()

View File

@@ -33,8 +33,6 @@ public class GameInit : MonoBehaviour
[NonSerialized]
public Player self;
public Transform[] movePoses;
private void Awake()
{

View File

@@ -428,6 +428,18 @@ public class GameManager : MonoBehaviour
curEnemyList.Clear();
}
public int GetCurEnemyListCount()
{
int count = 0;
foreach (var enemy in curEnemyList)
{
if(enemy!=null)
count++;
}
return count;
}
public void CreatePlayer()
{
player=Instantiate(playerPre);

19
Assets/Scripts/SelfDes.cs Normal file
View File

@@ -0,0 +1,19 @@
using System;
using System.Collections;
using System.Collections.Generic;
using DragonLi.Core;
using UnityEngine;
public class SelfDes : MonoBehaviour
{
public float desTime;
private void Start()
{
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
{
if(gameObject)
Destroy(gameObject);
},desTime);
}
}

View File

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

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using DragonLi.Core;
using JetBrains.Annotations;
using UnityEngine;
using UnityEngine.PlayerLoop;
@@ -18,12 +19,20 @@ public class WeaponProp : MonoBehaviour
public AudioSource audioSource;
private bool _isDes;
public void Init(PlayerWeaponType type)
{
weaponType = type;
_isDes = false;
amount=GameManager.Ins.PlayerBulletDataDic[(int)type].Number;
ShowWeapon(type);
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
{
if(!_isDes)
Destroy(gameObject);
},60);
}
public void ShowWeapon(PlayerWeaponType type)
@@ -43,6 +52,7 @@ public class WeaponProp : MonoBehaviour
public void Collider()
{
_isDes = true;
box.enabled = false;
audioSource.Play();
transform.gameObject.SetActive(false);