Example #1
0
    void OnSpaceshipCollision(Collision col)
    {
        if (!enabled)
        {
            return;
        }
        float impactForce = col.impactForceSum.magnitude;
        float seconds     = Mathf.Max(0f, (impactForce - 15f) * 0.1f);

        mSc.DamageNavigation(seconds);
        GameUnit gu = mSc.GetComponent <GameUnit>();

        if (gu != null)
        {
            gu.ApplyDamage(impactForce * 2f);
        }
        if (Player.ship == mSc)
        {
            ChaseCamera.rumble += impactForce / 50f;
        }
    }