}                                                // được thực hiện khi 1 lệnh được thực thi.

    public static Command StaticReadAndCreate(ref InputMemoryBitStream input)
    {
        Command returnval = new Command();
        int     type      = 0;

        input.Read(ref type);
        int networkid = 0;

        input.Read(ref networkid);
        int playerid = 0;

        input.Read(ref playerid);
        CommandType mtype = (CommandType)type;

        switch (mtype)
        {
        case CommandType.CM_ATTACK:
        {
            returnval = new AttackCommand();
            returnval.SetNetworkID(networkid);
            returnval.SetPlayerID(playerid);
            returnval.Read(ref input);
            break;
        }

        case CommandType.CM_MOVE:
        {
            returnval = new MoveCommand();
            returnval.SetNetworkID(networkid);
            returnval.SetPlayerID(playerid);
            returnval.Read(ref input);
            break;
        }

        case CommandType.CM_SPAWN:
        {
            returnval = new SpawnCommand();
            returnval.SetNetworkID(networkid);
            returnval.SetPlayerID(playerid);
            returnval.Read(ref input);
            break;
        }

        case CommandType.CM_ROTATE:
        {
            break;
        }

        default: break;
        }

        return(returnval);
    }
    public static AttackCommand StaticCreate(int _inMyNetworkID, int _inTargetNetworkID)
    {
        AttackCommand re       = null;
        GameObject    gameob   = NetworkManager_v2.mInstance.GetGameobjectByNetworkId(_inMyNetworkID);
        GameObject    targetob = NetworkManager_v2.mInstance.GetGameobjectByNetworkId(_inTargetNetworkID);
        int           playerid = NetworkManager_v2.mInstance.GetPlayerID();

        if (gameob != null && targetob != null)
        {
            NetworkObject netob     = gameob.GetComponent <NetworkObject>();
            NetworkObject netTarget = targetob.GetComponent <NetworkObject>();
            if (netob != null && netTarget != null)
            {
                if (netTarget.GetPlayerId() != netob.GetPlayerId() && playerid == netob.GetPlayerId())
                {
                    re = new AttackCommand();
                    re.SetNetworkID(_inMyNetworkID);
                    re.SetPlayerID(playerid);
                    re.SetTargetNetworkID(_inTargetNetworkID);
                }
            }
        }
        return(re);
    }