Exemplo n.º 1
0
    /// <summary>
    /// 设置附件相对于Master的相对位置以及旋转角度
    /// <para>attachment</para>
    /// <para>offsetX</para>
    /// <para>offsetY</para>
    /// <para>relativeRotation 相对旋转角度</para>
    /// <para>isFollowMasterRotation 是否跟随master一起旋转</para>
    /// <para>isFollowingContinuously 是否持续跟随移动</para>
    /// </summary>
    /// <param name="luaState"></param>
    /// <returns></returns>
    public static int SetAttachmentRelativePos(ILuaState luaState)
    {
        IAttachment attachment              = luaState.ToUserData(-6) as IAttachment;
        float       offsetX                 = (float)luaState.ToNumber(-5);
        float       offsetY                 = (float)luaState.ToNumber(-4);
        float       relativeRotation        = (float)luaState.ToNumber(-3);
        bool        isFollowMasterRotation  = luaState.ToBoolean(-2);
        bool        isFollowingContinuously = luaState.ToBoolean(-1);

        attachment.SetRelativePos(offsetX, offsetY, relativeRotation, isFollowMasterRotation, isFollowingContinuously);
        return(0);
    }