青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

天行健 君子當(dāng)自強(qiáng)而不息

Working with Maps and Levels(9)

Blocking the Path with Barriers

You know—detecting when your character is walking around the map bumping into walls or standing
on solid ground. What about objects such as doors blocking your character’s way?
Because a door is not part of the terrain, I didn’t include a door when I constructed
the collision detection code. Now is the time to remedy that situation.

Anything that bars clear passage of a character’s movement is called a barrier.
Barriers can exist in two states—open (disabled) or closed (enabled). Characters
are allowed to pass through a barrier when it is open, but they cannot pass through
when the barrier is closed.

You can treat barriers much as you do triggers. You can define a barrier similar to
the way you define a trigger on a map. You can define barriers as spheres, boxes,
cylinders, and triangles. Barriers can also have an enabled state, with true meaning
that the barrier is blocking the character’s passage and false meaning that the way
through the barrier is clear.

The big difference between barriers and triggers is that barriers can have meshes
and animation assigned to them. This relieves you of the burden of drawing the
barrier and gives the job to the barrier engine. All you have to do is assign the
meshes and animations.

You start off using barriers with the barrier class declaration,
which looks very similar to the trigger class declaration. Notice that I also
define an enum list and structure (sBarrier) used to contain each barrier’s data:

enum BarrierType
{
    BARRIER_SPHERE = 0, BARRIER_BOX, BARRIER_CYLINDER, BARRIER_TRIANGLE
};

/********************************************************************************************/

typedef 
struct sBarrier
{
    
long    type;  // BARRIER_SPHERE, BARRIER_BOX, etc.
    long    id;
    
bool    enabled;

    
float   x_pos, y_pos, z_pos;
    
float   x_rot, y_rot, z_rot;

    
float   x1, y1, z1;
    
float   x2, y2, z2;
    
float   x3, z3;

    
float   radius;

    cObject 
object;

    sBarrier*   prev;
    sBarrier*   next;

    
//////////////////////////////////////////////////////////////////////

    sBarrier()  
    { 
        prev = next = NULL; 
    }

    ~sBarrier() 
    { 
        delete next; next = NULL;  
    }
} *sBarrierPtr;

Here’s where the similarities between the triggers and barrier end. A barrier needs
a graphical representation (a 3-D mesh), so the code adds a Graphics
Core cObject object that is used to contain the barrier’s mesh and animation data.

Getting back to the similarities of the trigger and barrier classes, notice the pointers
that maintain the linked list as well as the sBarrier structure constructor and
destructor.

The similarities between triggers and barrier continue with the declaration of the
barrier class:

