private static void Prefix(ref BubbleShield __instance) { var renderers = __instance.GetComponentsInChildren <Renderer>(true); foreach (var r in renderers) { r.enabled = displayBubblesBool; } }
void CmdBubbleshield(int current) { var special = (GameObject)Instantiate( specialPrefab[current], transform.position, Quaternion.identity); BubbleShield script = special.GetComponent <BubbleShield>(); script.owner = this; NetworkServer.Spawn(special); }
/// <summary> /// Deals damage to this player. /// </summary> /// <param name="amount">The amount of damage done. All damage is normalized (1 = instakill)</param> /// <param name="sourceTune">The tune that caused the damage.</param> /// <param name="aggressor">The player who caused the damage.</param> public void DealDamage(float amount, Tune sourceTune = null, PlayerID aggressor = PlayerID.None) { BaseControl control = GetComponent <BaseControl>(); if (sourceTune != null && aggressor != control.player && amount > 0) { BubbleShield shield = GetComponentInChildren <BubbleShield>(); if (shield != null) { shield.BlockAttack(amount); return; } } health -= amount; bool died = false; if (health <= 0) { control.ClearMomentum(); if (control.player != PlayerID.None) { EffectManager.instance.SpawnDeathEffect(transform.position, control.GetRobeMaterial().color); } GetComponent <BaseControl>().enabled = false; positionOfDeath = transform.position; transform.position = Vector3.up * 100f; died = true; if (roundHandler) { Assets.Scripts.Data.RoundHandler.Instance.AddDeath(control.player); } else { respawnTimer = respawnTime; } } if (health > 1) { health = 1f; } updateHealthBar(); if (uiController != null) { uiController.UpdateHealth(health, died); } if (aggressor == PlayerID.None) { aggressor = control.player; } else { float weight = amount; if (aggressor == control.player) { weight = -weight; } LevelManager.instance.GetBardFromID(aggressor).CreditHit(sourceTune, weight, true); } if (amount > 0) { lastHitTune = sourceTune; lastHitPlayer = aggressor; if (aggressor != control.player) { AdaptiveAI adapt = GetComponent <AdaptiveAI>(); if (adapt != null) { adapt.TakeDamage(amount); } } } }