/// <summary> /// ActorCore constructor /// </summary> public ForceMovement(ActorCore rActorCore) : base(rActorCore) { mActorCore = rActorCore; }
/// <summary> /// ActorCore constructor /// </summary> public SpawnGameObject(ActorCore rActorCore) : base(rActorCore) { mActorCore = rActorCore; }
/// <summary> /// ActorCore constructor /// </summary> public ActorCoreEffect(ActorCore rActorCore) { mActorCore = rActorCore; }
/// <summary> /// ActorCore constructor /// </summary> public CauseDamage(ActorCore rActorCore) : base(rActorCore) { mActorCore = rActorCore; }
/// <summary> /// ActorCore constructor /// </summary> public ModifyAttribute(ActorCore rActorCore) : base(rActorCore) { mActorCore = rActorCore; }
/// <summary> /// ActorCore constructor /// </summary> public ModifyMovement(ActorCore rActorCore) : base(rActorCore) { mActorCore = rActorCore; }
/// <summary> /// Raised when the impact occurs /// </summary> /// <param name="rHitInfo">CombatHit structure detailing the hit information.</param> /// <param name="rAttackStyle">ICombatStyle that details the combat style being used.</param> protected virtual void OnImpact(CombatHit rHitInfo, ICombatStyle rAttackStyle = null) { // If we get here, there's an impact mImpactCount++; // Extract out information about the hit Transform lHitTransform = GetClosestTransform(rHitInfo.Point, rHitInfo.Collider.transform); Vector3 lHitDirection = Quaternion.Inverse(lHitTransform.rotation) * (rHitInfo.Point - lHitTransform.position).normalized; // Put together the combat info. This will will be modified over time CombatMessage lMessage = CombatMessage.Allocate(); lMessage.Attacker = mOwner; lMessage.Defender = rHitInfo.Collider.gameObject; lMessage.Weapon = this; lMessage.Damage = GetAttackDamage(1f, (rAttackStyle != null ? rAttackStyle.DamageModifier : 1f)); lMessage.ImpactPower = GetAttackImpactPower(); lMessage.HitPoint = rHitInfo.Point; lMessage.HitDirection = lHitDirection; lMessage.HitVector = rHitInfo.Vector; lMessage.HitTransform = lHitTransform; // Grab cores for processing ActorCore lAttackerCore = (mOwner != null ? mOwner.GetComponent <ActorCore>() : null); ActorCore lDefenderCore = rHitInfo.Collider.gameObject.GetComponent <ActorCore>(); // Pre-Attack lMessage.ID = CombatMessage.MSG_ATTACKER_ATTACKED; if (lAttackerCore != null) { lAttackerCore.SendMessage(lMessage); } #if USE_MESSAGE_DISPATCHER || OOTII_MD MessageDispatcher.SendMessage(lMessage); #endif // Attack Defender lMessage.ID = CombatMessage.MSG_DEFENDER_ATTACKED; if (lDefenderCore != null) { ICombatant lDefenderCombatant = rHitInfo.Collider.gameObject.GetComponent <ICombatant>(); if (lDefenderCombatant != null) { lMessage.HitDirection = Quaternion.Inverse(lDefenderCore.Transform.rotation) * (rHitInfo.Point - lDefenderCombatant.CombatOrigin).normalized; } lDefenderCore.SendMessage(lMessage); #if USE_MESSAGE_DISPATCHER || OOTII_MD MessageDispatcher.SendMessage(lMessage); #endif } else { lMessage.HitDirection = Quaternion.Inverse(lHitTransform.rotation) * (rHitInfo.Point - lHitTransform.position).normalized; IDamageable lDefenderDamageable = rHitInfo.Collider.gameObject.GetComponent <IDamageable>(); if (lDefenderDamageable != null) { lDefenderDamageable.OnDamaged(lMessage); } Rigidbody lRigidBody = rHitInfo.Collider.gameObject.GetComponent <Rigidbody>(); if (lRigidBody != null) { lRigidBody.AddForceAtPosition(rHitInfo.Vector * lMessage.ImpactPower, rHitInfo.Point, ForceMode.Impulse); } } // Attacker response if (lAttackerCore != null) { lAttackerCore.SendMessage(lMessage); #if USE_MESSAGE_DISPATCHER || OOTII_MD MessageDispatcher.SendMessage(lMessage); #endif } // Finish up any impact processing (like sound) OnImpactComplete(lMessage); // Release the combatant to the pool CombatMessage.Release(lMessage); }
/// <summary> /// ActorCore constructor /// </summary> public SpawnParticles(ActorCore rActorCore) : base(rActorCore) { mActorCore = rActorCore; }