public void CmdUpdateHealth(int HitPoint, int HitedPlayerIndex, string ShotType, float EffectDelay) { ShooterPlayerIndexV = playerIndex; HitedPlayerIndexV = HitedPlayerIndex; ShotTypeV = ShotType; EffectDelayV = EffectDelay; HitPointV = HitPoint; AHitPointV = 0; int ArmorBlockAmount = 1; int ArmorHit = 1; if (ShotTypeV == "HS") { ArmorBlockAmount = 45; ArmorHit = 55; } else if (ShotTypeV == "BS") { ArmorBlockAmount = 30; ArmorHit = 15; } else if (ShotTypeV == "LS") { ArmorBlockAmount = 15; ArmorHit = 5; } if (powerUp == PowerUps.DoubleHitPoint) { ArmorBlockAmount *= 2; } if (GameObject.Find("Canvas/PlayerContainer/Player" + HitedPlayerIndex + "Controller/Player" + HitedPlayerIndex)) { GP = GameObject.Find("Canvas/PlayerContainer/Player" + HitedPlayerIndex + "Controller/Player" + HitedPlayerIndex).GetComponent <GamePlayerScript>(); if (GP.armor > 0) { int d = Mathf.RoundToInt(ArmorBlockAmount / ArmorHit); if (GP.armor < AHitPointV) { int PureHealthDecrease = ArmorHit - GP.armor; ArmorBlockAmount = GP.armor * d; ArmorHit = GP.armor; } else { AHitPointV = ArmorHit; } HitPointV = HitPoint - ArmorBlockAmount; } GP.earlyHealth -= HitPointV; Invoke("CheckHealth", EffectDelay); } }
IEnumerator CheckHealth2(int PlayerIndex) { yield return(new WaitForSeconds(2f)); // UpdatePowerup = true; if (GameObject.Find("Canvas/PlayerContainer/Player" + PlayerIndex + "Controller/Player" + PlayerIndex)) { GP = GameObject.Find("Canvas/PlayerContainer/Player" + PlayerIndex + "Controller/Player" + PlayerIndex).GetComponent <GamePlayerScript>(); if (GP.health <= 0) { AimLineRotator.freeze = true; HideAimLine(); CmdCelebrate(); } } }