player.cpp

这个文件代码主要编写的是关于服务器行为模型的内容。

本文件有效日期:2022年2月6日

内部实现

state

定义

来自

enum PlayerState {
    DISABLE =         0x00000000,
    STAND =           0x00000001,
    KICK =            0x00000002,
    KICK_FAULT =      0x00000004,
    GOALIE =          0x00000008,
    CATCH =           0x00000010,
    CATCH_FAULT =     0x00000020,
    BALL_TO_PLAYER =  0x00000040,
    PLAYER_TO_BALL =  0x00000080,
    DISCARD =         0x00000100,
    LOST =            0x00000200, // [I.Noda:00/05/13] added for 3D viewer/commentator/small league
    BALL_COLLIDE =    0x00000400, // player collided with the ball
    PLAYER_COLLIDE =  0x00000800, // player collided with another player
    TACKLE =          0x00001000,
    TACKLE_FAULT =    0x00002000,
    BACK_PASS =       0x00004000,
    FREE_KICK_FAULT = 0x00008000,
    POST_COLLIDE =    0x00010000, // player collided with goal posts
    FOUL_CHARGED =    0x00020000, // player is frozen by intentional tackle foul
    YELLOW_CARD =     0x00040000,
    RED_CARD =        0x00080000,
    ILLEGAL_DEFENSE = 0x00100000,
};

使用

M_state是表示球员状态的实际变量。

void Player::resetState()是状态的重置,利用位运算仅保留STAND | GOALIE | DISCARD | YELLOW_CARD | RED_CARD以及运动、犯规的状态。

模型实现关注点

General

Message

bool Player::parseCommand( const char * command )用于翻译客户端的消息,并进行实现.

Action 行为

dash

本部分应兼顾行为模型 ·dash· Apollo2d-learning (apollo-2d.gitlab.io)阅读。

Copyright@Njupt-Apollo-2d-2021 all right reserved,powered by Gitbook该文件最新修订时间: 2022-02-26 09:05:41

results matching ""

    No results matching ""