示例#1
0
    public void SetGravityMode(GravityMode mode)
    {
        if (currentMode == mode || (_freezeTime > 0 && mode != GravityMode.Player))
        {
            return;
        }

        currentMode = mode;
        _itemColor.SetModeColor((int)mode);

        switch (currentMode)
        {
        case GravityMode.World:
            UnfreezeRigidbody();
            break;

        case GravityMode.Player:
            _defLerpTime = 0f;
            _startRot    = transform.rotation;
            _freezeTime  = 0f;
            FreezeRigidbody();
            break;

        case GravityMode.Self:
            UnfreezeRigidbody();
            break;

        case GravityMode.Freeze:
            FreezeRigidbody();
            rb.isKinematic = true;
            _freezeTime    = 5f;
            break;

        default:
            FreezeRigidbody();
            break;
        }
    }