43 lines
828 B
C#
43 lines
828 B
C#
using UnityEngine;
|
|
|
|
public class ElectroTower : ManualTower
|
|
{
|
|
public Launcher gun;
|
|
|
|
private float _nextShootTime = 0;
|
|
|
|
public override void OnSpawn(int id, TowerType type, int lvl)
|
|
{
|
|
base.OnSpawn(id, type, lvl);
|
|
_nextShootTime = Time.time + gcd;
|
|
}
|
|
|
|
public override void Update()
|
|
{
|
|
base.Update();
|
|
|
|
if (!isServer)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!IsAlive || state == TowerState.Broken)
|
|
{
|
|
return;
|
|
}
|
|
|
|
// 手动模式
|
|
if ((mode == TowerMode.Manual || mode == TowerMode.Joint) && controllerId != -1)
|
|
{
|
|
if (Time.time < _nextShootTime)
|
|
{
|
|
return;
|
|
}
|
|
|
|
gun.Shoot(controllerId);
|
|
|
|
_nextShootTime = Time.time + gcd;
|
|
}
|
|
}
|
|
}
|