598 lines
23 KiB
C#
598 lines
23 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using GazeLab.Data;
|
|
using UnityEngine;
|
|
|
|
namespace GazeLab.Combat
|
|
{
|
|
public enum EntityCategory
|
|
{
|
|
PlayerStation,
|
|
EnemyShip,
|
|
BossHull,
|
|
BossSubTurret,
|
|
Asteroid
|
|
}
|
|
|
|
public sealed class DamageableEntity : MonoBehaviour
|
|
{
|
|
public static readonly List<DamageableEntity> ActiveEntities = new List<DamageableEntity>();
|
|
|
|
[Header("Classification & Identity")]
|
|
public EntityCategory category = EntityCategory.EnemyShip;
|
|
public string displayName = "Target";
|
|
[Range(0.15f, 3.0f)] public float targetHitRadius = 0.65f;
|
|
|
|
[Header("Health, Shield & Armor")]
|
|
public float maxHull = 100f;
|
|
public float currentHull = 100f;
|
|
public float maxShield = 0f;
|
|
public float currentShield = 0f;
|
|
public float shieldRegenPerSec = 0f;
|
|
public float shieldRegenDelay = 3.5f;
|
|
public bool isArmored = false;
|
|
[Range(0f, 0.75f)] public float armorDamageReduction = 0.35f;
|
|
|
|
[Header("Harpoon Chain Grapple State")]
|
|
[Range(1, 5)] public int requiredHarpoonChains = 1;
|
|
public int activeHarpoonChains;
|
|
public float harpoonTimerRemaining;
|
|
public float harpoonTargetDistance = 2.2f;
|
|
public float harpoonPullSpeed = 4.0f;
|
|
public float harpoonFocusDamageMultiplier = 1.25f;
|
|
|
|
[Header("Visual Renderers")]
|
|
public SpriteRenderer mainSpriteRenderer;
|
|
public CentroidShieldRenderer shieldVisualRenderer;
|
|
|
|
// Status timers & stacks
|
|
private float lastDamageTime = -99f;
|
|
private float burnTimer;
|
|
private float burnDps;
|
|
private float corrosiveTimer;
|
|
private float corrosiveDps;
|
|
private float stunTimer;
|
|
private float slowTimer;
|
|
private float dotTickAccumulator;
|
|
private float hitFlashTimer;
|
|
private bool isHovered;
|
|
private Color baseSpriteColor = Color.white;
|
|
private readonly List<ProceduralChainRenderer> attachedChainVisuals = new List<ProceduralChainRenderer>();
|
|
|
|
public bool IsAlive => currentHull > 0f;
|
|
public bool IsPlayerStation => category == EntityCategory.PlayerStation;
|
|
public bool IsShielded => currentShield > 0.5f;
|
|
public bool IsStunned => stunTimer > 0f;
|
|
public bool IsSlowed => slowTimer > 0f || IsHarpoonImmobilized;
|
|
public bool IsCorroded => corrosiveTimer > 0f;
|
|
public bool IsHarpoonImmobilized => harpoonTimerRemaining > 0f && activeHarpoonChains >= requiredHarpoonChains;
|
|
public float MovementSpeedMultiplier => IsHarpoonImmobilized ? 0f : (slowTimer > 0f ? 0.45f : 1.0f);
|
|
public float TurretRateMultiplier => IsStunned ? 0f : (slowTimer > 0f ? 0.6f : 1.0f);
|
|
public float HullRatio => maxHull > 0f ? Mathf.Clamp01(currentHull / maxHull) : 0f;
|
|
public float ShieldRatio => maxShield > 0f ? Mathf.Clamp01(currentShield / maxShield) : 0f;
|
|
|
|
public Vector3 EstimatedVelocity { get; private set; }
|
|
private Vector3 lastWorldPosition;
|
|
|
|
public event Action<DamageableEntity, float, Vector3, WeaponFamily> OnDamaged;
|
|
public event Action<DamageableEntity, ProjectileDefinition> OnKilled;
|
|
|
|
public static Action<Vector3, string, Color, float> OnSpawnFloatingText;
|
|
|
|
private void OnEnable()
|
|
{
|
|
if (!ActiveEntities.Contains(this))
|
|
ActiveEntities.Add(this);
|
|
lastWorldPosition = transform.position;
|
|
EstimatedVelocity = Vector3.zero;
|
|
if (mainSpriteRenderer == null)
|
|
mainSpriteRenderer = GetComponentInChildren<SpriteRenderer>();
|
|
if (mainSpriteRenderer != null)
|
|
baseSpriteColor = mainSpriteRenderer.color;
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
ActiveEntities.Remove(this);
|
|
ClearHarpoonChains();
|
|
}
|
|
|
|
public void InitializeStats(
|
|
float hull,
|
|
float shield,
|
|
float shieldRegen,
|
|
bool armored,
|
|
float armorReduction,
|
|
int neededChains = 1,
|
|
CentroidOpacityProfile shieldProfile = null)
|
|
{
|
|
maxHull = Mathf.Max(1f, hull);
|
|
currentHull = maxHull;
|
|
maxShield = Mathf.Max(0f, shield);
|
|
currentShield = maxShield;
|
|
shieldRegenPerSec = shieldRegen;
|
|
isArmored = armored;
|
|
armorDamageReduction = Mathf.Clamp(armorReduction, 0f, 0.75f);
|
|
requiredHarpoonChains = Mathf.Max(1, neededChains);
|
|
activeHarpoonChains = 0;
|
|
harpoonTimerRemaining = 0f;
|
|
burnTimer = 0f;
|
|
corrosiveTimer = 0f;
|
|
stunTimer = 0f;
|
|
slowTimer = 0f;
|
|
|
|
if (maxShield > 0f && shieldProfile != null)
|
|
{
|
|
EnsureShieldRenderer(shieldProfile);
|
|
}
|
|
else if (shieldVisualRenderer != null)
|
|
{
|
|
shieldVisualRenderer.shieldHealthRatio = 0f;
|
|
shieldVisualRenderer.UpdateShaderProperties();
|
|
}
|
|
}
|
|
|
|
public void EnsureShieldRenderer(CentroidOpacityProfile profile)
|
|
{
|
|
if (profile == null) return;
|
|
if (shieldVisualRenderer == null)
|
|
{
|
|
GameObject shGo = new GameObject("CentroidShield");
|
|
shGo.transform.SetParent(transform, false);
|
|
shGo.transform.localPosition = Vector3.zero;
|
|
shGo.transform.localScale = Vector3.one * 1.35f;
|
|
shieldVisualRenderer = shGo.AddComponent<CentroidShieldRenderer>();
|
|
}
|
|
int baseOrder = mainSpriteRenderer != null ? mainSpriteRenderer.sortingOrder : 5;
|
|
shieldVisualRenderer.Configure(profile, baseOrder + 6);
|
|
shieldVisualRenderer.shieldHealthRatio = ShieldRatio;
|
|
shieldVisualRenderer.RestoreShield();
|
|
}
|
|
|
|
public void SyncMaxStatsWithBonus(
|
|
float newMaxHull,
|
|
float newMaxShield,
|
|
float newShieldRegen,
|
|
float bonusHullAdded,
|
|
float bonusShieldAdded,
|
|
CentroidOpacityProfile shieldProfile)
|
|
{
|
|
maxHull = Mathf.Max(1f, newMaxHull);
|
|
currentHull = Mathf.Clamp(currentHull + Mathf.Max(0f, bonusHullAdded), 1f, maxHull);
|
|
|
|
bool unlockedShieldNow = maxShield <= 0.01f && newMaxShield > 0.01f;
|
|
maxShield = Mathf.Max(0f, newMaxShield);
|
|
currentShield = Mathf.Clamp(currentShield + Mathf.Max(0f, bonusShieldAdded), 0f, maxShield);
|
|
shieldRegenPerSec = Mathf.Max(0f, newShieldRegen);
|
|
|
|
if (maxShield > 0f && shieldProfile != null)
|
|
{
|
|
EnsureShieldRenderer(shieldProfile);
|
|
if (unlockedShieldNow && shieldVisualRenderer != null)
|
|
{
|
|
shieldVisualRenderer.RestoreShield();
|
|
}
|
|
}
|
|
if (shieldVisualRenderer != null)
|
|
{
|
|
shieldVisualRenderer.shieldHealthRatio = ShieldRatio;
|
|
shieldVisualRenderer.UpdateShaderProperties();
|
|
}
|
|
}
|
|
|
|
public float ApplyDirectDamage(float rawDamage, Vector3 hitWorldPos)
|
|
{
|
|
if (!IsAlive || rawDamage <= 0.01f) return 0f;
|
|
|
|
lastDamageTime = Time.time;
|
|
float remaining = rawDamage;
|
|
float totalDealt = 0f;
|
|
|
|
if (currentShield > 0f && category != EntityCategory.Asteroid)
|
|
{
|
|
float absorbed = Mathf.Min(currentShield, remaining);
|
|
currentShield -= absorbed;
|
|
totalDealt += absorbed;
|
|
remaining -= absorbed;
|
|
|
|
if (shieldVisualRenderer != null)
|
|
{
|
|
shieldVisualRenderer.shieldHealthRatio = ShieldRatio;
|
|
shieldVisualRenderer.TriggerDirectionalHit(hitWorldPos, 1.7f);
|
|
if (currentShield <= 0.01f)
|
|
{
|
|
shieldVisualRenderer.TriggerShieldBreak();
|
|
OnSpawnFloatingText?.Invoke(transform.position + Vector3.up * 0.4f, "SHIELD BROKEN!", new Color(0.3f, 0.9f, 1f), 1.15f);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (remaining > 0.05f)
|
|
{
|
|
if (isArmored)
|
|
{
|
|
remaining *= (1f - armorDamageReduction);
|
|
}
|
|
totalDealt += ApplyRawHullDamage(remaining, hitWorldPos, WeaponFamily.Physical, null, showPopup: false);
|
|
}
|
|
|
|
if (totalDealt >= 1f)
|
|
{
|
|
OnSpawnFloatingText?.Invoke(
|
|
hitWorldPos + new Vector3(UnityEngine.Random.Range(-0.18f, 0.18f), 0.2f, 0f),
|
|
Mathf.RoundToInt(totalDealt).ToString(),
|
|
new Color(1f, 0.55f, 0.35f),
|
|
1.05f);
|
|
}
|
|
|
|
return totalDealt;
|
|
}
|
|
|
|
public void SetHoveredHighlight(bool hovered)
|
|
{
|
|
if (isHovered == hovered) return;
|
|
isHovered = hovered;
|
|
UpdateVisualTint();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (!IsAlive) return;
|
|
|
|
float dt = Time.deltaTime;
|
|
|
|
// Shield Regeneration
|
|
if (maxShield > 0f && shieldRegenPerSec > 0f && currentShield < maxShield)
|
|
{
|
|
if (Time.time - lastDamageTime >= shieldRegenDelay)
|
|
{
|
|
bool wasDepleted = currentShield <= 0.01f;
|
|
currentShield = Mathf.Min(maxShield, currentShield + shieldRegenPerSec * dt);
|
|
if (shieldVisualRenderer != null)
|
|
{
|
|
if (wasDepleted && currentShield > 0.5f)
|
|
shieldVisualRenderer.RestoreShield();
|
|
shieldVisualRenderer.shieldHealthRatio = ShieldRatio;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Status Effect Timers
|
|
if (stunTimer > 0f) stunTimer -= dt;
|
|
if (slowTimer > 0f) slowTimer -= dt;
|
|
if (hitFlashTimer > 0f)
|
|
{
|
|
hitFlashTimer -= dt;
|
|
if (hitFlashTimer <= 0f) UpdateVisualTint();
|
|
}
|
|
|
|
// Harpoon Grapple Timer
|
|
if (harpoonTimerRemaining > 0f)
|
|
{
|
|
harpoonTimerRemaining -= dt;
|
|
if (harpoonTimerRemaining <= 0f)
|
|
{
|
|
ClearHarpoonChains();
|
|
}
|
|
}
|
|
|
|
// DoT Processing (Plasma Burn & Corrosive)
|
|
bool hasDoT = burnTimer > 0f || corrosiveTimer > 0f;
|
|
if (burnTimer > 0f) burnTimer -= dt;
|
|
if (corrosiveTimer > 0f) corrosiveTimer -= dt;
|
|
|
|
if (hasDoT)
|
|
{
|
|
dotTickAccumulator += dt;
|
|
if (dotTickAccumulator >= 0.5f)
|
|
{
|
|
float dmg = 0f;
|
|
if (burnTimer > 0f) dmg += burnDps * dotTickAccumulator;
|
|
if (corrosiveTimer > 0f) dmg += corrosiveDps * dotTickAccumulator;
|
|
dotTickAccumulator = 0f;
|
|
if (dmg > 0.1f)
|
|
{
|
|
ApplyRawHullDamage(dmg, transform.position, WeaponFamily.Special, null, showPopup: true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void LateUpdate()
|
|
{
|
|
float dt = Time.deltaTime;
|
|
if (dt > 0.0001f)
|
|
{
|
|
EstimatedVelocity = (transform.position - lastWorldPosition) / dt;
|
|
}
|
|
lastWorldPosition = transform.position;
|
|
}
|
|
|
|
public float ApplyProjectileHit(ProjectileDefinition proj, Vector3 hitWorldPos, float damageMultiplier = 1f)
|
|
{
|
|
if (!IsAlive || proj == null) return 0f;
|
|
|
|
lastDamageTime = Time.time;
|
|
float rawDamage = proj.baseDamage * damageMultiplier;
|
|
|
|
if (IsHarpoonImmobilized)
|
|
{
|
|
rawDamage *= harpoonFocusDamageMultiplier;
|
|
}
|
|
if (IsCorroded)
|
|
{
|
|
rawDamage *= 1.25f;
|
|
}
|
|
|
|
if (category == EntityCategory.Asteroid)
|
|
{
|
|
rawDamage *= proj.asteroidMultiplier;
|
|
}
|
|
|
|
float totalDealt = 0f;
|
|
|
|
// 1. Shield Layer Absorption
|
|
if (currentShield > 0f && category != EntityCategory.Asteroid)
|
|
{
|
|
float shieldDmg = rawDamage * proj.shieldMultiplier;
|
|
float absorbed = Mathf.Min(currentShield, shieldDmg);
|
|
currentShield -= absorbed;
|
|
totalDealt += absorbed;
|
|
|
|
if (shieldVisualRenderer != null)
|
|
{
|
|
shieldVisualRenderer.shieldHealthRatio = ShieldRatio;
|
|
shieldVisualRenderer.TriggerDirectionalHit(hitWorldPos, 1.7f);
|
|
if (currentShield <= 0.01f)
|
|
{
|
|
shieldVisualRenderer.TriggerShieldBreak();
|
|
OnSpawnFloatingText?.Invoke(transform.position + Vector3.up * 0.4f, "SHIELD BROKEN!", new Color(0.3f, 0.9f, 1f), 1.15f);
|
|
}
|
|
}
|
|
|
|
float leftoverRatio = Mathf.Clamp01(1f - (absorbed / Mathf.Max(0.01f, shieldDmg)));
|
|
rawDamage *= leftoverRatio;
|
|
}
|
|
|
|
// 2. Armor & Hull Layer
|
|
if (rawDamage > 0.05f)
|
|
{
|
|
float hullDmg = rawDamage * proj.hullMultiplier;
|
|
if (isArmored)
|
|
{
|
|
hullDmg *= proj.armorMultiplier;
|
|
if (proj.statusEffect != StatusEffectType.ArmorShred)
|
|
{
|
|
hullDmg *= (1f - armorDamageReduction);
|
|
}
|
|
}
|
|
|
|
totalDealt += ApplyRawHullDamage(hullDmg, hitWorldPos, GetFamilyFromStatus(proj.statusEffect), proj, showPopup: false);
|
|
}
|
|
|
|
// 3. Apply Status Effects
|
|
if (IsAlive && proj.statusEffect != StatusEffectType.None && UnityEngine.Random.value <= proj.statusProcChance)
|
|
{
|
|
ApplyStatusEffect(proj, hitWorldPos);
|
|
}
|
|
|
|
// Floating Damage Popup
|
|
if (totalDealt >= 1f)
|
|
{
|
|
Color popCol = GetPopupColor(proj);
|
|
OnSpawnFloatingText?.Invoke(hitWorldPos + new Vector3(UnityEngine.Random.Range(-0.18f, 0.18f), 0.2f, 0f),
|
|
Mathf.RoundToInt(totalDealt).ToString(), popCol, 1.0f);
|
|
}
|
|
|
|
return totalDealt;
|
|
}
|
|
|
|
private float ApplyRawHullDamage(float hullDmg, Vector3 hitPos, WeaponFamily family, ProjectileDefinition sourceProj, bool showPopup)
|
|
{
|
|
if (!IsAlive) return 0f;
|
|
float actual = Mathf.Min(currentHull, hullDmg);
|
|
currentHull -= actual;
|
|
|
|
hitFlashTimer = 0.09f;
|
|
if (mainSpriteRenderer != null)
|
|
{
|
|
mainSpriteRenderer.color = new Color(1f, 0.72f, 0.72f, 1f);
|
|
}
|
|
|
|
if (showPopup && actual >= 1f)
|
|
{
|
|
OnSpawnFloatingText?.Invoke(hitPos + Vector3.up * 0.25f, Mathf.RoundToInt(actual).ToString(), new Color(0.45f, 1f, 0.45f), 0.85f);
|
|
}
|
|
|
|
OnDamaged?.Invoke(this, actual, hitPos, family);
|
|
|
|
if (currentHull <= 0.001f)
|
|
{
|
|
currentHull = 0f;
|
|
OnKilled?.Invoke(this, sourceProj);
|
|
}
|
|
|
|
return actual;
|
|
}
|
|
|
|
private void ApplyStatusEffect(ProjectileDefinition proj, Vector3 hitPos)
|
|
{
|
|
switch (proj.statusEffect)
|
|
{
|
|
case StatusEffectType.ArmorShred:
|
|
if (isArmored)
|
|
{
|
|
armorDamageReduction = Mathf.Max(0f, armorDamageReduction - 0.12f);
|
|
OnSpawnFloatingText?.Invoke(hitPos, "ARMOR SHRED", new Color(1f, 0.78f, 0.25f), 0.9f);
|
|
}
|
|
break;
|
|
|
|
case StatusEffectType.PlasmaBurn:
|
|
burnTimer = Mathf.Max(burnTimer, proj.statusDuration);
|
|
burnDps = Mathf.Max(burnDps, proj.statusPotency);
|
|
break;
|
|
|
|
case StatusEffectType.CorrosiveDoT:
|
|
corrosiveTimer = Mathf.Max(corrosiveTimer, proj.statusDuration);
|
|
corrosiveDps = Mathf.Max(corrosiveDps, proj.statusPotency);
|
|
if (isArmored) armorDamageReduction = Mathf.Max(0f, armorDamageReduction - 0.08f);
|
|
OnSpawnFloatingText?.Invoke(hitPos, "CORRODED", new Color(0.35f, 1f, 0.35f), 0.9f);
|
|
break;
|
|
|
|
case StatusEffectType.CryoChill:
|
|
slowTimer = Mathf.Max(slowTimer, proj.statusDuration);
|
|
UpdateVisualTint();
|
|
break;
|
|
|
|
case StatusEffectType.MicrowaveRepulseSlow:
|
|
slowTimer = Mathf.Max(slowTimer, proj.statusDuration);
|
|
if (!IsPlayerStation && proj.knockbackForce > 0.01f)
|
|
{
|
|
Vector3 stationOriginPos = Entities.SpaceStationController.Instance != null
|
|
? Entities.SpaceStationController.Instance.transform.position
|
|
: new Vector3(0f, -3.6f, 0f);
|
|
Vector3 pushDir = (transform.position - stationOriginPos).normalized;
|
|
pushDir.z = 0f;
|
|
transform.position += pushDir * (proj.knockbackForce * 0.18f);
|
|
}
|
|
break;
|
|
|
|
case StatusEffectType.ElectroChainStun:
|
|
stunTimer = Mathf.Max(stunTimer, Mathf.Min(1.5f, proj.statusDuration * 0.45f));
|
|
if (proj.chainTargetsCount > 0)
|
|
{
|
|
TriggerChainLightning(proj);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void TriggerChainLightning(ProjectileDefinition proj)
|
|
{
|
|
int chained = 0;
|
|
float rangeSq = proj.chainRange * proj.chainRange;
|
|
Vector3 myPos = transform.position;
|
|
|
|
for (int i = 0; i < ActiveEntities.Count && chained < proj.chainTargetsCount; i++)
|
|
{
|
|
DamageableEntity other = ActiveEntities[i];
|
|
if (other == null || other == this || !other.IsAlive || other.IsPlayerStation == IsPlayerStation)
|
|
continue;
|
|
|
|
float dSq = (other.transform.position - myPos).sqrMagnitude;
|
|
if (dSq <= rangeSq)
|
|
{
|
|
ProceduralChainRenderer.SpawnElectricArc(myPos, other.transform.position, new Color(0.35f, 0.9f, 1f, 1f));
|
|
other.ApplyRawHullDamage(proj.baseDamage * 0.55f, other.transform.position, WeaponFamily.Electro, proj, showPopup: true);
|
|
other.stunTimer = Mathf.Max(other.stunTimer, 0.75f);
|
|
chained++;
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool AttachHarpoonChain(
|
|
Transform stationOrigin,
|
|
Vector3 localAnchor,
|
|
int chainsAdded,
|
|
float duration,
|
|
float pullDist,
|
|
float pullSpd,
|
|
float focusBonus)
|
|
{
|
|
if (IsPlayerStation || !IsAlive) return false;
|
|
|
|
activeHarpoonChains += Mathf.Max(1, chainsAdded);
|
|
harpoonTimerRemaining = Mathf.Max(harpoonTimerRemaining, duration);
|
|
harpoonTargetDistance = pullDist;
|
|
harpoonPullSpeed = pullSpd;
|
|
harpoonFocusDamageMultiplier = focusBonus;
|
|
|
|
bool locked = activeHarpoonChains >= requiredHarpoonChains;
|
|
|
|
for (int i = 0; i < chainsAdded; i++)
|
|
{
|
|
Vector3 offset = localAnchor + new Vector3(UnityEngine.Random.Range(-0.25f, 0.25f), 0f, 0f);
|
|
var visual = ProceduralChainRenderer.AttachHarpoonChain(stationOrigin, offset, transform, duration, locked);
|
|
attachedChainVisuals.Add(visual);
|
|
}
|
|
|
|
for (int i = 0; i < attachedChainVisuals.Count; i++)
|
|
{
|
|
if (attachedChainVisuals[i] != null)
|
|
attachedChainVisuals[i].SetLockState(locked);
|
|
}
|
|
|
|
if (locked)
|
|
{
|
|
OnSpawnFloatingText?.Invoke(transform.position + Vector3.up * 0.45f,
|
|
"HARPOON LOCKED! FOCUS FIRE!", new Color(0.3f, 0.95f, 1f), 1.2f);
|
|
}
|
|
else
|
|
{
|
|
OnSpawnFloatingText?.Invoke(transform.position + Vector3.up * 0.45f,
|
|
$"CHAIN {activeHarpoonChains}/{requiredHarpoonChains} (NEEDS MORE!)", new Color(1f, 0.78f, 0.25f), 1.1f);
|
|
}
|
|
|
|
return locked;
|
|
}
|
|
|
|
public void ClearHarpoonChains()
|
|
{
|
|
activeHarpoonChains = 0;
|
|
harpoonTimerRemaining = 0f;
|
|
for (int i = 0; i < attachedChainVisuals.Count; i++)
|
|
{
|
|
if (attachedChainVisuals[i] != null)
|
|
attachedChainVisuals[i].Recycle();
|
|
}
|
|
attachedChainVisuals.Clear();
|
|
}
|
|
|
|
private void UpdateVisualTint()
|
|
{
|
|
if (mainSpriteRenderer == null) return;
|
|
if (isHovered)
|
|
{
|
|
mainSpriteRenderer.color = Color.Lerp(baseSpriteColor, new Color(0.55f, 0.95f, 1f, 1f), 0.38f);
|
|
}
|
|
else if (slowTimer > 0f)
|
|
{
|
|
mainSpriteRenderer.color = Color.Lerp(baseSpriteColor, new Color(0.55f, 0.85f, 1f, 1f), 0.35f);
|
|
}
|
|
else if (corrosiveTimer > 0f)
|
|
{
|
|
mainSpriteRenderer.color = Color.Lerp(baseSpriteColor, new Color(0.45f, 1f, 0.45f, 1f), 0.35f);
|
|
}
|
|
else
|
|
{
|
|
mainSpriteRenderer.color = baseSpriteColor;
|
|
}
|
|
}
|
|
|
|
private static WeaponFamily GetFamilyFromStatus(StatusEffectType st)
|
|
{
|
|
switch (st)
|
|
{
|
|
case StatusEffectType.ArmorShred: return WeaponFamily.Gauss;
|
|
case StatusEffectType.PlasmaBurn: return WeaponFamily.Plasma;
|
|
case StatusEffectType.ElectroChainStun: return WeaponFamily.Electro;
|
|
case StatusEffectType.MicrowaveRepulseSlow: return WeaponFamily.Microwave;
|
|
default: return WeaponFamily.Physical;
|
|
}
|
|
}
|
|
|
|
private static Color GetPopupColor(ProjectileDefinition proj)
|
|
{
|
|
switch (proj.statusEffect)
|
|
{
|
|
case StatusEffectType.ElectroChainStun: return new Color(0.35f, 0.95f, 1f);
|
|
case StatusEffectType.ArmorShred: return new Color(1f, 0.85f, 0.3f);
|
|
case StatusEffectType.CorrosiveDoT: return new Color(0.4f, 1f, 0.4f);
|
|
case StatusEffectType.VoidGravityPull: return new Color(0.8f, 0.45f, 1f);
|
|
case StatusEffectType.PlasmaBurn: return new Color(1f, 0.55f, 0.2f);
|
|
default: return new Color(1f, 0.92f, 0.75f);
|
|
}
|
|
}
|
|
}
|
|
}
|