public void TakeDamage(GameObject HitData, EnemyHit PartHit) { attackData = HitData.GetComponent <BasicAttackData>(); if (PartHit.BreakablePart == true) { PartHit.PartHealth = PartHit.PartHealth - (attackData.DamageValue * PartHit.PartDamageMulti); Debug.Log("Part Health: " + PartHit.PartHealth); } EnemyHealth = EnemyHealth - (attackData.DamageValue * PartHit.PartDamageMulti); Debug.Log("Enemy Health: " + EnemyHealth); }
/// <summary> /// Consumes ammo. /// </summary> /// <returns><c>true</c>, if ammo was checked, <c>false</c> otherwise.</returns> /// <param name="attackData">Attack data.</param> protected virtual void ConsumeAmmo(BasicAttackData attackData) { if (attackData.attackType == AttackType.MELEE || attackData.ammoType == null || attackData.ammoType == "") return; itemManager.ConsumeItem (attackData.ammoType, 1); }
// TODO Add some more data? /// <summary> /// Initializes a new instance of the <see cref="PlatformerPro.CharacterEventArgs"/> class. /// </summary> /// <param name="character">Character.</param> public AttackEventArgs(Character character, BasicAttackData attackData) : base(character) { Name = Name; }
/// <summary> /// Is the character in the right place for the given attack. /// </summary> /// <returns><c>true</c>, if location was checked, <c>false</c> otherwise.</returns> /// <param name="attackData">Attack data.</param> protected virtual bool CheckLocation(BasicAttackData attackData) { if (attackData.attackLocation == AttackLocation.ANY) return true; if (attackData.attackLocation == AttackLocation.ANY_BUT_SPECIAL && !(character.ActiveMovement is SpecialMovement) && !(character.ActiveMovement is WallMovement)) { return true; } if (attackData.attackLocation == AttackLocation.GROUNDED && character.Grounded && !character.OnLadder && (character.ActiveMovement is GroundMovement || // If the attack has control we still want to be able to trigger combos (character.ActiveMovement is BasicAttacks && (character.AttackLocation != AttackLocation.AIRBORNE))) && // Don't allow when character is about to jump character.Input.JumpButton != ButtonState.DOWN) { return true; } if (attackData.attackLocation == AttackLocation.AIRBORNE && (character.ActiveMovement is AirMovement || // If the attack has control we still want to be able to trigger combos (character.ActiveMovement is BasicAttacks && (character.AttackLocation != AttackLocation.GROUNDED))) && !character.OnLadder) { return true; } return false; }
/// <summary> /// Is the input correct for the given attack. This implmenetation is simple a key press, but another could /// be more complex (queueable combo attacks, or complex key combinations). /// </summary> /// <returns><c>true</c>, if input was checked, <c>false</c> otherwise.</returns> /// <param name="attackData">Attack data.</param> protected virtual bool CheckInput(BasicAttackData attackData) { if (character.Input.GetActionButtonState(attackData.actionButtonIndex) == ButtonState.DOWN) return true; return false; }
/// <summary> /// Checks that the player has enough ammo to fire. /// </summary> /// <returns><c>true</c>, if ammo was checked, <c>false</c> otherwise.</returns> /// <param name="attackData">Attack data.</param> protected virtual bool CheckAmmo(BasicAttackData attackData) { if (attackData.attackType == AttackType.MELEE || attackData.ammoType == null || attackData.ammoType == "") return true; if (itemManager.ItemCount (attackData.ammoType) > 0) { return true; } return false; }
internal override void ReadBody(ByteReader reader) { this.BasicAttackData = reader.ReadBasicAttackData(); }
protected override void ReadBody(ByteReader reader) { this.Attack = reader.ReadBasicAttackDataPacket(); }