From efff4ad0886f2900055440294839384e3c14c2e5 Mon Sep 17 00:00:00 2001 From: rudderbucky Date: Sun, 21 Jun 2020 13:11:00 -0700 Subject: [PATCH] Fixes --- Assets/Scripts/Abilities/Ability.cs | 8 ++++++-- Assets/Scripts/Game Object Definitions/AI/AirCraftAI.cs | 3 ++- Assets/Scripts/Game Object Definitions/AI/BattleAI.cs | 2 +- Assets/Scripts/Game Object Definitions/ShellPart.cs | 7 +++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/Abilities/Ability.cs b/Assets/Scripts/Abilities/Ability.cs index 36ba2d217..13c8743b9 100644 --- a/Assets/Scripts/Abilities/Ability.cs +++ b/Assets/Scripts/Abilities/Ability.cs @@ -227,11 +227,15 @@ IEnumerator Blinker(Transform indicator, GameObject glowPrefab) { while(blinking) { - indicator.GetComponent().color = indicator.GetComponent().color == Color.cyan ? originalIndicatorColor : Color.cyan; + var color = indicator.GetComponent().color == Color.cyan ? originalIndicatorColor : Color.cyan; + color.a = (Core.invisible ? (Core.faction == 0 ? 0.2f: 0f) : 1f); + indicator.GetComponent().color = color; if(glowPrefab) glowPrefab.SetActive(!glowPrefab.activeSelf); yield return new WaitForSeconds(0.125F); } - indicator.GetComponent().color = originalIndicatorColor; + var resetColor = originalIndicatorColor; + resetColor.a = (Core.invisible ? (Core.faction == 0 ? 0.2f: 0f) : 1f); + indicator.GetComponent().color = resetColor; } /// diff --git a/Assets/Scripts/Game Object Definitions/AI/AirCraftAI.cs b/Assets/Scripts/Game Object Definitions/AI/AirCraftAI.cs index ac31515ed..d7c7f4af7 100644 --- a/Assets/Scripts/Game Object Definitions/AI/AirCraftAI.cs +++ b/Assets/Scripts/Game Object Definitions/AI/AirCraftAI.cs @@ -266,12 +266,13 @@ private void Update() aggroTarget = null; } + // Stealth if module is not BattleAI to not interfere with it if (!(module is BattleAI) && craft.GetHealth()[0] < craft.GetMaxHealth()[0] * 0.25f) { var abilities = craft.GetAbilities(); if(abilities != null) { - var stealths = abilities.Where((x) => { return x.GetID() == 24; }); + var stealths = abilities.Where((x) => { return (x != null) && x.GetID() == 24; }); foreach (var stealth in stealths) { stealth.Tick("activate"); diff --git a/Assets/Scripts/Game Object Definitions/AI/BattleAI.cs b/Assets/Scripts/Game Object Definitions/AI/BattleAI.cs index 748bfa6a3..58d8e9c9d 100644 --- a/Assets/Scripts/Game Object Definitions/AI/BattleAI.cs +++ b/Assets/Scripts/Game Object Definitions/AI/BattleAI.cs @@ -557,7 +557,7 @@ AIData.entities[i] is Turret && if (craft.GetHealth()[0] < craft.GetMaxHealth()[0] * 0.25f) { - var stealths = abilities.Where((x) => { return x.GetID() == 24; }); + var stealths = abilities.Where((x) => { return (x != null) && x.GetID() == 24; }); foreach (var stealth in stealths) { stealth.Tick("activate"); diff --git a/Assets/Scripts/Game Object Definitions/ShellPart.cs b/Assets/Scripts/Game Object Definitions/ShellPart.cs index 9bc0bfc42..6ec562142 100644 --- a/Assets/Scripts/Game Object Definitions/ShellPart.cs +++ b/Assets/Scripts/Game Object Definitions/ShellPart.cs @@ -115,6 +115,13 @@ public void Detach() { spriteRenderer.sortingLayerName = "Air Entities"; if(shooter) shooter.GetComponent().sortingLayerName = "Air Entities"; + + // when a part detaches it should always be completely visible + var renderers = GetComponentsInChildren(); + foreach(var rend in renderers) + { + rend.color += new Color(0, 0, 0, 1); + } } void OnDestroy() {