/// <summary> /// Receives the range damage. /// 范围伤害 /// </summary> /// <param name="attack">Attack.</param> /// <param name="damage">Damage.</param> /// <param name="impuls">Impuls.</param> public void ReceiveRangeDamage(Agent attack, float damage, Vector3 impuls) { BlackBoard.DamageType = E_DamageType.Front; BlackBoard.Attacker = attack; BlackBoard.AttackerWeapon = E_WeaponType.Bow; BlackBoard.Impuls = impuls; if (Game.Instance.GameDifficulty == E_GameDifficulty.Easy) { damage *= 0.8f; } BlackBoard.Health = Mathf.Max(0, BlackBoard.Health - damage); Fact f = FactsFactory.Create(Fact.E_FactType.E_EVENT); f.Belief = 1; f.EventType = E_EventTypes.Hit; Memory.AddFact(f); if (IsAlive) { WorldState.SetWSProperty(E_PropKey.E_EVENT, E_EventTypes.Hit); SpriteEffectsManager.Instance.CreateBlood(Transform); } else { WorldState.SetWSProperty(E_PropKey.E_EVENT, E_EventTypes.Died); StartCoroutine(FadeOut(15)); } CombatEffectsManager.Instance.PlayBloodEffect(Transform.position, impuls); }
public override void InitAction() { WorldEffects.SetWSProperty(E_PropKey.E_EVENT, E_EventTypes.None); Interruptible = false; Cost = 1; Precedence = 100; Query = FactsFactory.Create(Fact.E_FactType.E_EVENT); Query.EventType = E_EventTypes.Hit; }
public void ReceiveImpuls(Agent attacker, Vector3 impuls) { BlackBoard.Attacker = attacker; BlackBoard.AttackerWeapon = E_WeaponType.None; BlackBoard.Impuls = impuls; BlackBoard.DamageType = E_DamageType.Front; Fact f = FactsFactory.Create(Fact.E_FactType.E_EVENT); f.Belief = 1; f.EventType = E_EventTypes.Hit; Memory.AddFact(f); WorldState.SetWSProperty(E_PropKey.E_EVENT, E_EventTypes.Hit); }
/// <summary> /// Receives the enviroment damage. /// 环境伤害 /// </summary> /// <param name="damage">Damage.</param> /// <param name="impuls">Impuls.</param> void ReceiveEnviromentDamage(float damage, Vector3 impuls) { if (Game.Instance.GameDifficulty == E_GameDifficulty.Easy) { damage *= 0.5f; } BlackBoard.DamageType = E_DamageType.Enviroment; BlackBoard.Attacker = null; BlackBoard.AttackerWeapon = E_WeaponType.None; BlackBoard.Impuls = impuls; BlackBoard.Health = Mathf.Max(0, BlackBoard.Health - damage); Fact f = FactsFactory.Create(Fact.E_FactType.E_EVENT); f.Belief = 1; f.EventType = E_EventTypes.Hit; Memory.AddFact(f); //玩家受到环境攻击播放相应镜头特效 if (IsPlayer) { ; } if (IsAlive) { WorldState.SetWSProperty(E_PropKey.E_EVENT, E_EventTypes.Hit); SpriteEffectsManager.Instance.CreateBlood(Transform); } else { WorldState.SetWSProperty(E_PropKey.E_EVENT, E_EventTypes.Died); StartCoroutine(FadeOut(15)); } CombatEffectsManager.Instance.PlayBloodEffect(Transform.position, impuls); }
public void ReceiveDamage(Agent attacker, E_WeaponType byWeapon, float damage, AnimAttackData data) { if (IsAlive == false) { return; } if (attacker.IsPlayer) { Game.Instance.Hits += 1; if (Game.Instance.GameDifficulty == E_GameDifficulty.Easy) { damage *= 1.2f; } } if (IsPlayer && Game.Instance.GameDifficulty == E_GameDifficulty.Easy) { damage *= 0.8f; } if (IsPlayer && Game.Instance.DisabledState > 5) { damage *= 100; } BlackBoard.Attacker = attacker; BlackBoard.AttackerWeapon = byWeapon; BlackBoard.Impuls = attacker.Forward * data.HitMomentum; //if(debugGOAP == true) Debug.Log(Time.timeSinceLevelLoad + " Recieve damage " + name.ToString() + " from " + attacker.name); if (IsKnockedDown) { //pokud je v knockdownu , umre BlackBoard.Health = 0; BlackBoard.DamageType = E_DamageType.InKnockdown; WorldState.SetWSProperty(E_PropKey.E_EVENT, E_EventTypes.Died); CombatEffectsManager.Instance.PlayCriticalEffect(Transform.position, -attacker.Forward); StartCoroutine(Fadeout(3)); SoundPlay(SoundDataManager.Instance.FatalitySound); if (attacker.IsPlayer) { Game.Instance.Score += Experience; Player.Instance.AddExperience(Experience, 1.5f + Game.Instance.Hits * 0.1f); } } else { // normal zraneni BlackBoard.Health = Mathf.Max(0, BlackBoard.Health - damage); BlackBoard.DamageType = E_DamageType.Front; Fact f = FactsFactory.Create(Fact.E_FactType.E_EVENT); f.Belief = 1; f.EventType = E_EventTypes.Hit; Memory.AddFact(f); if (IsAlive) { WorldState.SetWSProperty(E_PropKey.E_EVENT, E_EventTypes.Hit); SpriteEffectsManager.Instance.CreateBlood(Transform); } else { WorldState.SetWSProperty(E_PropKey.E_EVENT, E_EventTypes.Died); StartCoroutine(Fadeout(3)); if (attacker.IsPlayer) { Game.Instance.Score += Experience; Player.Instance.AddExperience(Experience, 1 + Game.Instance.Hits * 0.1f); } } if (damage >= 15) { CombatEffectsManager.Instance.PlayBloodBigEffect(Transform.position, -attacker.Forward); } else { CombatEffectsManager.Instance.PlayBloodEffect(Transform.position, -attacker.Forward); } } }