fix:调整敌人状态和playerAi状态

This commit is contained in:
bzx
2025-09-25 13:38:59 +08:00
parent d37bb0ae35
commit ccbcd219c2
781 changed files with 80618 additions and 284 deletions

View File

@@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using Mirror;
using UnityEngine;
public class GunAiComponent : Launcher
{
public override void Start()
{
}
public void AiShoot()
{
SpawnBullet(-1, (bulletPoint.position + bulletPoint.forward * 1f) - bulletPoint.position);
SpawnShell();
SpawnMuzzle();
}
}

View File

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

View File

@@ -195,9 +195,9 @@ public class Launcher : NetworkBehaviour
return;
}
curOwnerIndex = ownerIndex;
GunInfo gunInfo = GameManager.Ins.GunInfos[type];
shootRate = gunInfo.ShootRate;
recoil = gunInfo.Recoil;
AiInfo gunInfo = GameManager.Ins.AiInfos[(int)type];
shootRate = gunInfo.FiringRate;
recoil = 0;
_shootInterval = 1f / shootRate;
bullet_amount = amount;
}

View File

@@ -11,9 +11,9 @@ public class BeamGun : Launcher
if (isServer && isClient && isOwned)
{
type = GunType.BeamGun;
GunInfo gunInfo = GameManager.Ins.GunInfos[type];
shootRate = gunInfo.ShootRate;
recoil = gunInfo.Recoil;
AiInfo gunInfo = GameManager.Ins.AiInfos[(int)type];
shootRate = gunInfo.FiringRate;
recoil = 100;
if (hand == HandType.Left)
{
MRInput.Ins.RegisterHoldPressLeftTrigger(ClickLeftTrigger);
@@ -27,9 +27,9 @@ public class BeamGun : Launcher
else if (isServer && isClient)
{
type = GunType.BeamGun;
GunInfo gunInfo = GameManager.Ins.GunInfos[type];
shootRate = gunInfo.ShootRate;
recoil = gunInfo.Recoil;
AiInfo gunInfo = GameManager.Ins.AiInfos[(int)type];
shootRate = gunInfo.FiringRate;
recoil = 100;
}
// 从机自身
else if (isClient && isOwned)

View File

@@ -12,9 +12,9 @@ public class GrenadeGun : Launcher
if (isServer && isClient && isOwned)
{
type = GunType.GrenadeGun;
GunInfo gunInfo = GameManager.Ins.GunInfos[type];
shootRate = gunInfo.ShootRate;
recoil = gunInfo.Recoil;
AiInfo gunInfo = GameManager.Ins.AiInfos[(int)type];
shootRate = gunInfo.FiringRate;
recoil = 100;
if (hand == HandType.Left)
{
MRInput.Ins.RegisterHoldPressLeftTrigger(ClickLeftTrigger);
@@ -28,9 +28,9 @@ public class GrenadeGun : Launcher
else if (isServer && isClient)
{
type = GunType.GrenadeGun;
GunInfo gunInfo = GameManager.Ins.GunInfos[type];
shootRate = gunInfo.ShootRate;
recoil = gunInfo.Recoil;
AiInfo gunInfo = GameManager.Ins.AiInfos[(int)type];
shootRate = gunInfo.FiringRate;
recoil = 100;
}
// 从机自身
else if (isClient && isOwned)

View File

@@ -26,9 +26,9 @@ public class Gun2 : Launcher
if (isServer && isClient && isOwned)
{
type = GunType.FireGun;
GunInfo gunInfo = GameManager.Ins.GunInfos[type];
shootRate = gunInfo.ShootRate;
recoil = gunInfo.Recoil;
AiInfo gunInfo = GameManager.Ins.AiInfos[(int)type];
shootRate = gunInfo.FiringRate;
recoil = 100;
// if (hand == HandType.Left)
// {
// MRInput.Ins.RegisterHoldPressLeftTrigger(ClickLeftTrigger);
@@ -42,9 +42,9 @@ public class Gun2 : Launcher
else if (isServer && isClient)
{
type = GunType.FireGun;
GunInfo gunInfo = GameManager.Ins.GunInfos[type];
shootRate = gunInfo.ShootRate;
recoil = gunInfo.Recoil;
AiInfo gunInfo = GameManager.Ins.AiInfos[(int)type];
shootRate = gunInfo.FiringRate;
recoil = 100;
}
// 从机自身
else if (isClient && isOwned)

View File

@@ -28,17 +28,17 @@ public class Gun3 : Launcher
if (isServer && isClient && isOwned)
{
type = GunType.LaserGun;
GunInfo gunInfo = GameManager.Ins.GunInfos[type];
shootRate = gunInfo.ShootRate;
recoil = gunInfo.Recoil;
AiInfo gunInfo = GameManager.Ins.AiInfos[(int)type];
shootRate = gunInfo.FiringRate;
recoil = 100;
}
// 主机其他
else if (isServer && isClient)
{
type = GunType.LaserGun;
GunInfo gunInfo = GameManager.Ins.GunInfos[type];
shootRate = gunInfo.ShootRate;
recoil = gunInfo.Recoil;
AiInfo gunInfo = GameManager.Ins.AiInfos[(int)type];
shootRate = gunInfo.FiringRate;
recoil = 100;
}
shot.SetActive(false);
bullet_attack = GameManager.Ins.BulletInfos[(BulletType)type].Damage;

View File

@@ -15,9 +15,9 @@ public class Gun4 : Launcher
if (isServer && isClient && isOwned)
{
type = GunType.LightSphereGun;
GunInfo gunInfo = GameManager.Ins.GunInfos[type];
shootRate = gunInfo.ShootRate;
recoil = gunInfo.Recoil;
AiInfo gunInfo = GameManager.Ins.AiInfos[(int)type];
shootRate = gunInfo.FiringRate;
recoil = 100;
if (hand == HandType.Left)
{
MRInput.Ins.RegisterHoldPressLeftTrigger(ClickLeftTrigger);
@@ -31,9 +31,9 @@ public class Gun4 : Launcher
else if (isServer && isClient)
{
type = GunType.LightSphereGun;
GunInfo gunInfo = GameManager.Ins.GunInfos[type];
shootRate = gunInfo.ShootRate;
recoil = gunInfo.Recoil;
AiInfo gunInfo = GameManager.Ins.AiInfos[(int)type];
shootRate = gunInfo.FiringRate;
recoil = 100;
}
// 从机自身
else if (isClient && isOwned)

View File

@@ -11,9 +11,9 @@ public class Pistol : Launcher
if (isServer && isClient && isOwned)
{
type = GunType.Pistol;
GunInfo gunInfo = GameManager.Ins.GunInfos[type];
shootRate = gunInfo.ShootRate;
recoil = gunInfo.Recoil;
AiInfo gunInfo = GameManager.Ins.AiInfos[(int)type];
shootRate = gunInfo.FiringRate;
recoil = 100;
if (hand == HandType.Left)
{
MRInput.Ins.RegisterHoldPressLeftTrigger(ClickLeftTrigger);
@@ -27,9 +27,9 @@ public class Pistol : Launcher
else if (isServer && isClient)
{
type = GunType.Pistol;
GunInfo gunInfo = GameManager.Ins.GunInfos[type];
shootRate = gunInfo.ShootRate;
recoil = gunInfo.Recoil;
AiInfo gunInfo = GameManager.Ins.AiInfos[(int)type];
shootRate = gunInfo.FiringRate;
recoil = 100;
}
// 从机自身
else if (isClient && isOwned)