public void TakeDamage(bool enabeldblood, bool isIceDamage, float amount, float IncreseDamageRate) { Debug.Log("Damage:" + amount); Debug.Log(healthNow); if (isOffline) { if (!isIceDamage && CanDodge) { float DRate = Random.Range(0f, 100f); if (DRate <= DodgeRate) { Debug.Log("Dodge!"); GameObject Dodgetext = Instantiate(DodgeText, transform.position, Quaternion.identity); Dodgetext.transform.parent = gameObject.transform; Destroy(Dodgetext, 0.5f); return; } } if (HorseAssistance != null & !isIceDamage) { float JRate = Random.Range(0f, 100f); if (JRate <= JumpRate) { Debug.Log("Jump!"); GameObject HAssistance = Instantiate(HorseAssistance, transform.position, Quaternion.identity); HAssistance.GetComponent <HorseAssistance>().Jump(gameObject); } } else if (isOwl) { if (healthNow / health <= (SpeedUpHealthRate / 100) & !AlreadSpeedUp) { this.GetComponent <FlyMonster>().speed += OwlSpeed; AlreadSpeedUp = true; GameObject WindEffect = Instantiate(WindEffectPrefab, transform.position, Quaternion.identity); WindEffect.transform.parent = gameObject.transform; if (FrozedNow) { foreach (GameObject Ice in Ices) { Destroy(Ice); } this.GetComponent <FlyMonster>().enabled = true; this.GetComponent <Animator>().enabled = true; } } } Debug.Log(healthNow); if (IncreseDamage) { healthNow -= amount * OffLineIncreseDamageRate * GuardRate / 100; } else { healthNow -= amount * GuardRate / 100; } healthBar.fillAmount = healthNow / health; Debug.Log(healthNow); if (!isIceDamage & !FrozedNow) { GetDamageEffect(); } Debug.Log(healthNow); if (healthNow <= 0) { if (Ice != null) { Destroy(Ice); } if (this.name == "AutoEnemy(Clone)") { GameObject MoneyT = Instantiate(MoneyText, transform.position, Quaternion.identity); MoneyTextInfo.text = "+" + Money.ToString(); PlayerOff.Money += Money; Debug.Log("AddMoney"); Destroy(MoneyT, .5f); FindObjectsOfType <GameManageNewOff>()[0].GetComponent <GameManageNewOff>().AddScore(10); } float rate = Random.Range(0f, 100.0f); if (rate <= CaptureRate & this.name == "AutoEnemy(Clone)") { Debug.Log("Cap"); Capture(); } if (this.GetComponent <Loris>() != null) { this.GetComponent <Loris>().SetVelocity(this.GetComponent <AIPath>().velocity.x, this.GetComponent <AIPath>().velocity.y); } else if (this.GetComponent <Turtle>() != null) { this.GetComponent <Turtle>().HealMonster(); } if (isdead) { return; } DeadProcess(); } return; } else if (CanSpeedUp) { if (healthNow / health <= (SpeedUpHealthRate / 100) & !AlreadSpeedUp) { this.GetComponent <FlyMonster>().speed += OwlSpeed; AlreadSpeedUp = true; Debug.Log(healthNow); Debug.Log(health); } } if (!isIceDamage && CanDodge) { if (hasAuthority) { return; } NetPlayer.CmdDecideMonsterDodge(this.GetComponent <NetworkIdentity>().netId, amount, IncreseDamage); } else { if (hasAuthority) { return; } NetPlayer.CmdMonsterGetDamage(this.GetComponent <NetworkIdentity>().netId, amount, IncreseDamage); } if (healthNow <= 0) { Destroy(Ice); ReadyToDestroy(); } }