示例#1
0
        internal static void InternalToggle()
        {
            if (PlayerCommands.UpdateCurrentPlayerBody(out _currentNetworkUser, out _currentBody))
            {
                if (IsActivated)
                {
                    if (_collidableLayersCached != 0)
                    {
                        _currentBody.GetComponent <KinematicCharacterMotor>().CollidableLayers = _collidableLayersCached;
                    }
                    _currentBody.characterMotor.SetUseGravity(true);
                    UndoHooks();
                }
                else
                {
                    _collidableLayersCached = _currentBody.GetComponent <KinematicCharacterMotor>().CollidableLayers;
                    _currentBody.GetComponent <KinematicCharacterMotor>().CollidableLayers = 0;
                    _currentBody.characterMotor.SetUseGravity(false);
                    ApplyHooks();
                }

                IsActivated = !IsActivated;
                Log.Message(string.Format(Lang.NOCLIP_TOGGLE, IsActivated));
            }
        }
示例#2
0
 internal static void Update()
 {
     if (PlayerCommands.UpdateCurrentPlayerBody(out _currentNetworkUser, out _currentBody))
     {
         Loop();
     }
 }
        internal static void InternalActivation()
        {
            if (PlayerCommands.UpdateCurrentPlayerBody(out _, out _currentBody))
            {
                var playerTransform = _currentBody.GetComponentInChildren <KinematicCharacterMotor>().transform;
                var aimDirection    = _currentBody.GetComponentInChildren <InputBankTest>().aimDirection;

                if (Physics.Raycast(playerTransform.position, aimDirection, out var hit, Mathf.Infinity, 1 << 11))
                {
                    _currentBody.GetComponentInChildren <KinematicCharacterMotor>().SetPosition(hit.point + new Vector3(0, 5));
                }
            }
        }