Пример #1
0
    void ChangeLookingDirection(Vector3 _direction)
    {
        if (_direction.z != 0)
        {
            playerLookingDirection = (_direction.z > 0) ? LookingDirectionName.FORWARD : LookingDirectionName.BACKWARD;
        }
        else if (_direction.x != 0)
        {
            playerLookingDirection = (_direction.x > 0) ? LookingDirectionName.RIGHT : LookingDirectionName.LEFT;
        }

        //call change facing event
        if (OnLookingChange != null)
        {
            OnLookingChange(playerLookingDirection);
        }
        Debug.Log(playerLookingDirection);
    }
Пример #2
0
    void RefreshFacing(LookingDirectionName fd)
    {
        switch (fd)
        {
        case LookingDirectionName.FORWARD:
            _collider.center = Vector3.forward * offset;
            break;

        case LookingDirectionName.RIGHT:
            _collider.center = Vector3.right * offset;
            break;

        case LookingDirectionName.LEFT:
            _collider.center = Vector3.left * offset;
            break;

        default:
            _collider.center = Vector3.back * offset;
            break;
        }
    }
Пример #3
0
    public void RefreshFacing(LookingDirectionName fd)
    {
        switch (fd)
        {
        case LookingDirectionName.FORWARD:
            transform.localPosition = Vector3.forward * offset;
            break;

        case LookingDirectionName.RIGHT:
            transform.localPosition = Vector3.right * offset;
            break;

        case LookingDirectionName.LEFT:
            transform.localPosition = Vector3.left * offset;
            break;

        default:
            transform.localPosition = Vector3.back * offset;
            break;
        }
    }