typedef class cBarrier
{
private:
    
long        m_num_barriers;
    sBarrier*   m_root_barrier;

    
//////////////////////////////////////////////////////////////////////

public:
    cBarrier()
    {
        m_num_barriers = 0;
        m_root_barrier = NULL;
    }
    
    ~cBarrier()
    {
        free();
    }

    
void free()
    {
        delete m_root_barrier;
        m_root_barrier = NULL;

        m_num_barriers = 0;
    }

    
long get_num_barriers()
    {
        
return m_num_barriers;
    }

    sBarrier* get_root_barrier()
    {
        
return m_root_barrier;
    }
 

Shift your focus for a moment to the arguments that the add_barrier function is taking.
Aside from the position in which to position the barrier (using the x_pos, y_pos,
and z_pos arguments), the add_barrier function takes the rotational values in which to
draw the barrier’s mesh (using the x_rot, y_rot, and z_rot arguments that represent the
X-, Y-, and Z-rotational values, in radians, respectively).

Notice that the addition of rotational values throughout the barrier class, as well as
the addition of an extra trio of coordinates that define the mesh’s position in the
world. As you come upon these additional values, I’ll be sure to point them out.

    sBarrier* add_barrier(long type, long id, bool enabled,
                          
float x_pos, float y_pos, float z_pos,
                          
float x_rot, float y_rot, float z_rot)
    {
        
// allocate a new barrier structure and link in

        sBarrier* bar = 
new sBarrier;

        bar->prev = NULL;
        bar->next = m_root_barrier;

        
if(m_root_barrier)
            m_root_barrier->prev = bar;

        m_root_barrier = bar;

        bar->type    = type;
        bar->id      = id;
        bar->enabled = enabled;
        bar->x_pos   = x_pos;
        bar->y_pos   = y_pos;
        bar->z_pos   = z_pos;
        bar->x_rot   = x_rot;
        bar->y_rot   = y_rot;
        bar->z_rot   = z_rot;

        m_num_barriers++;

        
return bar;
    }  

posted on 2007-12-10 13:50 lovedday 閱讀(189) 評論(0)  編輯 收藏 引用

公告

導(dǎo)航

統(tǒng)計

常用鏈接

隨筆分類(178)

3D游戲編程相關(guān)鏈接

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            欧美99在线视频观看| 欧美 日韩 国产 一区| 91久久精品久久国产性色也91 | 欧美大片免费观看| 久久夜色精品一区| 91久久精品www人人做人人爽| 亚洲国产精品毛片| 欧美日韩国产成人在线91| 亚洲视频 欧洲视频| 亚洲主播在线播放| 狠狠色综合色区| 亚洲国产欧美另类丝袜| 欧美色欧美亚洲另类七区| 午夜在线成人av| 久久久精品一品道一区| 亚洲麻豆视频| 亚洲欧美日韩国产精品| 亚洲欧美久久久久一区二区三区| 亚洲人成网站999久久久综合| 欧美激情一区二区三区在线| 欧美午夜不卡影院在线观看完整版免费 | 国内外成人免费激情在线视频网站| 久久色在线播放| 欧美国产视频日韩| 午夜精品福利视频| 美女免费视频一区| 亚洲欧美一区二区激情| 久久在线免费观看视频| 亚洲综合国产激情另类一区| 久久精品免费电影| 亚洲女ⅴideoshd黑人| 久久亚洲精品视频| 中文精品视频| 91久久久久久| 亚洲无线观看| 亚洲电影激情视频网站| 9色精品在线| 亚洲国产成人久久综合| 亚洲一区bb| 日韩视频在线免费| 久久久噜噜噜久久久| 亚洲午夜高清视频| 老司机67194精品线观看| 午夜视频一区二区| 欧美日韩精品一区视频| 免费永久网站黄欧美| 国产精品专区第二| 日韩小视频在线观看专区| 在线观看欧美日韩| 羞羞答答国产精品www一本| 一本久道久久久| 另类亚洲自拍| 久久久久综合| 亚洲精品1区2区| 欧美一级视频精品观看| 亚洲愉拍自拍另类高清精品| 欧美va天堂在线| 牛牛国产精品| 国色天香一区二区| 亚洲欧美日韩国产一区二区| 亚洲综合视频网| 国产精品成人一区二区三区吃奶| 亚洲国产高清视频| 亚洲日本欧美在线| 模特精品在线| 欧美国产日韩视频| 18成人免费观看视频| 久久国产综合精品| 鲁大师影院一区二区三区| 国内偷自视频区视频综合| 欧美亚洲综合另类| 久久网站热最新地址| 在线播放不卡| 久久婷婷久久| 久久成人精品| 国产日产欧美a一级在线| 99精品国产在热久久下载| 一区二区三区回区在观看免费视频 | 91久久精品日日躁夜夜躁欧美| 久久伊人免费视频| 欧美黑人国产人伦爽爽爽| 亚洲日本va午夜在线影院| 欧美精品国产一区二区| 亚洲人在线视频| 亚洲欧美日韩精品| 国产精品入口尤物| 久久aⅴ国产紧身牛仔裤| 久久久久久久久一区二区| 久久九九久精品国产免费直播| 久久精品欧美日韩| 亚洲成色www8888| 欧美sm极限捆绑bd| 中文精品视频| 亚洲国产精品va| 亚洲老司机av| 亚洲欧美综合v| 一区二区在线看| 欧美精品午夜| 亚洲免费一级电影| 免费久久99精品国产自在现线| 亚洲国产综合在线| 国产精品乱码人人做人人爱| 欧美在线三区| 亚洲精品乱码久久久久| 欧美一区二区精品在线| 在线不卡亚洲| 国产精品久久一区二区三区| 久久精品国产一区二区电影 | 亚洲成人在线观看视频| 欧美日韩国产精品专区| 久久se精品一区精品二区| 亚洲精品少妇网址| 久久免费视频这里只有精品| 一区二区视频免费在线观看| 久久国产精品亚洲77777| 亚洲欧洲日本国产| 欧美在线网址| 一区二区三区免费网站| 国内精品免费在线观看| 你懂的国产精品| 欧美伊人精品成人久久综合97 | 亚洲一区二区三区精品视频| 影音先锋日韩资源| 国产欧美日韩中文字幕在线| 欧美久久视频| 免费在线一区二区| 久久精品在线| 欧美在线免费播放| 亚洲女人天堂av| 一本色道久久综合亚洲精品高清| 欧美黑人在线观看| 久久亚洲国产成人| 久久xxxx精品视频| 午夜欧美精品久久久久久久| 亚洲午夜在线观看| 99热免费精品在线观看| 亚洲黄色av| 亚洲国产精品一区二区第四页av| 国产农村妇女毛片精品久久麻豆| 欧美日本国产视频| 欧美激情二区三区| 欧美国产精品人人做人人爱| 女女同性精品视频| 欧美91大片| 欧美激情综合五月色丁香| 免播放器亚洲| 欧美肥婆在线| 欧美日韩一区二区免费在线观看| 欧美电影免费观看大全| 欧美黄色精品| 欧美日韩天堂| 国产精品久久久久国产精品日日| 欧美天天影院| 国产精品一区二区a| 国产欧美日韩不卡| 国产一区二区三区四区hd| 国产一区二区成人久久免费影院| 国产亚洲精品一区二区| 国产在线精品一区二区夜色| 精品不卡一区| 亚洲高清电影| 亚洲视频在线视频| 欧美一级欧美一级在线播放| 久久久久久香蕉网| 欧美国产欧美亚洲国产日韩mv天天看完整| 免费成年人欧美视频| 欧美激情在线有限公司| 亚洲日本免费电影| 亚洲男人的天堂在线| 久久亚洲精品欧美| 欧美日韩一区在线观看| 国产视频一区在线观看| 在线成人激情黄色| 中文一区在线| 久久久久国产精品麻豆ai换脸| 欧美91福利在线观看| 日韩亚洲欧美中文三级| 性色av一区二区三区在线观看| 久久乐国产精品| 欧美日韩在线播| 国外精品视频| 国产精品99久久久久久www| 欧美一区二区三区四区在线| 亚洲国产mv| 午夜在线视频一区二区区别| 欧美好骚综合网| 国产一区久久久| 亚洲婷婷国产精品电影人久久| 久久精品日产第一区二区| 亚洲激情中文1区| 性亚洲最疯狂xxxx高清| 欧美日韩国产成人在线免费| 国产一区 二区 三区一级| 一区二区国产日产| 巨乳诱惑日韩免费av| 在线亚洲伦理| 欧美精品成人| 亚洲激情成人| 久久一区二区视频| 午夜精品婷婷|