public void Attacked(int damage) { Actor.Color = new Vector3(1.0f, 0.0f, 0.0f); mIsAttacked = true; if (damage >= 0 & HP > 0) { HP -= damage; } else if (damage < 0) { HP -= damage; if (HP > mMaxHP) { HP = mMaxHP; } } if (damage > 0) { if (!HasSoundEmitter) { mSoundEmitter = new Sound.AudioSource(new Sound.AudioBuffer("../../../../Content/Audio/PunchSoundMono.wav")); Actor.mAudioSources.Add(mSoundEmitter); HasSoundEmitter = true; } mSoundEmitter.Play(); } }
public void Attacked(int damage) { mIsAttacked = true; if (damage >= 0 & HP > 0) { Actor.Color = new Vector3(1.0f, 0.0f, 0.0f); HP -= damage; } else if (damage < 0) { } else { //remove later Escape(); } if (damage > 0) { if (!HasSoundEmitter) { mSoundEmitter = new AudioSource(new AudioBuffer("../../../../Content/Audio/PunchSoundMono.wav")); Actor.mAudioSources.Add(mSoundEmitter); HasSoundEmitter = true; } mSoundEmitter.Play(); } }
public void Attacked(int damage) { Actor.Color = new Vector3(1.0f, 0.0f, 0.0f); mIsAttacked = true; if (damage >= 0 & HP > 0) { HP -= damage; } else if (damage < 0) { //Cant heal the other healers /* * HP -= damage; * if (HP > mMaxHP) * { * HP = mMaxHP; * } */ } else { //remove later Escape(); } if (damage > 0) { if (!HasSoundEmitter) { mSoundEmitter = new Sound.AudioSource(new Sound.AudioBuffer("../../../../Content/Audio/PunchSoundMono.wav")); Actor.mAudioSources.Add(mSoundEmitter); HasSoundEmitter = true; } mSoundEmitter.Play(); } }
public void Attack() { mClosestFiend = null; mClosestAngle = float.MaxValue; foreach (var elem in mInRangeActors) { if (elem == Actor)// || elem.Data.mMesh.mMeshData.mIsTerrain) { continue; } else { var actorToEnemy = elem.ModelMatrix.Translation - Actor.ModelMatrix.Translation; var actor2Enemy2D = new Vector2(actorToEnemy.X, actorToEnemy.Z); if (elem.IActor is IAttacker) { var entity = (IAttacker)elem.IActor; if (entity.IsApe == false) { if (!mIsAttacking) { if (mSoundSing == null) { mSoundSing = new Sound.AudioSource(new Sound.AudioBuffer("../../../../Content/Audio/Gibbons_singen.wav")); Actor.mAudioSources.Add(mSoundSing); } mSoundSing.Play(); } mIsAttacking = true; mHasAttacked = true; Actor.mAnimator.PlayAnimation("singing", true, 500); if (elem.IActor is IMoveable) { var enemy = (IMoveable)elem.IActor; enemy.IsCrazy = true; } var currentAngle = Vector2.Dot(actor2Enemy2D, mCurrentDirection); if (currentAngle < mClosestAngle) { mClosestAngle = currentAngle; mClosestFiend = elem; } } } } } if (mClosestFiend != null && mClosestFiend.IActor is IAttacker) { SetTarget(Actor.mModelMatrix.Translation + 0.01f * (mClosestFiend.mModelMatrix.Translation - Actor.mModelMatrix.Translation)); var enemy = (IAttacker)mClosestFiend.IActor; enemy.Attacked(mDamage); } else { mIsAttacking = false; } }