fix:调整敌人状态和playerAi状态
This commit is contained in:
19
Assets/_DefendNJ/Scripts/Guns/GunAiComponent.cs
Normal file
19
Assets/_DefendNJ/Scripts/Guns/GunAiComponent.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
11
Assets/_DefendNJ/Scripts/Guns/GunAiComponent.cs.meta
Normal file
11
Assets/_DefendNJ/Scripts/Guns/GunAiComponent.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1dc54a82f367520429e5ff0162e440c6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user