예제 #1
0
 /// <summary>
 /// Cause the player sprite to appear as laying down, which also causes them to become
 /// passable
 /// </summary>
 public void LayDown()
 {
     if (!isDown)
     {
         isDown = true;
         //make sure sprite is in sync with server regardless of local prediction
         playerSprites.SyncWithServer();
         //rotate the sprites and change their layer
         foreach (SpriteRenderer spriteRenderer in spriteRenderers)
         {
             spriteRenderer.transform.rotation = Quaternion.identity;
             spriteRenderer.transform.Rotate(0, 0, -90);
             spriteRenderer.sortingLayerName = "Blood";
         }
     }
 }
예제 #2
0
    /// <summary>
    /// Cause the player sprite to appear as laying down, which also causes them to become
    /// passable.
    ///
    /// No effect if player is restrained.
    /// </summary>
    /// <param name="force">Allows forcing of the player to lay down without validation.
    ///
    /// This is used so server can force client to lay the player down in the event
    /// that they are restrained but the syncvar Playermove.restrained has not yet finished being
    /// propagated.</param>
    public void LayDown(bool force = false)
    {
        if (!force)
        {
            if (playerScript.playerMove.IsRestrained)
            {
                return;
            }
        }

        if (!IsDownClient)
        {
            IsDownClient = true;
            //make sure sprite is in sync with server regardless of local prediction
            playerSprites.SyncWithServer();
            //rotate the sprites and change their layer
            foreach (SpriteRenderer spriteRenderer in spriteRenderers)
            {
                spriteRenderer.transform.rotation = Quaternion.identity;
                spriteRenderer.transform.Rotate(0, 0, -90);
                spriteRenderer.sortingLayerName = "Blood";
            }
        }
    }