找回密码
 点一下
查看: 2423|回复: 3

为什么这个BJ函数需要加这个判断?

[复制链接]
发表于 2011-4-22 15:04:33 | 显示全部楼层 |阅读模式
function AdjustPlayerStateBJ takes integer delta, player whichPlayer, playerstate whichPlayerState returns nothing
    // If the change was positive, apply the difference to the player's
    // gathered resources property as well.
    if (delta > 0) then
        if (whichPlayerState == PLAYER_STATE_RESOURCE_GOLD) then
            call AdjustPlayerStateSimpleBJ(whichPlayer, PLAYER_STATE_GOLD_GATHERED, delta)
        elseif (whichPlayerState == PLAYER_STATE_RESOURCE_LUMBER) then
            call AdjustPlayerStateSimpleBJ(whichPlayer, PLAYER_STATE_LUMBER_GATHERED, delta)
        endif
    endif
    call AdjustPlayerStateSimpleBJ(whichPlayer, whichPlayerState, delta)
endfunction

乍一看 貌似 只有call AdjustPlayerStateSimpleBJ(whichPlayer, whichPlayerState, delta)
也可以的

求解 为什么要加上面的判断
发表于 2011-4-22 17:12:22 | 显示全部楼层
if (whichPlayerState == PLAYER_STATE_RESOURCE_GOLD) then
            call AdjustPlayerStateSimpleBJ(whichPlayer, PLAYER_STATE_GOLD_GATHERED, delta)

PLAYER_STATE_RESOURCE_GOLD和PLAYER_STATE_GOLD_GATHERED不一样哦
也就是说对于金钱和木材,只有正值起效吧
回复

使用道具 举报

 楼主| 发表于 2011-4-22 22:13:00 | 显示全部楼层
引用第1楼zhuzeitou于2011-04-22 17:12发表的 :
if (whichPlayerState == PLAYER_STATE_RESOURCE_GOLD) then
            call AdjustPlayerStateSimpleBJ(whichPlayer, PLAYER_STATE_GOLD_GATHERED, delta)

PLAYER_STATE_RESOURCE_GOLD和PLAYER_STATE_GOLD_GATHERED不一样哦
也就是说对于金钱和木材,只有正值起效吧



不对啊  可是  他判断语句 里面   运行的  和  判断语句外面运行的 都是同1个函数啊  0.0
本来我也以为是只有正值起效  所以我 另delta为负数   结果  金钱还是减少了
回复

使用道具 举报

发表于 2011-9-15 15:50:07 | 显示全部楼层
PLAYER_STATE_GOLD_GATHERED是用于计分屏的吧?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-11-21 23:29 , Processed in 0.167163 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表