コード例 #1
0
    /// <summary>
    /// 杀死单位
    /// <para>unit</para>
    /// <para>bool triggerEvent 是否触发事件</para>
    /// </summary>
    /// <param name="luaState"></param>
    /// <returns></returns>
    public static int KillUnit(ILuaState luaState)
    {
        ISTGMovable go           = luaState.ToUserData(-2) as ISTGMovable;
        bool        triggerEvent = luaState.ToBoolean(-1);

        if (triggerEvent)
        {
            go.Eliminate(eEliminateDef.CodeEliminate);
        }
        else
        {
            go.Eliminate(eEliminateDef.CodeRawEliminate);
        }
        return(0);
    }
コード例 #2
0
    /// <summary>
    /// 强制删除一个单位
    /// <para>必定不触发事件</para>
    /// </summary>
    /// <param name="luaState"></param>
    /// <returns></returns>
    public static int DelUnit(ILuaState luaState)
    {
        ISTGMovable go = luaState.ToUserData(-1) as ISTGMovable;

        go.Eliminate(eEliminateDef.ForcedDelete);
        return(0);
    }