コード例 #1
0
    } // END - Fixed Update.

    // DOES NOT INCLUDE INITIAL DAMAGE WHEN APPLYING PLASMA DAMAGE!
    void PlasmaDamageOverTime(){
        Collider[] go_ObjectsHit = Physics.OverlapSphere(this.transform.position, v_PlasmaExplosionRadius);
        foreach (Collider objectIndex in go_ObjectsHit){
            CS_DamageModule v_ObjectDamageModule = objectIndex.GetComponent<CS_DamageModule>();
            if (v_ObjectDamageModule != null) { v_ObjectDamageModule.ApplyPlasmaDamage(0, v_PlasmaExplosionSubDamage * Time.deltaTime, (v_PlasmaExplosionEffectDuration * 0.1f) * Time.deltaTime); }
        } // END - ForEach loop.
    } // END - Explosion.
コード例 #2
0
    // END - Variables.


    // Use this for initialization
    void Start(){
        v_ParticleEffect = GetComponent<ParticleSystem>();
        if (!v_DestroyOnNoParticles) { Destroy(gameObject, v_Lifetime); } // If not using emitter life, use lifetime value.


        // Generate a sphere and collect all objects within it:
        Collider[] go_ObjectsHit = Physics.OverlapSphere(this.transform.position, v_PlasmaExplosionRadius);
        // Run for loop to recursively effect objects:
        foreach (Collider objectIndex in go_ObjectsHit){
        // Apply Plasma Damage:
            CS_DamageModule v_ObjectDamageModule = objectIndex.GetComponent<CS_DamageModule>();
            if (v_ObjectDamageModule != null) { v_ObjectDamageModule.ApplyPlasmaDamage(v_PlasmaExplosionDamage, v_PlasmaExplosionSubDamage, v_PlasmaExplosionEffectDuration); }
        } // END - ForEach loop.


    } // END - Start