// called from the rigidbody that collides.
    public void MissileCollided(Transform impactPoint)
    {
        // load the correct audio mixer
        // AudioMixer mixer = dataComps.audioHandler_ref.mixer;
        // aSource.outputAudioMixerGroup = mixer.FindMatchingGroups("Enemies")[0];

        // activate effects, disable core, play imp[act sound
        elementalMissileEffects [elementIndex].missileCore.enabled = false;
        elementalMissileEffects [elementIndex].missileImpact.SetActive(true);
        elementalMissileEffects [elementIndex].missileImpact.transform.position = impactPoint.position;
        // AudioSource.PlayClipAtPoint(elementalMissileEffects[elementIndex].impactSound, impactPoint.position, 1.0f);
        AudioSource gs = PlayAudioAtPos.PlayClipAt(elementalMissileEffects[elementIndex].impactSound, impactPoint.position, 1.0f);

        gs.spatialBlend = (0.8f);
        // gs.outputAudioMixerGroup = mixer.FindMatchingGroups("Enemies")[0];

        // calculate distance with player to inflict damage
        distanceChecker = Vector3.Distance(impactPoint.position, player_Pos.position);

        // if impact missile is whithin  impact range.
        if (distanceChecker <= impactRange)
        {
            // damage player
            player_ref.ApplyDamage(elementalMissileEffects[elementIndex].damage);
        }

        Destroy(gameObject, 3.0f);
    }
    void OnTriggerEnter(Collider col)
    {
        FPSPlayer player = col.GetComponent <FPSPlayer>();

        if (player && !fxPlayed)
        {
            player.ApplyDamage(player.maximumHitPoints + 1);
            AudioSource.PlayClipAtPoint(squishSnd, player.transform.position, 0.75f);
            fxPlayed = true;
        }
    }
 void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.tag == "Player")
     {
         FPSPlayer player = col.GetComponent <FPSPlayer>();
         player.ApplyDamage(player.maximumHitPoints + 1.0f);
     }
     else if (col.GetComponent <Rigidbody>())
     {
         col.gameObject.SetActive(false);
     }
 }
Exemple #4
0
 void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.tag == "Player")
     {
         FPSPlayer player = col.GetComponent <FPSPlayer>();
         if (player && !fxPlayed)
         {
             player.ApplyDamage(player.maximumHitPoints + 1.0f);
             PlayAudioAtPos.PlayClipAt(squishSnd, player.transform.position, 0.75f);
             crushTime = Time.time;
             fxPlayed  = true;
         }
     }
 }
Exemple #5
0
    void OnTriggerEnter(Collider col)
    {
        FPSPlayer player = col.GetComponent <FPSPlayer>();

        if (player)
        {
            player.ApplyDamage(player.maximumHitPoints + 1);
        }
        else if (col.rigidbody)
        {
            Destroy(col.rigidbody.gameObject);
        }
        else
        {
            Destroy(col.gameObject);
        }
    }
Exemple #6
0
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "Player")
        {
            FPSPlayer player = col.GetComponent <FPSPlayer>();
            if (player.invulnerable)
            {
                player.invulnerable = false;
            }
            admanager.resetPositionInDeath = true;

            player.ApplyDamage(player.maximumHitPoints + 1.0f);
        }
        else if (col.GetComponent <Rigidbody>())
        {
            col.gameObject.SetActive(false);
        }
    }
 void OnTriggerStay(Collider col)
 {
     if (col.gameObject.tag == "Player")
     {
         if (damageTime < Time.time)
         {
             FPSPlayerComponent.ApplyDamage(damage);
             damageTime = Time.time + delay;
         }
     }
     if (col.gameObject.layer == 13)        //also damage NPCs
     {
         if (col.GetComponent <CharacterDamage>())
         {
             CharacterDamage NPC = col.GetComponent <CharacterDamage>();
             if (damageTime < Time.time)
             {
                 NPC.ApplyDamage(damage, Vector3.zero, transform.position, null, false, false);
                 damageTime = Time.time + delay;
             }
         }
     }
 }
Exemple #8
0
 public void ApplyDamage(float damage)
 {
     FPSPlayerComponent.ApplyDamage(damage);
 }