Esempio n. 1
0
    void Start()
    {
        MovePosition = transform.position;
        MySprite     = GetComponentInChildren <SpriteRenderer>();
        animator     = GetComponent <Animator>();
        levelManager = FindObjectOfType <BensLevelManager>();
        switch (CurrentFacingDirection)
        {
        case DirectionFacing.Up:
            //   Debug.Log("Turn up");
            animator.SetBool("FacingDown", false);
            animator.SetBool("FacingSide", false);
            animator.SetBool("FacingUp", true);
            // animator.SetTrigger("TurnUp");
            break;

        case DirectionFacing.Down:
            animator.SetBool("FacingUp", false);

            animator.SetBool("FacingSide", false);
            animator.SetBool("FacingDown", true);
            // animator.SetTrigger("TurnDown");
            break;

        case DirectionFacing.Left:
            animator.SetBool("FacingUp", false);
            animator.SetBool("FacingDown", false);
            animator.SetBool("FacingSide", true);
            //  animator.SetTrigger("TurnSide");
            //   MySprite.flipX = true;
            break;

        case DirectionFacing.Right:
            animator.SetBool("FacingUp", false);
            animator.SetBool("FacingDown", false);
            animator.SetBool("FacingSide", true);
            //    animator.SetTrigger("TurnSide");
            //   MySprite.flipX = false;
            break;
        }
    }