fix:修复场地bug
This commit is contained in:
@@ -68,6 +68,7 @@ public class GameLocal : MonoBehaviour
|
||||
public Transform[] gunPropPos;
|
||||
|
||||
public Transform doorPos;
|
||||
public GameObject[] wu;
|
||||
void Start()
|
||||
{
|
||||
Ins = this;
|
||||
@@ -153,4 +154,19 @@ public class GameLocal : MonoBehaviour
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
public void CloseWu()
|
||||
{
|
||||
foreach (GameObject obj in wu)
|
||||
{
|
||||
obj.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenWu()
|
||||
{
|
||||
foreach (var obj in wu)
|
||||
{
|
||||
obj.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public class GameManager : NetworkBehaviour
|
||||
public void GivePistol()
|
||||
{
|
||||
Debug.Log("创建武器中...");
|
||||
GameLocal.Ins.self.PickUpGun(GunType.Pistol, -999);
|
||||
GameLocal.Ins.self.PickUpGun(GunType.FireGun, 20);
|
||||
}
|
||||
|
||||
[Server]
|
||||
@@ -308,6 +308,7 @@ public class GameManager : NetworkBehaviour
|
||||
EnemyList.Add(enemyIndex, enemyScript);
|
||||
yield return new WaitForSeconds(info.BornTime);
|
||||
}
|
||||
GameLocal.Ins.CloseWu();
|
||||
}
|
||||
|
||||
public void CreateBoss()
|
||||
@@ -391,7 +392,7 @@ public class GameManager : NetworkBehaviour
|
||||
int totalWeight = 0;
|
||||
|
||||
int targetWeight = Random.Range(24, 27); // 24-26
|
||||
int targetCount = Random.Range(5, 11); // 5-10
|
||||
int targetCount = Random.Range(4, 6); // 4-6
|
||||
|
||||
// 随机添加怪物直到接近目标
|
||||
while (monsterTypes.Count < targetCount && totalWeight < targetWeight)
|
||||
@@ -423,6 +424,7 @@ public class GameManager : NetworkBehaviour
|
||||
totalWeight += weights[minIndex];
|
||||
}
|
||||
|
||||
Debug.LogError("生成的敌人数量:"+targetCount);
|
||||
return monsterTypes.ToArray();
|
||||
}
|
||||
|
||||
@@ -476,6 +478,7 @@ public class GameManager : NetworkBehaviour
|
||||
{
|
||||
CreateGunProp();
|
||||
CreateNextRound();
|
||||
GameLocal.Ins.OpenWu();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
@@ -140,7 +140,6 @@ public class Launcher : NetworkBehaviour
|
||||
bullet_amount--;
|
||||
EventDispatcher.TriggerEvent("UserGun", bullet_amount);
|
||||
}
|
||||
|
||||
if (bullet_amount <= 0 && bullet_amount != -999)
|
||||
{
|
||||
LauncherEmpty();
|
||||
@@ -183,7 +182,7 @@ public class Launcher : NetworkBehaviour
|
||||
{
|
||||
return;
|
||||
}
|
||||
bullet_amount += amount;
|
||||
bullet_amount = amount;
|
||||
}
|
||||
|
||||
public void SetBulletAmount(int amount,int ownerIndex)
|
||||
@@ -238,4 +237,6 @@ public class Launcher : NetworkBehaviour
|
||||
}, shell_despawn_delay);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -141,7 +141,8 @@ public class Gun2 : Launcher
|
||||
{
|
||||
lastDamageTime = Time.time;
|
||||
}
|
||||
|
||||
|
||||
Debug.LogError("剩余子弹数量:"+bullet_amount);
|
||||
SetShot(true);
|
||||
// 武器寿命逻辑
|
||||
if (bullet_amount<=0)
|
||||
|
||||
@@ -120,12 +120,13 @@ public class Gun3 : Launcher
|
||||
}
|
||||
}
|
||||
SetShot(true);
|
||||
|
||||
if (Time.time - lastDamageTime >= damageInterval)
|
||||
{
|
||||
lastDamageTime = Time.time;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.LogError("剩余子弹数量:"+bullet_amount);
|
||||
// 武器寿命逻辑
|
||||
if (bullet_amount<=0)
|
||||
{
|
||||
|
||||
@@ -129,6 +129,7 @@ public class HUDPanel : MonoBehaviour
|
||||
|
||||
IEnumerator RoundWaveTime()
|
||||
{
|
||||
GameManager.Ins.PlaySound2DRPC("1.1");
|
||||
int time = 3;
|
||||
while (time>0)
|
||||
{
|
||||
@@ -137,10 +138,9 @@ public class HUDPanel : MonoBehaviour
|
||||
time--;
|
||||
}
|
||||
Round.SetActive(false);
|
||||
GameManager.Ins.PlaySound2DRPC("");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ChangeGunIcon(int bulletIndex)
|
||||
{
|
||||
gunImage.sprite = gunIcons[GameLocal.Ins.self.NowGunIndex];
|
||||
|
||||
Reference in New Issue
Block a user