f8590432ba
Created assemblies for the new design code. Relocated legacy scripts into a legacy folder and made a "new_design" folder for new design.
49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
using UnityEngine;
|
|
using FishNet.Object;
|
|
using FishNet;
|
|
|
|
namespace Item
|
|
{
|
|
public class BulletComponent : NetworkBehaviour
|
|
{
|
|
[SerializeField] private float duration = 5f;
|
|
|
|
[SerializeField] private string type = "flare";
|
|
|
|
[SerializeField] private float damageRange = 20f;
|
|
|
|
[SerializeField] private float damageMagnitude = 1f;
|
|
|
|
private float existed;
|
|
private Item.FlareRegister register;
|
|
public float DamageMagnitude => damageMagnitude;
|
|
public float DamageRange => damageRange;
|
|
|
|
// Start is called before the first frame update
|
|
private void Start()
|
|
{
|
|
register = Item.FlareRegister.instance;
|
|
register.bullets.Add(this);
|
|
this.transform.parent = null;
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
private void Update()
|
|
{
|
|
}
|
|
|
|
private void FixedUpdate()
|
|
{
|
|
if (existed >= duration)
|
|
{
|
|
register.bullets.Remove(this);
|
|
InstanceFinder.ServerManager.Despawn(gameObject);
|
|
Destroy(gameObject);
|
|
|
|
}
|
|
|
|
existed += Time.fixedDeltaTime;
|
|
}
|
|
}
|
|
} |