Sync daemon authority migration
This commit is contained in:
parent
030b4b5d74
commit
39a0dc8737
295 changed files with 25121 additions and 7360 deletions
|
|
@ -1,32 +1,26 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class ConstantParticleWeapon : MonoBehaviour
|
||||
{
|
||||
public ParticleSystem[] Particles;
|
||||
public float CastRadius = 0.25f;
|
||||
|
||||
public float Damage { get; set; }
|
||||
public float Range { get; set; }
|
||||
public DamageType DamageType { get; set; }
|
||||
public EntityInstance Source { get; set; }
|
||||
public EntityInstance Target { get; set; }
|
||||
|
||||
private bool _stopping;
|
||||
private float _emission;
|
||||
private List<ParticleSystem.Particle> _collisionParticles = new List<ParticleSystem.Particle>();
|
||||
private HullCollider _hull;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_emission = Particles[0].emission.rateOverTime.constant;
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
foreach(var p in Particles)
|
||||
p.enableEmission = true;
|
||||
{
|
||||
var emission = p.emission;
|
||||
emission.enabled = true;
|
||||
}
|
||||
_stopping = false;
|
||||
}
|
||||
|
||||
|
|
@ -38,18 +32,6 @@ public class ConstantParticleWeapon : MonoBehaviour
|
|||
main.simulationSpace = ParticleSystemSimulationSpace.Custom;
|
||||
main.customSimulationSpace = Source.LocalSpace;
|
||||
}
|
||||
|
||||
var trigger = Particles[0].trigger;
|
||||
while(trigger.colliderCount > 0)
|
||||
trigger.RemoveCollider(0);
|
||||
|
||||
if (Target == null) return;
|
||||
|
||||
foreach (var collider in Target.HullColliders)
|
||||
{
|
||||
_hull = collider;
|
||||
trigger.AddCollider(collider.GetComponent<Collider>());
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
|
@ -60,27 +42,32 @@ public class ConstantParticleWeapon : MonoBehaviour
|
|||
GetComponent<Prototype>().ReturnToPool();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnParticleTrigger()
|
||||
{
|
||||
if (Target == null || !_hull) return;
|
||||
_collisionParticles.Clear();
|
||||
Particles[0].GetTriggerParticles(ParticleSystemTriggerEventType.Enter, _collisionParticles);
|
||||
if(_collisionParticles.Count > 0)
|
||||
if (_stopping || Target == null || Range <= 0)
|
||||
return;
|
||||
|
||||
if (AetheriaYmirPhysicsBridge.Instance.TryCastTargetHulls(
|
||||
Target,
|
||||
transform.position,
|
||||
transform.forward,
|
||||
Range,
|
||||
CastRadius,
|
||||
out var hits))
|
||||
{
|
||||
_hull.SendSplash(
|
||||
Damage * Time.deltaTime,
|
||||
DamageType,
|
||||
Source.Entity,
|
||||
(transform.position - Target.transform.position).normalized);
|
||||
foreach (var hit in hits)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
foreach(var p in Particles)
|
||||
p.enableEmission = false;
|
||||
{
|
||||
var emission = p.emission;
|
||||
emission.enabled = false;
|
||||
}
|
||||
_stopping = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue