public override bool OnHit(AttackInfo Attack) { base.OnHit(Attack); if (CurrentHP > 0) { CharacterAttackInfo HitAttack = (CharacterAttackInfo)Attack; var Data = GetComponent <DummyData>(); Interrupted = true; int Damage = Utility.GetEffectValue(HitAttack.Power, HitAttack.Potency); CurrentHP -= Damage; if (DamageText == null) { DamageText = (GameObject)Instantiate(Resources.Load("Prefabs/DamageText"), transform.localPosition, Quaternion.Euler(0, 0, 0)); } DamageText.GetComponent <DamageText>().ActivateSelf(Damage); DamageText.transform.SetParent(Canvas.transform); if (CurrentHP <= 0) { return(true); } } return(false); }
protected void SetKnockedBack(bool b, CharacterAttackInfo Attack = null) { var Data = Entity.GetComponent <KnightData>(); var Status = Entity.GetComponent <StatusManager_Knight>(); if (b) { Status.Interrupted = false; InKnockedBack = true; KnockedBackTimeCount = 0; if (Attack.Dir == Direction.Right) { Entity.GetComponent <SpeedManager>().ForcedSpeed.x = Data.KnockedBackSpeed; } else if (Attack.Dir == Direction.Left) { Entity.GetComponent <SpeedManager>().ForcedSpeed.x = -Data.KnockedBackSpeed; } } else { InKnockedBack = false; Entity.GetComponent <SpeedManager>().ForcedSpeed.x = 0; } }
public static void SetAttackHitBox(CharacterAttackInfo Attack, Vector2 Offset, Vector2 HitBoxSize, float TimeCount) { float CurrentSizeX = Mathf.Lerp(0, HitBoxSize.x, TimeCount / Attack.StrikeTime); float CurrentOffsetX = Offset.x - HitBoxSize.x / 2 + CurrentSizeX / 2; Attack.HitBoxSize = new Vector2(CurrentSizeX, HitBoxSize.y); Attack.HitBoxOffset = new Vector2(CurrentOffsetX, Offset.y); }
public override bool OnHit(AttackInfo Attack) { base.OnHit(Attack); var Data = GetComponent <SoulWarriorData>(); CurrentTakenAttack = (CharacterAttackInfo)Attack; if (CurrentTakenAttack.InterruptLevel > 0 && GetComponent <SoulWarriorAI>().CurrentState != SoulWarriorState.SlashStrike && GetComponent <SoulWarriorAI>().CurrentState != SoulWarriorState.MagicStrike) { Interrupted = true; if (CurrentTakenAttack.InterruptLevel >= Data.OffBalanceInterruptLevel || CurrentTakenAttack.Dir == Direction.Right && transform.right.x > 0 || CurrentTakenAttack.Dir == Direction.Left && transform.right.x < 0) { OffBalance = true; } else { OffBalance = false; } } else { Interrupted = false; OffBalance = false; } int Damage = Utility.GetEffectValue(CurrentTakenAttack.Power, CurrentTakenAttack.Potency); CurrentHP -= Damage; SetHPFill((float)CurrentHP / Data.MaxHP); if (DamageText == null) { DamageText = (GameObject)Instantiate(Resources.Load("Prefabs/DamageText"), transform.localPosition, Quaternion.Euler(0, 0, 0)); } DamageText.GetComponent <DamageText>().ActivateSelf(Damage); DamageText.transform.SetParent(Canvas.transform); if (CurrentHP <= 0) { if (DamageText != null) { DamageText.transform.SetParent(SharedCanvas.transform); } EventManager.instance.Fire(new PlayerKillEnemy(CurrentTakenAttack, gameObject)); Destroy(gameObject); return(true); } else { return(false); } }
private void OneMindIncrementSlashPotency(CharacterAttackInfo Attack) { if (OneMindPassiveAbility == null) { return; } var AbilityData = GetComponent <CharacterAbilityData>(); Attack.Potency += AbilityData.OneMindSlashPotencyIncrement * OneMindPassiveAbility.IncrementCount; }
//BattleArtMaster private void BattleArtMasterBonus(CharacterAttackInfo Attack) { if (BattleArtMasterPassiveAbility == null) { return; } var AbilityData = GetComponent <CharacterAbilityData>(); Attack.Potency += AbilityData.BattleArtMasterExtraPotency; }
// Start is called before the first frame update void Start() { var Data = GetComponent <KnightData>(); CurrentTakenAttack = null; CurrentMaxHP = Data.MaxHP; CurrentHP = Data.MaxHP; if (SharedCanvas == null) { SharedCanvas = GameObject.Find("SharedCanvas"); } }
//CriticalEye private void CriticalEyeBonus(CharacterAttackInfo Attack) { if (CriticalEyePassiveAbility == null) { return; } var AbilityData = GetComponent <CharacterAbilityData>(); if (Attack.Potency >= AbilityData.CriticalEyePotencyRequired) { Attack.Potency += AbilityData.CriticalEyeExtraPotency; } }
//UltimateAwakening private void UltimateAwakeningBonus(CharacterAttackInfo Attack) { if (UltimateAwakeningPassiveAbility == null) { return; } var AbilityData = GetComponent <CharacterAbilityData>(); if (Awaken) { Attack.Potency += AbilityData.UltimateAwakeningExtraPotency; } }
public override bool OnHit(AttackInfo Attack) { base.OnHit(Attack); CharacterAttackInfo HitAttack = (CharacterAttackInfo)Attack; int Damage = Utility.GetEffectValue(HitAttack.Power, HitAttack.Potency); CurrentHP -= Damage; m_BehaviorTree.SendEvent("Attacked"); if (HitAttack.Type != CharacterAttackType.Slash) { Interrupted = true; } else { Interrupted = false; } if (DamageText == null) { DamageText = (GameObject)Instantiate(Resources.Load("Prefabs/DamageText"), transform.localPosition, Quaternion.Euler(0, 0, 0)); } DamageText.GetComponent <DamageText>().ActivateSelf(Damage); if (gameObject.name.ToLower().Contains("boss")) { DamageText.GetComponent <TextMeshProUGUI>().color = Color.red; } DamageText.transform.SetParent(Canvas.transform); if (CurrentHP <= 0) { EventManager.instance.Fire(new PlayerKillEnemy((CharacterAttackInfo)Attack, gameObject)); Destroy(gameObject); return(true); } else { return(false); } }
//Power Slash private void PowerSlashAwakenBonus(CharacterAttackInfo Attack) { if (PowerSlashBattleArt == null) { return; } var AbilityData = GetComponent <CharacterAbilityData>(); if (Awaken) { if (PowerSlashBattleArt.Level == 2) { Attack.Potency += AbilityData.PowerSlashAwakenPotencyBonus_Normal; } else if (PowerSlashBattleArt.Level == 3) { Attack.Potency += AbilityData.PowerSlashAwakenPotencyBonus_Upgraded; } } }
//Dancer private void CheckDancerHitEnemy() { if (DancerPassiveAbility == null) { return; } var Data = GetComponent <CharacterData>(); var AbilityData = GetComponent <CharacterAbilityData>(); var SpeedManager = GetComponent <SpeedManager>(); Vector2 Dir = Vector2.right; if (DancerPassiveAbility.DancerAttack.Dir == Direction.Left) { Dir = Vector2.left; } RaycastHit2D[] AllHits = Physics2D.BoxCastAll(SpeedManager.GetTruePos(), AbilityData.DancerHitBoxSize, 0, Dir, 0, Data.EnemyLayer); if (AllHits.Length > 0) { for (int i = 0; i < AllHits.Length; i++) { GameObject Enemy = AllHits[i].collider.gameObject; if (!DancerPassiveAbility.HitEnemies.Contains(Enemy)) { CharacterAttackInfo UpdatedAttack = new CharacterAttackInfo(DancerPassiveAbility.DancerAttack); EventManager.instance.Fire(new PlayerHitEnemy(DancerPassiveAbility.DancerAttack, UpdatedAttack, Enemy)); Enemy.GetComponent <IHittable>().OnHit(UpdatedAttack); DancerPassiveAbility.HitEnemies.Add(Enemy); } } } }
public PlayerBreakEnemyShield(CharacterAttackInfo attack, GameObject enemy) { Attack = attack; Enemy = enemy; }
public PlayerKillEnemy(CharacterAttackInfo attack, GameObject enemy) { Attack = attack; Enemy = enemy; }
public PlayerStartAttackRecovery(CharacterAttackInfo attack, List <GameObject> hitEnemies) { Attack = attack; HitEnemies = hitEnemies; }
public PlayerStartAttackStrike(CharacterAttackInfo attack) { Attack = attack; }
public PlayerEndAttackStrike(CharacterAttackInfo attack, List <GameObject> hitEnemies) { Attack = attack; HitEnemies = hitEnemies; }
public PlayerHitEnemy(CharacterAttackInfo originalattack, CharacterAttackInfo updatedattack, GameObject enemy) { OriginalAttack = originalattack; UpdatedAttack = updatedattack; Enemy = enemy; }
public PlayerStartAttackAnticipation(CharacterAttackInfo attack) { Attack = attack; }