예제 #1
0
파일: Item.cs 프로젝트: c6tonsun/GameCHAMP
    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;
        }
    }