PawnController.SetNewFacing C# (CSharp) Method

SetNewFacing() private method

private SetNewFacing ( Facing, newDirection ) : void
newDirection Facing,
return void
    internal void SetNewFacing(Facing newDirection)
    {
        if (sprite == null)
        {
            afterLoadFacing = newDirection;
            return;
        }

        if (direction == newDirection)
            return;

        direction = newDirection;
        sprite.transform.Rotate(Vector3.up, 180, Space.Self);
    }

Usage Example

Esempio n. 1
0
    // Use this for initialization
    private void Start()
    {
        Fader = GetComponentInChildren<SceneFadeInOut>();
        CursorManager = GetComponent<CursorManager>();

        PlayerController = PlayerCharacter.GetComponent<PawnController>();
        DescriptionController = FindObjectOfType<DescriptionController>();
        dialogueBlocker = FindObjectOfType<DialogueBlockerController>();
        HidingController = FindObjectOfType<HidingController>();
        ControlsScreenController = FindObjectOfType<ControlsScreenController>();

        if (PlayerController == null)
        {
            Debug.LogError("No controller");
            return;
        }

        var enterData = GetEnterData(PreviousLoadedLevel);
        PlayerController.SetInitPosition(enterData.StartPoint);
        PlayerController.SetNewFacing(enterData.Direction);
    }