Sync daemon authority migration
This commit is contained in:
parent
030b4b5d74
commit
39a0dc8737
295 changed files with 25121 additions and 7360 deletions
|
|
@ -1,8 +1,6 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
|
|
@ -51,8 +49,6 @@ public class Mine : MonoBehaviour
|
|||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
var position = transform.position;
|
||||
|
||||
if (Time.time - _startTime > ActivationDelay && !_active)
|
||||
{
|
||||
_active = true;
|
||||
|
|
@ -60,25 +56,11 @@ public class Mine : MonoBehaviour
|
|||
|
||||
if(_active)
|
||||
{
|
||||
_emission = lerp(_emission, _blastCountdown ? ArmedEmission : ActiveEmission, Time.deltaTime * 10);
|
||||
_emission = Mathf.Lerp(_emission, _blastCountdown ? ArmedEmission : ActiveEmission, Time.deltaTime * 10);
|
||||
_pulseLerp += Time.deltaTime / (_blastCountdown ? ArmedCycleDuration : ActiveCycleDuration);
|
||||
_pulseLerp %= 1;
|
||||
if(!_blastCountdown)
|
||||
{
|
||||
foreach (var collider in Physics.OverlapSphere(position, BlastRange, 1))
|
||||
{
|
||||
var hull = collider.GetComponent<HullCollider>();
|
||||
if (hull)
|
||||
{
|
||||
_blastCountdown = true;
|
||||
_blastTime = Time.time + BlastDelay;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((position - Source.transform.position).magnitude > Range ||
|
||||
Time.time - _startTime > Lifetime ||
|
||||
_blastCountdown && Time.time > _blastTime)
|
||||
if (Time.time - _startTime > Lifetime)
|
||||
{
|
||||
Explode();
|
||||
}
|
||||
|
|
@ -89,21 +71,6 @@ public class Mine : MonoBehaviour
|
|||
public void Explode()
|
||||
{
|
||||
var position = transform.position;
|
||||
foreach (var collider in Physics.OverlapSphere(position, BlastRange, 1 | (1 << 17)))
|
||||
{
|
||||
var shield = collider.GetComponent<ShieldManager>();
|
||||
if (shield && (shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
{
|
||||
shield.Entity.Shield.TakeHit(DamageType, Damage);
|
||||
shield.ShowHit(position, sqrt(Damage));
|
||||
}
|
||||
var hull = collider.GetComponent<HullCollider>();
|
||||
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active.Value && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
{
|
||||
hull.SendSplash(Damage, DamageType, Source.Entity, (collider.transform.position - position).normalized);
|
||||
}
|
||||
}
|
||||
|
||||
var ht = HitEffect.Instantiate<Transform>();
|
||||
ht.position = position;
|
||||
GetComponent<Prototype>().ReturnToPool();
|
||||
|
|
|
|||
Loading…
Reference in a new issue