Пример #1
0
    //  Let TrackHitPoints handle our death...
    //
    private void KillInstant(Collision2D collision)
    {
        TrackHitPoints gc = GetComponent <TrackHitPoints>();

        GAssert.Assert(null != gc, "DestroyOnImpact, no TrackHitPoints component on this gameObject!");
        gc.KillInstant();
        this.enabled = false;
    }
Пример #2
0
    // Move the object
    //
    private void FixedUpdate()
    {
        if (TimerManager.IsPaused())
        {
            return;
        }
        if (!GameMode.PlayerIsAlive())
        {
            return;
        }



        // Check for room bounds
        if (transform.position.x >= m_vRoomBounds.x || transform.position.x <= -m_vRoomBounds.x)
        {
            m_vTraj.x *= -1;
            ++m_iBounceCount;
        }

        if (transform.position.y + 0.06f >= m_vRoomBounds.y || transform.position.y + 0.06f <= -m_vRoomBounds.y)
        {
            m_vTraj.y *= -1;
            ++m_iBounceCount;
        }

        if (m_iBounceCount >= m_iKillAfterNumBounces)
        {
            TrackHitPoints gc = GetComponent <TrackHitPoints>();
            GAssert.Assert(null != gc, "DestroyOnImpact, no TrackHitPoints component on this gameObject!");
            gc.KillInstant();
            this.enabled = false;
        }
        else
        {
            m_gcRgdBdy.MovePosition(transform.position + ((m_vTraj * m_fMovementSpeed) * TimerManager.fFixedDeltaTime));
        }
    }